2. Install the Configuration Files

There are several configuration files that need to be set up for Nagios. Use the following instructions to install and setup the configuration files for Nagios:

  1. Extract the Nagios configuration files.

    From the scripts.zip file (downloaded in  Download Companion Files), copy the files from configuration_files/nagios directory to a temporary directory.

    The nagios directory contains two sub-directories, objects and plugins.

  2. Copy the configuration files.

    1. Copy the contents of the objects directory to /etc/nagios/objects :

      cp $tmp-directory/nagios/objects/* /etc/nagios/objects/*
    2. Copy the contents of the plugins directory to the following location:

      cp $tmp-directory/nagios/plugins/* /usr/lib64/nagios/plugins/
      

  3. Set the Nagios Admin password.

    1. Choose a Nagios administrator password, for example, admin.

    2. Use the following command to set the password:

      htpasswd -c -b  /etc/nagios/htpasswd.users nagiosadmin admin
      
  4. Set the Nagios Admin email contact address. Edit the /etc/nagios/objects/contacts.cfg file and change the nagios@localhost value to the admin email address for receiving alerts.

  5. Register the Hadoop configuration files:

    Edit the /etc/nagios/nagios.cfg file to add the following values in the OBJECT CONFIGURATION FILE(S) section:

    # Definitions for hadoop servers
    cfg_file=/etc/nagios/objects/hadoop-commands.cfg
    cfg_file=/etc/nagios/objects/hadoop-hosts.cfg
    cfg_file=/etc/nagios/objects/hadoop-hostgroups.cfg
    cfg_file=/etc/nagios/objects/hadoop-services.cfg
    cfg_file=/etc/nagios/objects/hadoop-servicegroups.cfg
  6. Set Hosts.

    1. Edit the /etc/nagios/objects/hadoop-hosts.cfg file and add a "define host { … }" entry for each host in your cluster using the following format:

      define host {
             alias @HOST@
             host_name @HOST@
             use linux-server
             address @HOST@
             check_interval 0.25
             retry_interval 0.25
             max_check_attempts 4
             notifications_enabled 1
             first_notification_delay 0 # Send notification soon after
                                         change in the hard state
             notification_interval 0    # Send the notification once
             notification_options       d,u,r
        }
    2. Replace the "@HOST@" with the hostname.

  7. Set Host Groups

    1. Open /etc/nagios/objects/hadoop-hostsgroups.cfg with a text editor.

    2. Create host groups based on all the hosts and services you have installed in your cluster. Each host group entry should follow this format:

      define hostgroup {
             hostgroup_name  @NAME@
             alias           @ALIAS@
             members         @MEMBERS@
         }

      Where

       

      Table 12.1. Host Group Parameters

      ParameterDescription

      @NAME@   

      The host group name

      @ALIAS@

      The host group alias

      @MEMBERS@

      A comma-separated list of hosts in the group


    3. The following table lists the core and monitoring host groups:

       

      Table 12.2. Core and Monitoring Hosts

      ServiceComponentNameAliasMembers

      All servers in the cluster

       

      all-servers

      All Servers

      List all servers in the cluster

      HDFS

      NameNode

      namenode

      namenode

      The NameNode host

      HDFS

      SecondaryNameNode

      snamenode

      snamenode

      The Secondary NameNode host

      MapReduce

      JobTracker

      jobtracker

      jobtracker

      The Job Tracker host

      HDFS, MapReduce

      Slaves

      slaves

      slaves

      List all hosts running DataNode and TaskTrackers

      Nagios

       

      nagios-server

      nagios-server

      The Nagios server host

      Ganglia

       

      ganglia-server

      ganglia-server

      The Ganglia server host


    4. The following table lists the ecosystem project host groups:

       

      Table 12.3. Ecosystem Hosts

      ServiceComponentNameAliasMembers

      HBase

      Master

      hbasemaster

      hbasemaster

      List the master server

      HBase

      Region

      regions-servers

      region-servers

      List all region servers

      ZooKeeper

       

      zookeeper-servers

      zookeeper-servers

      List all ZooKeeper servers

      Oozie

       

      oozie-server

      oozie-server

      The Oozie server

      Hive

       

      hiveserver

      hiverserver

      The Hive metastore server

      WebHCat

       

      twebhcat-server

      webhcat-server

      The WebHCat server


  8. Set Services.

    1. Open /etc/nagios/objects/hadoop-services.cfg with a text editor.

      This file contains service definitions for the following services: Ganglia, HBase (Master and Region), ZooKeeper, Hive, WebHCat, and Oozie

    2. Remove any services definitions for services you have not installed.

    3. Replace the @NAGIOS_BIN@ and @STATUS_DAT@ parameters as shown below:

      • For RHEL and CentOS

        @STATUS_DAT@ = /var/nagios/status.dat
        @NAGIOS_BIN@ = /usr/bin/nagios
      • For SLES

        @STATUS_DAT@ = /var/lib/nagios/status.dat
        @NAGIOS_BIN@ = /usr/sbin/nagios
    4. If you have installed Hive or Oozie services, replace the parameter @JAVA_HOME@  with the path to the Java home. For example, /usr/java/default.

  9. Set Status.

    1. Open /etc/nagios/objects/hadoop-commands.cfg with a text editor.

    2. Replace the @STATUS_DAT@ parameter with the location of the Nagios status file as shown below:

      • For RHEL and CentOS

        /var/nagios/status.dat
      • For SLES

         /var/lib/nagios/status.dat


loading table of contents...