This is an example how to use a timed script two state monitor to monitor a file exists. If the file exists the monitor is healthy.
- Create a Timed Script Two State Monitor, input suitable name, scheudle, target and description.
- Input this script below
- As unhealthy expression input “Property[@Name=’Status’] equals Error”
- As healthy expression input “Property[@Name=’Status’] equals Ok”
- Configure alerts and then your done.
Dim oAPI, oBag
Set oAPI = CreateObject(“MOM.ScriptAPIâ€)
Set oBag = oAPI.CreatePropertyBag()
Set objFSO = CreateObject(“Scripting.FileSystemObjectâ€)
strFile = “C:\myfile.logâ€
If objFSO.FileExists(strFile) Then
Call oBag.AddValue(“Statusâ€,â€Okâ€)
Call oAPI.Return(oBag)
Else
Call oBag.AddValue(“Statusâ€,â€Errorâ€)
Call oAPI.Return(oBag)
End If
[…] against a database and verify the answer. One way is to run a script inside a monitor. In this blog I wrote how to setup a script in a two state monitor. The script in this post will count […]
[…] against a database and verify the answer. One way is to run a script inside a monitor. In this blog I wrote how to setup a script in a two state monitor. The script in this post will count […]