New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


Server 2008 File Sensor

Votes:

0

Your Vote:

Up

Down

When using a file sensor (Last Modified) on Server 2008 it's not getting the true last modified timestamp. On Server 2003 the last modified file sensor works great. I believe server 2008 changed the NTFS behavior to reduce disk I/O.

Using SMB or even locally on the server, the file doesn't show it's been updated (time stamp) if you refresh (F5) using windows explorer then the timestamps are updated locally and through SMB.

So PRTG doesn't report the true timestamp unless someone is refreshing the directory.

Any ideas on howto correct this problem?

2008 date modified server stamp time

Created on Apr 25, 2011 4:15:29 PM by  Benjamin Auch (51) 1



Best Answer

Accepted Answer

Votes:

0

Your Vote:

Up

Down

I found this article explaining the behavior mentioned above.

It seems that getting the file date from a dir listing is not always going to work as expected with 2008. Getting the file date from the file itself should work however and that is exactly what Benjamin's script does!

Created on Apr 27, 2011 1:03:56 PM by  PRTG Tools Family [prtgtoolsfamily.com] (13,153) 3 4



6 Replies

Votes:

0

Your Vote:

Up

Down

Dear Benjamin,

are you using the "normal" File Sensor or the WMI File Sensor? However it seems we can't reproduce this here, at least not with local files on a PRTG machine.

Best regards.

Created on Apr 26, 2011 12:21:11 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

We are using the normal file sensor.

You have to emulate a program which keeps a log file open and writes updates to it.

Below is a VBS script that duplicates the problem. PRTG can't detect the log file has been updated. I can't try using a local PRTG machine as our install is on Server 2003. We are using the file sensor pointing to a network share on a Windows 2008 Server.

The VBS script creates a file (C:\temp\LogTest.txt) and writes a timestamp into the file every 10 seconds.)

CreateLog.vbs
----------------------------
Dim myFSO, WriteStuff
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteStuff = myFSO.OpenTextFile("c:\temp\LogTest.txt", 8, True)

For count = 0 to 2000
WriteStuff.WriteLine(Now)
WScript.Sleep 10000
Next
----------------------------

Created on Apr 26, 2011 1:19:53 PM by  Benjamin Auch (51) 1

Last change on Apr 26, 2011 3:05:46 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Are the changes also really saved to the file on disk then? Can you try a remote probe to enable local access on the Windows 2008 Server?

Created on Apr 26, 2011 3:06:23 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Yes they are saved to the disk. Using a probe installed on the Server 2008 box, the WMI file sensor does work.

The normal file sensor through SMB from another probe doesn't work. (Timestamps not be updated) - From what I've read this is to reduce disk I/O by design in Server 2008.

My workaround was to create a PowerShell script to monitor the file (not from a local probe).

Here is the powershell for anyone else:

Sensor Properties:
Parameters:   c:\temp\file.txt   OR   \\server\share\file.txt   (You can use local dir or UNC)

Results: Returns the age in seconds.  Always returns OK.  You need to setup channel limits for up/down status.

------------------

FileSensorLastModified.ps1


$a = New-TimeSpan $(Get-Date((gci $args).LastWriteTime)) $(Get-Date)
$result = ("{0:F0}" -f $a.TotalSeconds).ToString() + " :OK"
echo $result






 

Created on Apr 26, 2011 4:05:50 PM by  Benjamin Auch (51) 1

Last change on Apr 27, 2011 9:47:39 AM by  Torsten Lindner [Paessler Support]



Votes:

0

Your Vote:

Up

Down

I'm missing

WriteStuff.Close
set WriteStuff = nothing
set myFSO = nothing

in the example above, that might explain why the file is not written to disk and changes to the file are simply kept in memory.

Created on Apr 27, 2011 8:11:27 AM by  PRTG Tools Family [prtgtoolsfamily.com] (13,153) 3 4



Accepted Answer

Votes:

0

Your Vote:

Up

Down

I found this article explaining the behavior mentioned above.

It seems that getting the file date from a dir listing is not always going to work as expected with 2008. Getting the file date from the file itself should work however and that is exactly what Benjamin's script does!

Created on Apr 27, 2011 1:03:56 PM by  PRTG Tools Family [prtgtoolsfamily.com] (13,153) 3 4



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.