This help page is for version 3.7. The latest available help is for version 8.1.
The Execute Script Monitor allows you to write your own custom scripts in the VBScript language to check anything that your script can access. This monitor makes use of the VBScript engine that is already installed on nearly all Windows computers.
The script window is where you enter your VBScript. The script can do anything that can be done in VBScript (including creating external ActiveX/COM components) with all the standard restrictions.
The following global variables and methods are available within the scripting engine:
This read-only string variable is the name of the computer that the monitor is attached to.
This is a string value. This value is passed to any attached actions as the details for the action (ie the content of an email
notification for example).
This is a boolean value. Either FireActions or SendNotifications can be used -- they are identical. If the value is set to True,
actions attached to the monitor will fire. If it is False, they will not fire. The value defaults to False.
GetStatID and RecordStat are used together to record integral data values to the database for reports.
This method takes a single integer value, which is the number of milliseconds that the script should stop and sleep. Be careful about using this causing too many monitors to sleep for very long means other monitors may not get run. Ex: Sleep 1500
Pressing the Test Script button will cause the script to be launched and run from the Console, and will report on the final state of the SendNotification variable. Note that the script will run as the currently logged on user when this button is clicked, but while running from within the monitoring service it will execute as the "run as" user for the service. This may or may not have an effect on the resources that the script can access.
Below is an example script that checks a database connection:
This next example checks to see if there are a certain number of files in a directory:
The last example script checks the size of a specific file and records it to the database: