Scripting Performance Monitors
- Last Updated: December 11, 2024
- 2 minute read
- WhatsUp Gold
- Version 2024
Active Script Performance Monitors let you write VBScript and JScript to easily poll one or more SNMP or WMI values, perform math or other operations on those values, and graph a single output value. You should only use the Active Script Performance Monitor when you need to perform calculations on the polled values. Keep in mind that although you can poll multiple values using the feature, only one value will be stored to the database: the outcome of your scripted calculation.
Reference Variables
Reference variables simplify your scripting code and enable you to write scripts efficiently, without having to grab a list of device properties, as with the Script Action and Script Active Monitor. They take care of the underlying SNMP or WMI mechanisms that you would normally have to use to access SNMP or WMI counters on a remote device.
By using the Context.GetReferenceVariable (variable name),
you only need to specify the name of a pre-defined variable. WhatsUp Gold uses a device's
credentials to connect to the target device using SNMP or WMI to retrieve the requested
information. This information is stored in a variable that you can use later in your
script.
Important: The use of reference variables in the Active Script
Performance Monitor is optional. If you do use them, you must use
Context.GetReferenceVariable, for reference variables to be polled and their data
graphed.
Keep In Mind
- You need to include error handling in your monitor script. Your script either needs a value
to graph by using
Context.SetValue, or you must useContext.SetResultto tell WhatsUp Gold that the script failed. -
Context.GetReferenceVariablewill return 'null' if the poll fails for any reason. - If you do not have a call to
SetValueorSetResult, the script does not report any errors and no data is graphed. - If
SetValueis used, it is not necessary to useSetResult, asSetValueimplicitly setsSetResultto 0, or "good." - Results from this performance monitor are displayed on Custom Performance Monitors full and dashboard reports.
- Errors from this performance monitor are displayed in the Performance Monitor Error log as well as EventViewer.exe.