Using NetPing Monitoring Units Together with Nagios

  • Published In: Tutorial
  • Created Date: 2018-10-09
  • Hits: 110

In this article, the example of the simplest configuration of a Nagios IT infrastructure monitoring is shown that is necessary for working with NetPing devices for server room monitoring, on the example of UniPing v3. The largest advantage of this monitoring system is its flexibility (simplicity of writing user plugins for monitoring of virtually anything that can belong to a system engineer's job), and its disadvantage is a relative complexity of its configuration (configuration is performed through editing a configurational file).

To configure temperature monitoring in a server room using Nagios and UniPing v3, you will need:

  • a monitoring server running under Ubuntu 9.04 Server, with an IP address 192.168.2.230;
  • a device for environment monitoring of server rooms UniPing v3, with an IP address 192.168.2.10, and SNMP-Community «SWITCH», access to which is allowed at least from a monitoring server.

Configuring Nagios

The first step is to install Nagios:

apt-get install nagios3 exim4-daemon-light

Exim will be necessary for e-mailing notifications. After installing it, there is a need to create a file /etc/nagios3/htpasswd.users and add there a user root:

htpasswd -c /etc/nagios3/htpasswd.users root

Configuring Nagios for Working with a UniPing v3 Monitoring Unit

Now we can open a page «http://192.168.2.230/nagios3/» in a browser and get authorized in the system by using a login «root» and password that have been introduced at a previous stage. At the same time, a web interface of a system is designed for only viewing a status of devices. All settings are saved in configurational files. Therefore, let's turn back to a server console and describe a new host for monitoring. To do this, create a file «/etc/nagios3/conf.d/host-netping.cfg» with the next contents: 

      define host {
       # Host name for using it inside a system 
        host_name   netping
        # Host name for showing it to a user
        alias       UniPing v3
        # IP address or a DNS host name for monitoring
        address     192.168.2.10
        # Main used template
        use         generic-host
        }

Now, we need to determine to which group this host belongs to. Let's create a specific group for such hosts: «netping-devices». To do this, open a file «/etc/nagios3/conf.d/hostgroups_nagios2.cfg» in the editor and add the next lines at the end of the file:

define hostgroup {
        # Group name for using it inside a system
        hostgroup_name  netping-devices
        # Group name for showing it to a user
        alias           UniPing Devices
        # Hosts are members of this group. They are separated by a comma in the list
        members         netping
        }

Then, let's describe commands for monitoring a device. To do this, let's create a file «/etc/nagios-plugins/config/netping.cfg» with the next contents: 

define command{
  command_name term_on_sensor1
  command_line /usr/lib/nagios/plugins/check_snmp -H '$HOSTADDRESS$' -C '$ARG1$' -o .1.3.6.1.4.1.25728.8800.1.1.2.1 -l 'Term on sensor1' -u 'degree' -w '$ARG2$' -c '$ARG3$'
  }
          
define command{
  command_name term_on_sensor2
  command_line /usr/lib/nagios/plugins/check_snmp -H '$HOSTADDRESS$' -C '$ARG1$' -o .1.3.6.1.4.1.25728.8800.1.1.2.2 -l 'Term on sensor2' -u 'degree' -w '$ARG2$' -c '$ARG3$'
  }

Here, commands for only two sensors are shown, but the number of commands can be bigger. You can find corresponding OIDs in the documentation for a device. Now, the only thing that is left is to connect these commands with our new host. To do this, open a file «/etc/nagios3/conf.d/services_nagios2.cfg» in the editor and add to the end:

define service {
        # Host name
        host_name                       netping
        # Service name
        service_description             TERM1
        # Checking command
        # Parameters that are transmitted to it are separated by an exclamation mark
        # In our case, parameters mean (see a command description in netping.cfg):
        # 1. SNMP Community
        # 2. Value when exceeded, the situation is considered warning (Warning)
        # 3. Value, when exceeded, the situaiton is considered critical (Critical)
        check_command                   term_on_sensor1!SWITCH!28!29
        # Used template
        use                             generic-service
        # Interval between checking and sending messages
        notification_interval           60
        # Time, when a host must be available
        notification_period             24x7
        # List of event levels, for which notifications will be sent
        notification_options            w,u,c,r
}
   
define service {
        host_name                       netping
        service_description             TERM2
        check_command                   term_on_sensor2!SWITCH!24!27
        use                             generic-service
        notification_interval           60
        notification_period             24x7
        notification_options            w,u,c,r
}

Then. open a file «/etc/nagios3/conf.d/contacts_nagios2.cfg» in the editor, find a section with a description of a user root and specify a correct E-mail for sending notifications. To check a correctness of writing configurational files, there is a need to run a command:

nagios3 -v /etc/nagios3/nagios.cfg

While a command operates, the information about conducted tests will be displayed, and a summary information will be represented in the end. It must be as shown below:

Total Warnings: 0
Total Errors:   0
Things look okay - No serious problems were detected during the pre-flight check

If something is wrong in your summary information, there are errors in configuration files. When all errors are found, checking shows their absence and there is a need to restart the Nagios service:

invoke-rc.d nagios3 restart

Afterward, Nagios starts tracking temperature at specified sensors. It is possible to check it through a web interface by opening a page «Host Detail» -> «netping» -> «View Status Detail For This Host». Nearly the picture below must be opened:

Using NetPing devices together with Nagios

On the screenshot above, it is evident that everything is perfect at the second sensor, but there is a critical overheat at the first one. Except displaying in a web interface, an administrator will get the next E-mails of the next content:

 ***** Nagios *****
          
Notification Type: PROBLEM
          
Service: TERM1
Host: NetPing TS v2
Address: 192.168.2.10
State: CRITICAL
          
Date/Time: Sat Aug 15 04:05:24 MSD 2009
          
Additional Info:
          
Term on sensor1 CRITICAL - 31 degree

Also, for processing critical situations, it is possible to use self-written scripts that ill switch on and off the equipment, send notifications through SMS or Jabber, and perform other actions. More detailed information about this can be found at Nagios official documentation.

Result

Nagios monitoring system is a full-fledged monitoring tool in hands of network engineers. A possibility to enlarge functionality individually opens nearly endless possibilities in the system functionality. If there is no chance to monitor certain indicators of systems or networks, then the most probably, there is an already written plugin or there is a need to write it yourself, at any programming language that is familiar.
 

Author: Vadim Kalinnikov 
E-mail: moose@ylsoftware.com 
Web: http://ylsoftware.com, smei.i.inaja@gmail.com
Editor: Frolova Maria


Tags: All devices
comments powered by Disqus