Polling sensors settings in Nagios

Methods of survey items

Master module SNMP poll to Nagios can be produced in two main ways:

1) Individual polling of each sensor: each sensor is a Nagios service, and service status is determined as the  state of the concrete sensor;

2) Tabular polling of sensors: all sensors of some master-module are polled with Nagios, and service status is determined by the aggregation state of all respondent's sensors;

Setup individual polling of each sensor in Nagios

To configure Nagios polling of some sensors is necessary to make the following changes in the configuration files:

  1. Add nagios/ objects settings subdirectory file “schosts.cfg”:

    schosts.cfg

    ############################################################################### # SCHOSTS.CFG - SAMPLE OBJECT CONFIG FILE FOR MONITORING SC DEVICES # # # NOTE: This config file is intended to serve as an *extremely* simple # example of how you can create configuration entries to monitor # the SC device. # ############################################################################### ############################################################################### ############################################################################### # # HOST DEFINITION # ############################################################################### ############################################################################### # SC devices hosts template define host{ name sc-host use generic-host max_check_attempts 10 contact_groups admins action_url /pnp4nagios/graph?host=$HOSTNAME$ ; for pnp4 graphic tool loading notes_url http://$HOSTADDRESS$ ; for SC device web-ui loading } # SC devices hosts list define host{ use sc-host host_name test193 alias Local EMS address 192.168.0.193 } define host{ use sc-host host_name test194 alias Local EMS address 192.168.0.194 } ############################################################################### ############################################################################### # # HOST GROUP DEFINITION # ############################################################################### ############################################################################### # Define an optional hostgroup for Linux machines define hostgroup{ hostgroup_name sc-hosts ; The name of the hostgroup alias SC hosts group ; Long name of the group members test193, test194 ; Comma separated list of hosts that belong to this group } ############################################################################### ############################################################################### # # SERVICE DEFINITIONS # ############################################################################### ############################################################################### # Define a service to "ping" the local machine define service{ use generic-service ; Name of service template to use hostgroup_name sc-hosts service_description PING; check_command check_ping!200.0,20%!600.0,60% ; The command used to monitor the service normal_check_interval 5 ; Check the service every 5 minutes under normal conditions retry_check_interval 1 ; Re-check the service every minute until its final/hard state is determined process_perf_data 1 } # SNMP Table of Elements for Sky Control devices define service{ use generic-service hostgroup_name sc-hosts contact_groups admins service_description Sky Control Element Service check_command check_snmp_vutlan! -C read -i 203001 normal_check_interval 1 retry_check_interval 1 process_perf_data 1 } ## # Scalar parse example ## # UpTime define service{ use generic-service hostgroup_name sc-hosts service_description UPTIME check_command check_snmp! -H $HOSTADDRESS$ -C read -o .1.3.6.1.2.1.1.3.0 -l "Uptime is" } # Internal Temperature define service{ use generic-service hostgroup_name sc-hosts service_description Internal Temperature check_command check_snmp! -H $HOSTADDRESS$ -C read -o .1.3.6.1.4.1.39052.1.3.1.9.201001 -l "Internal Temperature" }

    Originally created host template for the master module (lines 19-27).
    Create two hosts on the basis of this template (lines 19-27).
    Hosts included in the host group (lines 52-57).
    For a group of hosts specified services (lines 68-108).

    • PING - hosts ping services (lines 68-78);

    • Element Service - an exploded poll (lines 80-90);

    • UPTIME - scalar SNMP sample survey, host uptime (lines 96-101);

    • Internal Temperature - SNMP table element sample survey (lines 103-108), the current value of the built-in master module temperature sensor, can be used to calculate directly a Nagios service status

  2. Connect “schosts.cfg” file to the main configuration “nagios.cfg

    nagios.cfg

     cfg_file=/etc/nagios/objects/schosts.cfg



  3. install the Vutlan plugin for Element Service.
    1) Download the plugin: check_vutlan.pl;
    2) Put the plugin in the Nagios plugin directory;
    3) Register the plugin in objects/command.cfg.

    objects/command.cfg

     define command { command_name check_snmp_vutlan command_line $USER1$/check_vutlan.pl -H $HOSTADDRESS$ $ARG1$ }

    4) make sure that the plugin uses the correct path to the Nagios plugins directory:

    snmp-graph.properties



Setup tabular polling of sensors in Nagios

It is necessary to make the following changes in the configuration files to configure the polling table of elements in Nagios:

  1. Modify “hosts.cfg” file (see above is a complete example of creating the file above)

    schosts.cfg

    Created check_snmp_sky_control table check service for a group of hosts sc-hosts

  2. Test, that “schosts.cfg” file is connected to “nagios.cfg” main configuration

    nagios.cfg



  3. Install the plugin for the Table of Elements Service.
    1) Download the plugin: check_vutlan_table.pl;
    2) Put a plugin in the Nagios plugins directory;
    3) Register the plugin in objects/command.cfg.

    objects/command.cfg

    4) make sure that the plugin uses the correct path to the Nagios plugins directory:

    snmp-graph.properties

    This plugin generates CRITICAL, if at least one element is in a state of alarm, and WARNING, if at least one element is in the state of WARNING
    This plugin generates performance data only for sensors that have the value field makes sense (ie for sensors with analog or digital outputs)

     

Details about working with Nagios in the official documentation: http://library.nagios.com/library/products/nagioscore/manuals/