I want to check if a certain file exists, and then have a alarm. If the file doesn't exist PRTG should show a green status icon of the sensor. Is that somehow possible?


Article Comments

This is only possible with a custom sensor, for example the following vbscript:

DEMO - Alarm if file exists.vbs

Dim file, WshFso

Set WshFso = CreateObject("Scripting.FileSystemObject")
file = "c:\test.txt"

If (WshFso.FileExists(file)) then
	WScript.Echo "2:File does exist"
        WScript.Quit(4)
Else
	WScript.Echo "0:File does not exist"	
        WScript.Quit(0)
End If

Please be aware that this script can only be executed by PRTG on a probe. Thus it is necessary to have the file available for PRTG from a probe machine. In this scenario, please also bear in mind the context under which PRTGs Probe service is running, it may not have the same access rights to certain folders/files as a normal (admin) user.

Best Regards.

See Also

Manual section Custom Sensors


Jul, 2010 - Permalink

Custom Sensor available

This can also be achieved with Custom Sensor NetworkFileCount

NetworkFileCount -u=username -p=password|passhash -f=\\myserver\myshare [-s=*.exe -sub]

Supply the credentials (username and password) of an account that has read acces to the file location. Set the "-s=" parameter to match the exact name of the file you want to check.

The sensor returns the number of files matching the "-s=" filter, so in this case if the specified file exists it returns 1 and if the file does not exist it returns 0.

The Custom Sensor can be downloaded from this page.


Jul, 2010 - Permalink