Javascript must be enabled to download our products and perform other essential functions on the website.

This help page is for version 4.2. The latest available help is for version 9.4.

Execute Script Action

The Execute Script Action allows you to receive action parameters that were sent from a monitor and handle them in your own specific way.

The script is run using the computer's built-in VBScript interpreter. This means you can make use of the full VBScript language as well as any installed ActiveX/COM objects which are installed on the system.

Near the top of the action dialog is a "Run script at" selection box. Here you can specify where the script should be run if you have Satellite monitoring services. The default is to run the script on the Central Monitoring Service.

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).

ionicons-v5-h

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.

Additional Script Elements

Besides the VBScript objects and elements, the following additional global variables and methods are available within the scripting engine:

CurrentValue

This is an array of string values, representing the current value (if any) for the item being tested. See Row Variables from the "Variables..." button for the action.

Example:
   myStr = CurrentValue(1)

Date

Current date using the current time formatting

Example:
   displayStr = Date

Extra1

This is an array of string values, representing extra information that may be available from a particular monitor. See Row Variables from the "Variables..." button for the action.

Example:
   myStr = Extra1(1)

Extra2

This is an array of string values, representing extra information that may be available from a particular monitor. See Row Variables from the "Variables..." button for the action.

Example:
   myStr = Extra2(1)

Details

This is a string value. This value is the content of the action being fired. It is sent from the monitor and typically contains information about the alert.

Example:
   myStr = Details

Group

The name of the group that the computer the monitor is attached to belongs in.

Example:
   myStr = Group

GroupPath

The name of the group that the computer the monitor is attached to belongs in, with child groups delimited with a > (ie, Servers/Devices > Austin > Lab )

Example:
   myStr = GroupPath

Item

This is an array of string values, representing the item being tested. See Row Variables from the "Variables..." button for the action.

Example:
   myStr = Item(1)

ItemType

This is an array of string values, representing the type of item being tested. See Row Variables from the "Variables..." button for the action.

Example:
   myStr = ItemType(1)

LimitValue

This is an array of string values, representing the limit/threshold (if any) for the item being tested. See Row Variables from the "Variables..." button for the action.

Example:
   myStr = LimitValue(1)

Machine

This read-only string variable is the name of the computer that caused the script action to fire.

Example:
   myStr = Machine

MachineAlias

This read-only string variable is the aliased name of the computer that caused the script action to fire.

Example:
   myStr = MachineAlias

MachineIP

IP address text string of the computer that the firing monitor is attached to

Example:
   myStr = MachineIP

MonitorTitle

This read-only string variable is the title of monitor that caused this script action to fire.

Example:
   myStr = MonitorTitle

MonitorType

This read-only string variable is the type of monitor that caused this script action to fire.

Example:
   myStr = MonitorType

SecondsInError

Number of seconds that the monitor has been in error.

Example:
   inErrSeconds = SecondsInError

State

An array of string values that contain the OK or PROBLEM state for each item being reported on. See Row Variables from the "Variables..." button for the action.

Example:
   myStr = State(1)

TimeInErrorStr

A text string of how long the monitor has been in error

Example:
   myStr = TimeInErrorStr

SendMail

This method sends an email message to the recipient that you choose. This would be useful for sending the incoming Details variable to a different email recipient based on some external factors (such as who is currently carrying the pager)

Example:
   SendMail "to_address@host.com", "from_address@host.com", "Subject of message", "Body of email message"

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 actions to sleep for very long means other actions may get delayed

Example:
   Sleep 1500

Status

A read-only string indicating the current status of the monitor. To see all possible values, See Row Variables from the "Variables..." button for the action.

Example:
   myStat = Status

StatusText

A read-only string indicating the current status of the monitor. This is a more human-friendly value than Status. To see all possible values, See Row Variables from the "Variables..." button for the action.

Example:
   myStat = Status

Time

Current time using the current time formatting

Example:
   displayStr = Time


An example script that connects to a database is shown below

Option Explicit
Dim objconnection
Dim objrecordset
Dim strDetails

Const adOpenStatic = 3
Const adLockOptimistic = 3

Set objconnection = CreateObject("ADODB.Connection")
Set objrecordset = CreateObject("ADODB.Recordset")

objconnection.Open _
"Provider=SQLOLEDB;Data Source=;" & _
"Initial Catalog=;" & _
"User ID=;Password=;"

objrecordset.Open "", objconnection, adOpenStatic, adLockOptimistic

PA File Sight

Help Map