I have been playing around with the file sensor most of this afternoon to try and replicate what we have on the ActiveXperts software, but I cant seem to find a way of doing it.
On ActiveXperts we have a job that runs everyday at 7am that calls a vbscript (see below), which they have as standard. The way I understand this vbscript works is it checks the timestamp from the last time it has ran and if it has changed it send a success email out if it has now it sends a failure email out. Is there anything PRTG can do to replicate this?
Function CheckFileChange( strPath, strCredentials )
' Description:
' Check if a file has changed on a computer. Use network monitor service credentials to access the (remote) computer
' Parameters:
' 1) strPath - UNC formatted file path
' 2) strCredentials As String - Specify an empty string to use Metwork Monitor service credentials.
' To use alternate credentials, enter a server that is defined in Server Credentials table.
' (To define Server Credentials, choose Tools->Options->Server Credentials)' Usage:
' Usage:
' CheckFileChange( "<
Server\Share\Path>", "<Empty String | Server>" )
' Sample:
' CheckFileChange( "
localhost\c$\windows\windowsupdate.log", "" )
Dim strPrevModDate, strModDate
CheckFileChange = retvalUnknown ' Unless indicated otherwise
If( strCredentials <> "" ) Then
If( Not login( strCredentials, SYSEXPLANATION ) ) Then
Exit Function
End If
End If
strModDate = getFileModDateString( strPath )
If( strModDate = "" ) Then
CheckFileChange = retvalUnknown
SYSDATA = ""
SYSEXPLANATION = "File does not exist or cannot be accessed"
Exit Function
End If
strPrevModDate = getCacheValue( extractPlainFile( strPath ) )
setCacheValue extractPlainFile( strPath ), strModDate
If( strPrevModDate = "" ) Then
CheckFileChange = retvalUnknown
SYSDATA = ""
SYSEXPLANATION = "File was not monitored before"
Exit Function
End If
If( strPrevModDate <> strModDate ) Then
CheckFileChange = True
SYSDATA = strModDate
SYSEXPLANATION = "Daily Cube has been updated. File has changed since last check."
Else
CheckFileChange = False
SYSDATA = strModDate
SYSEXPLANATION = "Daily cube might NOT have been updated. File has not changed since last check. Please check jobs or servers!"
End If
If( strCredentials <> "" ) Then
logout( strCredentials )
End If
Add comment