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:
- Extract the Nagios configuration files. - From the - scripts.zipfile (downloaded in Download Companion Files), copy the files from- configuration_files/nagiosdirectory to a temporary directory.- The - nagiosdirectory contains two sub-directories,- objectsand- plugins.
- Copy the configuration files. - Copy the contents of the - objectsdirectory to- /etc/nagios/objects:- cp $tmp-directory/nagios/objects /etc/nagios/objects 
- Copy the contents of the - pluginsdirectory to the following location:- cp $tmp-directory/nagios/plugins /usr/lib64/nagios/plugins 
 
- Set the Nagios Admin password. - Choose a Nagios administrator password, for example, - admin.
- Use the following command to set the password: - htpasswd -c -b /etc/nagios/htpasswd.users nagiosadmin admin 
 
- Set the Nagios Admin email contact address. Edit the - /etc/nagios/objects/contacts.cfgfile and change the- nagios@localhostvalue to the admin email address for receiving alerts.
- Register the Hadoop configuration files: - Edit the - /etc/nagios/nagios.cfgfile 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 
- Set Hosts. - Edit the - /etc/nagios/objects/hadoop-hosts.cfgfile 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 }
- Replace the " - @HOST@" with the hostname.
 
- Set Host Groups - Open - /etc/nagios/objects/hadoop-hostsgroups.cfgwith a text editor.
- 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 - Parameter - Description - @NAME@- The host group name - @ALIAS@- The host group alias - @MEMBERS@- A comma-separated list of hosts in the group 
- The following table lists the core and monitoring host groups: - Table 12.2. Core and Monitoring Hosts - Service - Component - Name - Alias - Members - 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 
- The following table lists the ecosystem project host groups: - Table 12.3. Ecosystem Hosts - Service - Component - Name - Alias - Members - 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 
 
- Set Services. - Open - /etc/nagios/objects/hadoop-services.cfgwith a text editor.- This file contains service definitions for the following services: Ganglia, HBase (Master and Region), ZooKeeper, Hive, WebHCat, and Oozie 
- Remove any services definitions for services you have not installed. 
- 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 
 
- 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.
 
- Set Status. - Open - /etc/nagios/objects/hadoop-commands.cfgwith a text editor.
- 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 
 
 


