Create a Nagios Script monitor

The Nagios script monitor allows you 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 binary files (ELF) 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 binary 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 monitor

  1. 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.

  2. Search to locate, select, and edit an existing template or click Create New Template.

  3. Click Add Component Monitor(s) and choose Manually Add Component Monitors.
  4. Search for Nagios. When displayed, select the Nagios Script Monitor and click add.

  5. Select the Authentication Type and matching credentials from the Credentials for Monitoring drop-down menu.

  6. Enter a Working Directory, used for processing the script. A typical directory customers use is /tmp.
  7. 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.

  8. 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.

  9. Test the script by selecting settings for the output, specified node, and specified credentials. Click Get Script Output.

    Output results display using the script code with success or failure and any additional notes.

  10. 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.

  11. 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.