This help page is for version 4.1. The latest available help is for version 5.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. A good VBScript reference is available at: http://msdn.microsoft.com/en-us/library/d1wf56tt.aspx
There are two Test buttons. One will run the script within the Console. The other will send the script to the monitoring service that is monitoring the target computer (Central Monitoring Service or a Satellite) and run the script there. This helps find any problems that might come up from the script possibly running on a different machine, or running as a different user (the service Log As user).
Keep in mind that when the script runs, it might run on a different computer than where you are editing it. That means drive mappings, HKEY_CURRENT_USER registry hive, Internet Explorer settings and the currently running user will often be different.
IMPORTANT: Do not show any user interface elements in the script -- they will not be visible in the monitoring service and will block the script from ever completing.
Besides the VBScript objects and elements, the following additional 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 SendNotification 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 text name and returns the value that was stored earlier via the StoreValue call described below. If nothing was ever stored with that name, an empty string is returned.
Returns the numeric value that uniquely identifies this computer within the application. Useful in conjunction with the External API.
This method sends an email message to the recipient that you choose.
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.
This method takes a text name, and a text value and stores it. This named value can be retrieved later (even when the script runs next) via GetValue. Note that these values will be persisted in the
configuration database and kept in memory with the monitor, so they should be kept relatively small (a few hundred characters long or less).
Check a database value
Check files in a directory
Check the size of a specific file and record to a database
Check if the newest file is older than 6 hours old (to ensure new files are being created)
Launch a program and check the result code