Timed Script Two State Monitor

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.

  1. Create a Timed Script Two State Monitor, input suitable name, scheudle, target and description.
  2. Input this script below
  3. As unhealthy expression input “Property[@Name=’Status’] equals Error”
  4. As healthy expression input “Property[@Name=’Status’] equals Ok”
  5. 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

2 thoughts on “Timed Script Two State Monitor

Comments are closed.