Create a Nagios Script monitor
You can use the Nagios Script Monitor to run custom Nagios scripts in SAM to monitor computers with Nagios installed. Before coding and testing your script, review these topics:
SAM supports Nagios Plugins (© 2019, Nagios Enterprises, LLC, available at https://www.nagios.org, obtained on June 25, 2019), as well as compiled Executable and Linkable Format (ELF) files for Linux-based computers.
For Nagios plugins:
- Install compiled plugins on the target system. SAM does not transfer plugins.
- When configuring the Nagios Script monitor, leave the script body field empty.
- For the Command Line field, enter a path location on the remote file system for the plugin location and any required parameters.
- Nagios plugins typically require the hostname. You may need to enter a parameter
-H
with the hostname. You can assign and use a variable to provide the hostname by using${IP}
or${Node.DNS}
in the script.
For compiled ELF files:
- Transfer the script to the target system.
- Leave the Script Working Directory blank.
- Enter any character in the Script Body. The field cannot be empty but is not used when executing the script.
- For the Command Line field, enter the full path to the script located on the target system and all Nagios parameters.
Add a Nagios Script Monitor
-
Click Settings > All Settings > SAM Settings and click Manage Templates.
The Manage Application Monitor Templates page opens. All available out-of-the-box and custom templates display.
-
Search to locate, select, and edit an existing template or click Create New Template.
- Click Add Component Monitor(s) and choose Manually Add Component Monitors.
-
Search for Nagios. When displayed, select the Nagios Script Monitor and click add.
-
Select the Authentication Type and Credentials for Monitoring.
- Enter a Working Directory for processing the script, such as
/tmp
. -
Enter a Command Line to run the script including all parameters.
Depending on the type of script or plugin, the command line may require additional information and parameters. For example, the file path or hostname.
-
Click Edit Script to enter and test the script.
Depending on the type of script or plugin, you may need to enter different script information.
For example, a plugin does not require data in this field. The plugin needs to be installed on the target server.
-
Test the script by selecting settings for the output, specified node, and specified credentials.
Output results display using the script code with success or failure and any additional notes.
-
Click Get Script Output to generate the output and click Save.
The metrics save to outputs to configure as part of the component monitor. These outputs display at polling intervals for the template.
- When complete, click Submit to save the template.
When tested, output generates into customizable sections. Each output section is named by the Unique ID with a Display Name you can edit.
For each output, you can optionally:
- Convert the value using selected formulas.
- Configure statistic thresholds to refine alerting for the component monitor. Set the warning and critical thresholds with specific values or baseline data.
- Select a roll-up status sort option to display the best or worst status up through the template and component monitor.
- Add notes to describe the script output.