Script Basics
Both custom script sensors use VBScript syntax.
The result of the sensor must be written into the object
sensor which is already defined.
The object sensor has several properties:
·
sensor.status: Current status of the sensor (values:
srOK, srWarning, srError)
·
sensor.result_value: Value of the sensor. If you don’t set this
value ipcheck uses the execution time of the script (Note: was
sensor.resultvalue before V5.3)
·
sensor.errorstring: Message of the sensor
·
sensor.errortype: Detailed error info (values: etNone (no
error), etException (unexpected error occurred), etProtocol (error
on protocol level), etContent (error in the content, e.g. a required word
missing). This value is only necessary If status is srError
There are three custom parameters that can be specified for
this sensor by the user in the web interface. They can be accessed in the script
by using the constants data1, data2 and data3.
For the TCPScript sensor two functions are defined: readln
and writeln. The script sensor establishes a TCP connection on the selected port
to the server. The script can then read data from the port using the readln
function and write data using writeln to send data to the server.