What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Server 2008 File Sensor

Votes:

0

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



Best Answer

Accepted Answer

Votes:

0

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



6 Replies

Votes:

0

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

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

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



Votes:

0

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

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

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



Votes:

0

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



Accepted Answer

Votes:

0

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




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.