Script Monitors

Introduction:

This section is common to all the editions of IT360, as per the below constraints;

Monitor Information:

IT360 provides Script Monitoring functionality, to automatically monitor the output of ad-hoc Windows/Linux/Solaris scripts that are used, in-house;

Overriding Availability and Response Time of the Script:

This option would be useful, if you want to override the response time, measured for custom scripts, by using a defined value in the output file. IT360 looks for a few reserved keywords in the output file, if it matches, then it will replace the corresponding attribute.

For e.g., if the script output is looking like this;

script_availability=1 (Allowed values are 0 or 1. "0" refers to success. "1" refers to failure.)
script_message=Server is not running.
script_responsetime=10

Then, while parsing the output file, 'script_availability' value will be taken, and based on that the availability is calculated. The same is the case for response time, too.

Top

Examples:

  1. Sample Scalar Usecase:

Let's assume that you want to monitor a script '< filesystem.sh>' present under '/home/test-solaris/' in test-solaris machine. The output from this script is dumped to 'output.txt' file, present under the same directory. The format of 'output.txt' is as shown below;

SystemTemperature=37
TimeSinceLastReboot=30
TopPaginApp=sendmail
IOReads=1050

Setting up Script Monitor:

In order to add a Script Monitor, you need to follow the below steps;

  1. Go to 'Admin -> Servers & Applications', click on New Monitor link.

  2. Choose Script monitor from the Add Monitor of type combo box.

  3. For the Display Name, give some name, e.g. FileSystem.

  4. Choose whether the script, to be monitored, is present in the Local Server or Remote Server. If the script is in a Remote Server, then make sure that you put the script in the Remote Server.

  5. If it is in the Local Server/ Remote Server, give the absolute path of the Script to Monitor ('/home/test-solaris/filesystem.sh') and also the absolute path of the directory, from which the script should be executed ('/home/test-solaris/').

  6. Under Output Settings, give the Output file name ('/home/test-solaris/output.txt'), with absolute path. This is the file, where the output from the script is dumped.

  7. Enter the Name of the Non Numeric and Numeric attributes. In the Numeric area, add;

  1. Similarly, in the String Attributes Textarea, add: TopPaginApp

  2. Enter the value of Delimiter (=), used in the output file. By default, it is "=". If you don't specify a delimiter, then 'space' would be considered as a delimiter.

  3. Specify the additional Arguments (if required to pass to the script). For e.g., hostname 80 http.

  4. Set the Polling Interval. By default, it is 5 minutes.

  5. Specify the Timeout value, in seconds. The value can be the maximum time, taken by the script to execute.

  6. In Linux, Specify the mode, in which script should be executed. By default, it is "sh".

  7. If the script is in a Remote Server, select the Host Name, from the list.

  8. If the remote server is a new host, choose New Host, then enter the server's Host Name / IP Address (test-solaris). Choose the mode of monitoring - Telnet or SSH. By default, it is 'sh'.

  9. Enter the User Name (test) and Password (test) of the server.

  10. Enter the Port number - By default, Telnet port no: 23 and of SSH: 22.

  11. Specify the command prompt value, which is the last character in your command prompt. Default value is $, and possible values are >, #, etc.

  12. Once all the values are entered, select Add Monitor(s).

The success message should be displayed. Click 'Monitor Details > Script Monitor', and go to the create script, to view the details.

  1. Sample Table Usecase:

Let's assume that you want to monitor a script '<prustat.sh>', present under '/home/test-solaris/', in test-solaris machine. The output from this script is dumped to the 'output.txt' file, present under the same directory. The format of 'output.txt' file is as shown below;

"<--table prustat starts-->"
PID CPU Mem Disk Net COMM
7176 0.88 0.70 0.00 0.00 dtrace
7141 0.00 0.43 0.00 0.00 sshd
7144 0.11 0.24 0.00 0.00 sshd
3 0.34 0.00 0.00 0.00 fsflush
7153 0.03 0.19 0.00 0.00 bash
99 0.00 0.22 0.00 0.00 nscd
7146 0.00 0.19 0.00 0.00 bash
52 0.00 0.17 0.00 0.00 vxconfigd
7175 0.07 0.09 0.00 0.00 sh
98 0.00 0.16 0.00 0.00 kcfd
"<--table prustat ends-->"

Note: The table header, "<--table prustat starts-->", is mandatory, and should follow the same format, as mentioned. Here 'prustat' should be replaced by the Table Name, as explained below;

Setting up Script Monitor:

  1. To start with, follow the same instructions, as mentioned above, for Scalar, till point 6.

  2. Now, select Tables, in Output file check box.

  3. For the Table Name, provide some name (e.g. prustat). Note: This name should be present in the table header ("<--table prustat starts-->") in the output file.

  4. For the Numeric Attributes area, provide the column names in the script output that are numeric;

    • CPU
    • Mem
    • Disk
    • Net
  1. For the String Attributes, provide the column names in the script output that are non-numeric;

    • PID
    • COMM
  1. For the Unique Column, provide the column names that can identify a row data. This can be a single value or multiple value;

    • PID
    • COMM
  1. For the Column Delimiter, provide the column separator. The default value is a space.

  2. In case, if you have scripts that output multiple tables, then you can select More, and configure the values.

  3. Once all the values are entered, select Add Monitor(s).

Top

Using Script Monitor to Monitor SNMP OIDs:

Please look at the steps below, for creating a script monitor;

  1. Create a script file (say 'script.sh'), under the '/Home/User' directory.

  2. Edit that file and type in, the following content, into that file;
snmpwalk -v 1 -c public app-w2k1 CPQHLTH-MIB::cpqHeFltTolPowerSupplyRedundant.0.1| awk '{ y = $1; x = $4 ; gsub(/[a-zA-Z()]/, "", x)}
{print y " = " x}'>> output.txt
snmpwalk -v 1 -c public app-w2k1 CPQHLTH-MIB::cpqHeFltTolPowerSupplyRedundant.0.2 | awk '{ y = $1; x = $4 ; gsub(/[a-zA-Z()]/, "", x)}
{print y " = " x}' >> output.txt
  1. Go to 'Admin -> Servers & Applications', click on New Monitor link, select Script monitor, choose Script Location as Remote Server, and choose the appropriate Linux server from the Choose the Host dropdown. Now, create a new Monitor, using the following parameters;

Script to Monitor   '/Home/User/script.sh'

Directory from which the script should be executed  '/Home/User'
Under Output Settings,Output File    '/Home/User/output.txt'

Numeric Attributes   <CPQHLTH-MIB::cpqHeFltTolPowerSupplyRedundant.0.1>
                  <CPQHLTH-MIB::cpqHeFltTolPowerSupplyRedundant.0.2>

  1. Then use the default parameters for configuring the remaining attributes.

Top

See Also:

Creating New Monitor - Script Monitors



Copyright © 2012, ZOHO Corp. All Rights Reserved.