- Solutions
-
- File Server: Ransomware Protection
- File Server: File Copy
- File Server: Audit File Access
- File Server: Storage growth reporting
- Licensing/Pricing
- Contact
This help page is for version 5.5. The latest available help is for version 9.4.
The Execute Script Monitor allows you to write your own custom scripts in the VBScript, JavaScript, PowerShell languages, or via an SSH connection to a host. You can check anything that your script can access. For VBScript, JavaScript and PowerShell, this monitor makes use of the applicable scripting engine that is already installed on nearly all Windows computers.
The script window is where you enter your script. The script can do anything that can be done in the selected language (including creating external components if available) with all the standard restrictions.
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 scripting language's own objects and elements, the following additional global variables and methods are available within each scripting environment:
A good VBScript reference is available at: http://msdn.microsoft.com/en-us/library/d1wf56tt.aspx
ComputerName |
This read-only string variable is the name of the computer that the monitor is attached to.
|
CustomProp |
This function retrieves the named value of a custom property. It checks the Monitor first, and if not found, checks the monitor's owning computer, and then the computer's group, and then the group's parent group, etc.
Custom properties can be set on Groups, Computers and Monitors by right-clicking on the item and choosing the Custom Properties menu.
|
Details |
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).
|
FireActions |
This is a boolean value. 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 RecordStat |
GetStatID and RecordStat are used together to record integral data values to the database for reports.
|
GetValue StoreValue |
GetValue 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.
The StoreValue 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).
|
MachineID |
Returns the numeric value that uniquely identifies this computer (Computer ID - CID) within the application. Useful in conjunction with the External API.
|
SendMail |
This method sends an email message to the recipient that you choose.
|
Sleep |
This VBScript 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.
|
ToLog |
This method takes a string value and appends it to the service's log file (useful for debugging scripts). The line will start with MONITOR_SCRIPT_LOG.
|
ComputerName |
This read-only string variable is the name of the computer that the monitor is attached to.
|
CustomProp |
This function retrieves the named value of a custom property. It checks the Monitor first, and if not found, checks the monitor's owning computer, and then the computer's group, and then the group's parent group, etc.
Custom properties can be set on Groups, Computers and Monitors by right-clicking on the item and choosing the Custom Properties menu.
|
Details |
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).
|
FireActions |
This is a boolean value. 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 RecordStat |
GetStatID and RecordStat are used together to record integral data values to the database for reports.
|
GetValue StoreValue |
GetValue 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.
The StoreValue 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).
|
MachineID |
Returns the numeric value that uniquely identifies this computer (Computer ID - CID) within the application. Useful in conjunction with the External API.
|
SendMail |
This method sends an email message to the recipient that you choose.
|
Sleep |
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.
|
ToLog |
This method takes a string value and appends it to the service's log file (useful for debugging scripts). The line will start with MONITOR_SCRIPT_LOG.
|
PowerShell interaction happens via the $mon object.
$mon.ComputerName |
This read-only string variable is the name of the computer that the monitor is attached to.
|
$mon.CustomProp |
This function retrieves the named value of a custom property. It checks the Monitor first, and if not found, checks the monitor's owning computer, and then the computer's group, and then the group's parent group, etc.
Custom properties can be set on Groups, Computers and Monitors by right-clicking on the item and choosing the Custom Properties menu.
|
$mon.Details |
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).
|
$mon.FireActions |
This is a boolean value. 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.
|
$mon.GetStatID $mon.RecordStat |
GetStatID and RecordStat are used together to record integral data values to the database for reports.
|
$mon.GetValue $mon.StoreValue |
The GetValue 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.
The StoreValue 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).
|
$mon.MachineID |
Returns the numeric value that uniquely identifies this computer (Computer ID - CID) within the application. Useful in conjunction with the External API.
|
$mon.SendMail |
This method sends an email message to the recipient that you choose.
|
Start-Sleep |
The PowerShell cmdlet takes two parameters. The first parameter specifies timer in seconds (-s) or milliseconds (-m) and the second is an integer that specifies period of time.
|
SSH is a little different than the others. In this case, your script will be sent to the remote computer/device to run. The resulting terminal output is scanned for the special keywords below, and they will be 'executed' in the monitoring service when the script finishes. The keywords have to start in the very first column to be recognized.
PA_Details |
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 particular value can span multiple lines. The value is terminated when a ") is seen.
|
PA_FireActions |
This is a boolean value. 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.
|
PA_RecordStat |
This 'function' will record a statistic returned from the script to the database. It is equivalent to GetStatID and RecordStat in the other languages above.
|
PA_SendMail |
This method sends an email message to the recipient that you choose.
|
Like all monitors, this monitor has standard buttons on the right for Adding Actions, setting Advanced Options and setting the Monitor Schedule.
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
Launch a PS program and record results