Nagios XI – Managing Plugins In Nagios XI Purpose

Nagios XI – Managing Plugins In Nagios XI
The Industry Standard in IT Infrastructure Monitoring
Purpose
This document describes how to manage plugins on your Nagios XI system, including: finding and installing new plugins, defining
commands, and using them in your services. Plugins are a great way to extend the functionality of Nagios XI.
Target Audience
This document is intended for use by Nagios XI administrators who need to customize their setup beyond what the default Nagios XI
installation can provide.
Locate Your Plugin
There are thousands of community-created Nagios plugins available for download at:
The Nagios Exchange
http://exchange.nagios.org.
You can also find instructions for creating your own plugin at:
Nagios Documentation
http://www.nagios.org/documentation.
Install Your Plugin
Once you've found a useful plugin you'd like to use, it's time to
install it. Click the Admin menu option in the Nagios XI web
interface, then select Manage Plugins at the bottom of the left-hand
menu.
Click the Browse button and locate your plugin you downloaded
from the Nagios Exchange. Then click the Upload Plugin button.
Your plugin should now appear in the list of available plugins on the
Nagios XI server.
Test Your Plugin From The Command Line
It's useful to be familiar with running your plugin from the command
line, for both informational and debugging purposes. Plugins are
located in the /usr/local/nagios/libexec directory. Login to your
Nagios XI server, navigate to the plugins directory and run your
plugin with the similar commands:
cd /usr/local/nagios/libexec
./plugin_name arg1 arg2 ...
Experiment a bit and figure out the best way to run the plugin. It probably has a help option you can use to learn more.
./plugin_name -h
Here's an example of running the plugin check_icmp from the command line:
./check_icmp -H localhost
Nagios Enterprises, LLC US: 1-888-NAGIOS-1
P.O. Box 8154
Int'l: +1 651-204-9102
Saint Paul, MN 55108
Fax: +1 651-204-9103
USA
Web: www.nagios.com
Email:[email protected]
Page 1
Copyright © 2010 - 2014 Nagios Enterprises, LLC
Revision 1.0 – June, 2014
Nagios XI – Managing Plugins In Nagios XI
This command will produce results which should be similar to the following:
OK - localhost: rta 0.016ms, lost 0%|rta=0.016ms;200.000;500.000;0; pl=0%;40;80;;
Define A Command
Now that your plugin is available and you know the command
line arguments to run it, you should define a command in
Nagios XI.
In the Nagios XI web interface, browse to Configure → Core
Configuration Manager → Commands and click Add New.
Enter a Command Name, usually the same as the plugin
filename. Next in the Command Line field, enter
$USER1$/plugin_name $ARG1$. The $USER1$ macro is
replaced with the path to the plugin directory, while the
$ARG1$ macro is a placeholder for an argument you want to
specify later on a per-service basis. If you want, you can omit
$ARG1$ or add more ($ARG2$, $ARG3$, etc.)
The Command Type should be check command if your plugin
will monitor a host or service, or misc command if it handles
events. If in doubt, leave it unclassified.
Click Save and then Apply Configuration.
Note: The rest of this document only covers check commands.
Add A Service
Click Services in the left-hand menu, and click Add New.
In the Config Name field, enter the file name where the
configuration will be stored. Next enter a description of the
service in the Description field. Associate the service with a
host by clicking the Manage Host button.
In the Check command field, select the command you defined
above from the dropdown list. If you had any argument
placeholders when you defined the command earlier, enter
replacement text in the appropriate argument fields.
The Manage Templates button allows you to apply a template
to this service which will save you from having to fill in all the
other configuration options, or you can enter the required
Check and Alert settings manually.
Save and Apply Configuration again.
Verify Your Service Is Working
Your service should be working now, but it's a good idea to double check that everything went as expected. Navigate to Home →
Service Detail and look for your new service in the list. It will probably take a few minutes before it runs its first check.
Nagios Enterprises, LLC US: 1-888-NAGIOS-1
P.O. Box 8154
Int'l: +1 651-204-9102
Saint Paul, MN 55108
Fax: +1 651-204-9103
USA
Web: www.nagios.com
Email:[email protected]
Page 2
Copyright © 2010 - 2014 Nagios Enterprises, LLC
Revision 1.0 – June, 2014
Nagios XI – Managing Plugins In Nagios XI
If for any reason your plugin isn't working, you may need to make changes to your command or service. Keep troubleshooting until you
get a successful service check for your plugin. For additional questions, visit the Nagios Support Forums.
Performance Data
If you expect that your plugin provides performance graphs
you will want to verify that it is collecting performance data.
To do so, click the service description from the Service
Detail page for a more detailed view of your service. Then
click the Advanced tab after your plugin has run a check
and make sure you see some output under Performance
Data. If you don't see anything there, you will not be able to
see performance graphs with this plugin.
Finishing Up
Below is a link to a video which covers the topic of managing plugins in Nagios XI:
• https://www.youtube.com/watch?v=jG1lVnire4E
The below link has additional information about how to test check commands from the command line:
• http://support.nagios.com/wiki/index.php/Nagios_XI:FAQs#Problems_with_Check_Commands
If you still have questions about how to implement a plugin within Nagios XI, or for any other support related questions, please visit the
Nagios Support Forums at:
http://support.nagios.com/forum/
Nagios Enterprises, LLC US: 1-888-NAGIOS-1
P.O. Box 8154
Int'l: +1 651-204-9102
Saint Paul, MN 55108
Fax: +1 651-204-9103
USA
Web: www.nagios.com
Email:[email protected]
Page 3
Copyright © 2010 - 2014 Nagios Enterprises, LLC
Revision 1.0 – June, 2014