ManageEngine® Applications Manager Script Monitors | ||
Applications Manager provides Script Monitoring functionality to automatically monitor the output of ad-hoc Windows/Linux/Solaris scripts that are used in-house.
During creation of a new script monitor, you must give the location of the custom script (local / remote), attributes (numeric/string) to be monitored, the Output File in which the output is going to be redirected and the polling interval.
Based on the polling interval, Applications Manager executes the script.
The script will transfer its output to the Output File configured. The output of the script should be in a Key=Value format where '=' can be any delimiter.
Applications Manager parses the Output File and executes the actions configured. It enables you to alert an Administrator or automatically take corrective actions by way executing other OS scripts.
Reports for the attributes configured would be shown as graphs. Option to enable or disable reports is given.
Go to the Monitors Category View by clicking the Monitors tab. Click on Script Monitor under the Custom Monitors Table. Displayed is the Script Monitor bulk configuration view distributed into three tabs:
Availability tab, gives the Availability history for the past 24 hours or 30 days.
Performance tab gives the Health Status and events for the past 24 hours or 30 days.
List view enables you to perform bulk admin configurations.
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 using a defined value in the output file. Applications Manager looks for few reserved keywords in the output file, if it matches then it will replace the corresponding attribute.
For eg., 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.
Examples:
Sample Scalar Usecase
Let's assume 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:
Login to the Applications Manager Web Client.
Click New Monitor. From the combo box, choose Script Monitor.
For the Display Name give some name. For e.g FileSystem
Choose whether the script to be monitored is present in the Local Server or in a Remote Server. If the script is in a Remote Server, then make sure you put the script in the Remote Server.
If it is 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/).
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.
Enter the Name of the Non Numeric and Numeric attributes. In the Numeric area add
<>SystemTemperature
TimeSinceLastReboot
IOReads
Similarly in the String Attributes Textarea add : TopPaginApp
<>
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.
Specify the additional Arguments (if required to pass to the script). For e.g., hostname 80 http
Set the Polling Interval. By default, it is 5 minutes
Specify the Timeout value in seconds. The value can be the maximum time taken by the script to execute.
In Linux, Specify the mode in which script should be executed. By default, it is "sh".
If the script is in a Remote Server, select the Host Name from the list
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.(Telnet)
Enter the User Name(test) and Password(test) of the server.
Enter the Port number - Default Telnet port no: 23, SSH: 22
Specify the command prompt value, which is the last character in your command prompt. Default value is $ and possible values are >, #, etc.
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.
Sample Table Usecase
Let's assume 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 output.txt file present under the same directory. The format of output.txt 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 headers <--table prustat starts-->. This is mandatory and should follow the same format as mentioned. Here "prustat" should be replaced by the Table Name explained below
Setting up Script Monitor
Follow the same instructions as mentioned for Scalar till point 6
Select Tables in output file check box
For the Table Name provide some name(prustat). Note that this same should be present in the table header(<--table prustat starts-->) in the output file.
For the Numeric Attributes area provide the column names in the script output
that are numeric
CPU
Mem
Disk
Net
For the String Attributes provide the column names in the script output
that are non numeric
PID
COMM
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
For the Column Delimiter provide the column separator. The default value is a space.
In case you have scripts that output multiple tables then you can select More and configure the values.
Once all the values are entered select Add Monitor(s).
You can use script monitor to monitor the SNMP OIDs
Please look at the steps below for creating a script monitor,
Create a script file ( say script.sh ) under the /opt/ManageEngine/AppManager11/ directory
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
Click on "New Monitor" in applications manager and choose script
monitor. Then create a new monitor using the following parameters,
Script to Monitor </opt/ManageEngine/AppManager11/script.sh>
Directory from which the script should be executed </opt/ManageEngine/AppManager11/>
Under Output Settings,Output File </opt/ManageEngine/AppManager11/output.txt>
Numeric Attributes <CPQHLTH-MIB::cpqHeFltTolPowerSupplyRedundant.0.1>
<CPQHLTH-MIB::cpqHeFltTolPowerSupplyRedundant.0.2>
Then use the default parameters for configuring the remaining attributes.
Note: See another simple example of forcing a key value pair into a output file, discussed in our forums.
See Also
Creating New Monitor - Script Monitors
Database Query Monitor |
Windows Performance Counters |