The diverse ca­pa­bil­i­ties of the high-per­for­mance IT mon­i­tor­ing ap­pli­ca­tion Nagios are presented in our in­tro­duc­to­ry Digital Guide article. In this text, you can find in­for­ma­tion on the ap­pli­ca­tion’s official plugins, the absence of which would make it im­pos­si­ble to monitor networks with Nagios. But what sig­nif­i­cance does this special plugin packet have? And what does one stand to gain from the various other ex­ten­sions offered by third parties? Finally, how does one go about in­stalling them?

What are Nagios plugins?

In contrast to many other mon­i­tor­ing programs, Nagios doesn’t possess any mech­a­nisms of its own in order to check the statuses of systems and network services. This task is left up to external ap­pli­ca­tions, i.e. Nagios plugins. Regarding the ex­ten­sions, which are also referred to as modules, these are usually either already-compiled files, which are written in C or C++, or ex­e­cutable scripts (Perl, PHP, etc.). These contain command line arguments that are designed to initiate the re­spec­tive checks and forward the results to the mon­i­tor­ing software. When the status of the cor­re­spond­ing service or host is to be checked, then the execution itself is carried out by Nagios.

These plugins act as ab­strac­tion layers between the mon­i­tor­ing logic, which is presented in the Nagios interface in visual form, and the actual services and hosts that are being monitored. The advantage of this ar­chi­tec­ture is that Nagios is capable of mon­i­tor­ing anything for which an automatic review process can be pro­grammed. However, the mon­i­tor­ing tool isn’t able to un­der­stand which of the network com­po­nents’ prop­er­ties it’s in­spect­ing and also has no way of knowing which in­di­vid­ual checks have been executed, which is another reason why Nagios doesn’t work without plugins.

What type of Nagio plugins are there?

The free rein one is given when pro­gram­ming Nagios plugins has led to the de­vel­op­ment of ex­ten­sions for different devices, programs, system processes, protocols, and other services. As a result, there are plugins for:

  • HTTP, POP3, IMAP, FTP, SSH, DHCP
  • uti­liza­tion of CPU, hard disk drive and main memory, active users
  • Operating systems like Windows, Linux/Unix dis­tri­b­u­tions
  • Routers, switches
  • Log files

The main point to take away here is that it’s important to dif­fer­en­ti­ate between the official Nagios plugins and the thousands of ex­ten­sions that have been developed by members of the Nagios community. The official packet contains around 50 standard plugins that cover a variety of the most important network checks as well as different libraries (these are important for many third-party modules). This com­pi­la­tion is main­tained by the producers, so all ex­ten­sions are always kept up to date. Community plugins, on the other hand, are not always con­tin­u­ous­ly developed, meaning that they may not be com­pat­i­ble with the inspected network com­po­nents or the current Nagios core version. Before you start looking in the Nagios Exchange directory for specific plugins, you should first download the official plugin packet on the provider’s site. For those who possess the knowledge to do so, there’s always the pos­si­bil­i­ty to program your own Nagios plugins. Nagios has provided helpful guide­lines on what de­vel­op­ers need to look out for when creating their own ex­ten­sions. 

Nagios plugins tutorial: down­load­ing and in­stalling plugins

Once you’ve settled for a certain plugin and have completed the download, you’ve got to install it and set it up. In the text that follows, we’ll show you the most important steps of the in­stal­la­tion and con­fig­u­ra­tion process as would be seen when using Ubuntu.

1. Go to your download directory and unpack the down­loaded file. For the official plugin packet, the cor­re­spond­ing command line looks as follows:

cd ~/download
tar xzf nagios-plugins-2.1.2.tar.gz

2. Then navigate to the unpacked folder:

cd nagios-plugins-2.1.2

3. At this point, compile and install the plugins. This step of the process is initiated with the following in­struc­tions: 

./configure --with-nagios-user=nagios --with-nagios-group=Nagios
make
make install

4. Now open the Nagios XI web interface and switch into the ad­min­is­tra­tive area. In the left menu bar, you’ll find the item ‘Manage Plugins’ located under the System Extension’ tab. This allows you to connect the recently installed ex­ten­sions with the Nagios software. Click on the button ‘browse’ and then select the desired Nagios plugin. Once you’ve im­ple­ment­ed it via ‘Upload Plugin’, you will then be able to see it in the list of available modules.

5. It can be very useful to test whether or not the im­ple­ment­ed plugins function as desired by executing the checks. For this, you don’t even need to start the mon­i­tor­ing software given that the ex­ten­sions can be executed via the command line. Just go to the plugin directory, usually /usr/local/nagios/libexec, and test the listed modules with their cor­re­spond­ing commands. In order to find out more about the cor­re­spond­ing plugin and its possible pa­ra­me­ters, it’s rec­om­mend­ed to also call up the help menu (-h).

cd /usr/local/nagios/libexec
./name_des_plugins -h

6. After uploading the plugins, you can define in­struc­tions for the Nagios software with the help of command line arguments. To this end, navigate to the menu item ‘configure’ and choose the options ‘Core Config Manager’ and ‘Commands’. Then click on ‘Add New’. An input mask for a new Nagios in­struc­tion will then open, which should then be specified as follows:

  • Command name: here, you can define a name for the in­struc­tion. This should be as in­for­ma­tive as possible. For example, it should contain the name of the re­spec­tive Nagios plugin.

  • Command line: Here, enter the plugin and its re­spec­tive command line entry. The macro, $USER1$, acts as a place­hold­er for the plugin directory while $ARG1$ is a potential command line argument.

  • Command type: Select ‘check command’ in case the plugin is to check a host or another service. Check ‘misc command’ in case you also wish to have an event monitored. If you’re unsure as to how to label the selected type, then chose the option ‘un­clas­si­fied’.

  • Active: Once the checkmark has been selected, then Nagios in­struc­tion has been activated. 

  • Available Plugins: In the drop-down menu you can obtain an overview of the available plugins.

Save your Nagios command with ‘save’ and confirm it in the overview menu through a click on the button, ‘Apply Con­fig­u­ra­tion’. The extension should now be available together with the cor­re­spond­ing Nagios in­struc­tion and can be used for relevant mon­i­tor­ing tasks by creating hosts, services, or events and assigning them to the plugin or command. 

Go to Main Menu