Nagios plugins: the basic modules of the popular IT monitoring software
The diverse capabilities of the high-performance IT monitoring application Nagios are presented in our introductory Digital Guide article. In this text, you can find information on the application’s official plugins, the absence of which would make it impossible to monitor networks with Nagios. But what significance does this special plugin packet have? And what does one stand to gain from the various other extensions offered by third parties? Finally, how does one go about installing them?
What are Nagios plugins?
In contrast to many other monitoring programs, Nagios doesn’t possess any mechanisms of its own in order to check the statuses of systems and network services. This task is left up to external applications, i.e. Nagios plugins. Regarding the extensions, which are also referred to as modules, these are usually either already-compiled files, which are written in C or C++, or executable scripts (Perl, PHP, etc.). These contain command line arguments that are designed to initiate the respective checks and forward the results to the monitoring software. When the status of the corresponding service or host is to be checked, then the execution itself is carried out by Nagios.
These plugins act as abstraction layers between the monitoring 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 architecture is that Nagios is capable of monitoring anything for which an automatic review process can be programmed. However, the monitoring tool isn’t able to understand which of the network components’ properties it’s inspecting and also has no way of knowing which individual 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 programming Nagios plugins has led to the development of extensions for different devices, programs, system processes, protocols, and other services. As a result, there are plugins for:
- HTTP, POP3, IMAP, FTP, SSH, DHCP
- utilization of CPU, hard disk drive and main memory, active users
- Operating systems like Windows, Linux/Unix distributions
- Routers, switches
- Log files
The main point to take away here is that it’s important to differentiate between the official Nagios plugins and the thousands of extensions 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 compilation is maintained by the producers, so all extensions are always kept up to date. Community plugins, on the other hand, are not always continuously developed, meaning that they may not be compatible with the inspected network components 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 possibility to program your own Nagios plugins. Nagios has provided helpful guidelines on what developers need to look out for when creating their own extensions.
Nagios plugins tutorial: downloading and installing 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 installation and configuration process as would be seen when using Ubuntu.
1. Go to your download directory and unpack the downloaded file. For the official plugin packet, the corresponding command line looks as follows:
cd ~/download tar xzf nagios-plugins-2.1.2.tar.gz
2. Then navigate to the unpacked folder:
3. At this point, compile and install the plugins. This step of the process is initiated with the following instructions:
./configure --with-nagios-user=nagios --with-nagios-group=Nagios make make install
4. Now open the Nagios XI web interface and switch into the administrative 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 extensions with the Nagios software. Click on the button ‘browse’ and then select the desired Nagios plugin. Once you’ve implemented 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 implemented plugins function as desired by executing the checks. For this, you don’t even need to start the monitoring software given that the extensions 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 corresponding commands. In order to find out more about the corresponding plugin and its possible parameters, it’s recommended 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 instructions 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 instruction will then open, which should then be specified as follows:
- Command name: here, you can define a name for the instruction. This should be as informative as possible. For example, it should contain the name of the respective Nagios plugin.
- Command line: Here, enter the plugin and its respective command line entry. The macro, $USER1$, acts as a placeholder 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 ‘unclassified’.
- Active: Once the checkmark has been selected, then Nagios instruction 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 Configuration’. The extension should now be available together with the corresponding Nagios instruction and can be used for relevant monitoring tasks by creating hosts, services, or events and assigning them to the plugin or command.