The following table lists several script action code examples that you can use to created useful script actions for your devices. To use these examples, select the text of the context and then copy and paste the code into the Script text box of the Active Script Action dialog.
Note: You may need to remove the copyright information from the cut and paste if it appears when you copy from this help file.
Monitor |
Code |
How to return the results of the script back to WhatsUp Gold. |
JScript Context.SetResult(0, " Everything is OK"); //Success
Context.SetResult 1, " Really big big error" |
Logging a message to the WhatsUp Gold event viewer. |
JScript Context.LogMessage("This is the message"); |
Accessing the Device ID. |
JScript var nDeviceID = Context.GetProperty("DeviceID"); |
Accessing the IP address of the device. |
JScript var sAddress = Context.GetProperty("Address"); |
Accessing the WhatsUp Gold database. |
This sample uses the device ID in context and access the 'Device' table. JScript // Get the Open DB connection from the Context NameSpace |
Using Substitution variables in your script. |
JScript Context.NotifyProgress( "Date=%System.Date" ); |
About the Active Script Action context object
Active Script Performance Monitor context code examples
Active Script Monitor context code examples