NAGIOS AND CEPH



 

Nagios Core is an open source solution for monitoring nodes. Large Red Hat Ceph Storage clusters benefitfromdistributedmonitoringsystemssuchasNagiosCore.TheNagiosCorecheckseachnodein acluster,includingthehealthoftheunderlyingoperatingsystem,aswellasthehealthoftheRedHat Ceph Storage clusterdaemons.

 

To deploy Nagios Core with Ceph requires:

 


A running Red Hat Ceph Storage cluster.

 

Instead of Nagios Core, you can also substitute the more feature rich commercial version, Nagios XI.

 

 


IMPORTANT

 

Red Hat does not provide the Nagios packages.

 

 


IMPORTANT

 

RedHatworkswithourtechnologypartnerstoprovidethisdocumentationasaserviceto ourcustomers.However,RedHatdoesnotprovidesupportforthisproduct.Ifyouneed technicalassistanceforthisproduct,thencontactNagiosforsupport.


NAGIOSCOREINSTALLATIONAND CONFIGURATION

Asastorageadministrator,youcaninstallNagiosCorebydownloadingtheNagiosCoresourcecode; then,configuring,makingandinstallingitonthenodethatwillrunNagiosCoreinstance.

 

2.1.         INSTALLINGANDCONFIGURINGTHENAGIOSCORESERVER FROMSOURCE

ThereisnotaRedHatEnterpriseLinuxpackagefortheNagiosCoresoftware,sotheNagiosCore softwaremustbecompiledfromsource.

 

Prerequisites

 

Access to OpenSSL.

 

Internet access.

 

 

Procedure

 

1.               Install theprerequisites:

 

[user@nagios]#yuminstall-yhttpdphpphp-cligccglibcglibc-commongdgd-develnet-snmp openssl openssl-devel wgetunzip

 

2.                     Openport80forhttpd:

 

[user@nagios]# firewall-cmd --zone=public --add-port=80/tcp [user@nagios]#firewall-cmd--zone=public--add-port=80/tcp--permanent

 

3.                     CreateauserandgroupforNagiosCore:

 

[user@nagios]# useradd nagios [user@nagios]# passwd nagios [user@nagios]# groupadd nagcmd [user@nagios]# usermod -a -G nagcmd nagios [user@nagios]# usermod -a -G nagcmd apache

 

4.                       DownloadthelatestversionofNagiosCoreandPlug-ins:

 

[user@nagios]# wget --inet4-only https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.3.1.tar.gz [user@nagios]# wget --inet4-only http://www.nagios-plugins.org/download/nagios-plugins- 2.2.1.tar.gz
[user@nagios]# tar zxf nagios-4.3.1.tar.gz [user@nagios]# tar zxf nagios-plugins-2.2.1.tar.gz [user@nagios]# cd nagios-4.3.1

 

5.                     Run./configure:

 

[user@nagios]# ./configure --with-command-group=nagcmd

6.                       CompiletheNagiosCoresourcecode:

 

user@nagios]# make all

 

7.                     Install Nagios sourcecode:

 

[user@nagios]# make install [user@nagios]# make install-init [user@nagios]# make install-config [user@nagios]# make install-commandmode [user@nagios]# make install-webconf

 

8.                       Copytheeventhandlersandchangetheirownership:

 

[user@nagios]# cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/ [user@nagios]# chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers

 

9.                       Runthepre-flightcheck:

 

[user@nagios]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

 

10.                        MakeandinstalltheNagiosCoreplug-ins:

 

[user@nagios]# cd ../nagios-plugins-2.2.1
[user@nagios]# ./configure --with-nagios-user=nagios --with-nagios-group=nagios [user@nagios]# make
[user@nagios]# make install

 

11.                 CreateauserfortheNagiosCoreuserinterface:

 

[user@nagios]$ sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin

 

 

IMPORTANT

 

If adding a user other than nagiosadmin, ensure the

/usr/local/nagios/etc/cgi.cfg file gets updated with the username too.

 

 

Also modify the /usr/local/nagios/etc/objects/contacts.cfg file with the user name, full name and email address asneeded.

 

12.                     Run./configure:

 

[user@nagios]# ./configure --with-command-group=nagcmd

 

13.                      CompiletheNagiosCoresourcecode:

 

[user@nagios]# make all

 

14.                      Install Nagios sourcecode:

 

[user@nagios]# make install [user@nagios]# make install-init

[user@nagios]# make install-config [user@nagios]# make install-commandmode [user@nagios]# make install-webconf

 

15.                      Copytheeventhandlersandchangetheirownership:

 

[user@nagios]# cp -R contrib/eventhandlers/ /usr/local/nagios/libexec/ [user@nagios]# chown -R nagios:nagios /usr/local/nagios/libexec/eventhandlers

 

16.                      Runthepre-flightcheck:

 

[user@nagios]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

 

 

2.2.             STARTINGTHENAGIOSCORESERVICE

Start the Nagios Core service to monitor the Red Hat Ceph Storage cluster health.

 

 

Prerequisites

 

Root-level access to the Nagios Core service.

 

 

Procedure

 

1.               AddNagiosCoreasaserviceandenableit:

 

[user@nagios]# chkconfig --add nagios [user@nagios]# chkconfig --level 35 nagios on

 

2.                     StarttheNagiosCoredaemonandApache:

 

[user@nagios]#systemctlstartnagios [user@nagios]#systemctlenablehttpd [user@nagios]#systemctlstarthttpd

 

 

2.3.             LOGGINGINTOTHENAGIOSCORESERVER

Log in to the Nagios Core server to view the health status of the Red Hat Ceph Storage cluster.

 

 

Prerequisites

 

User name and password for the Nagios web interface.

 

 

Procedure

 

1.               WithNagiosupandrunning,logintothewebuserinterface:

 

http://IP_ADDRESS/nagios

 

Nagios Core will prompt for a user name and password.

 

2.                     InputtheloginandpasswordofthedefaultNagiosCoreuser.


NAGIOSREMOTEPLUG-INEXECUTOR INSTALLATION

Asastorageadministrator,youcanmonitortheCephstorageclusternodes,installNagiosplug-ins,the Cephplug-insandtheNagiosremoteplug-inexecutor(NRPE)add-ontoeachoftheCephnodes.

 

Fordemonstrationpurposes,thissectionaddsNRPEtoaCephMonitornodewiththehostnamemon. RepeattheremainingproceduresonallCephnodesthatNagiosshouldmonitor.

 

3.1.          INSTALLING AND CONFIGURING NAGIOS REMOTE PLUG-IN EXECUTOR

InstalltheNagiosRemotePlug-inExecutor(NPRE)andconfigureittocommunicatewiththeNagios Coreserver.

 

Prerequisites

 

Access to OpenSSL.

 

User-level access to Ceph Monitor node.

 

 

Procedure

 

1.               Installthesepackagesonthenode:

 

[user@mon]# yum install openssl openssl-devel gcc make git

 

2.                     NRPEinstallationrequiresaNagiosuser.Socreatetheuserfirst:

 

[user@mon]# useradd nagios [user@mon]# passwd nagios

 

3.                     DownloadthelatestversionoftheNagiosplug-ins.Then,makeandinstallthem:

 

user@mon]# wget http://www.nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz [user@mon]# tar zxf nagios-plugins-2.2.1.tar.gz
[user@mon]# cd nagios-plugins-2.2.1 [user@mon]# ./configure [user@mon]# make
[user@mon]# make install

 

4.                       NRPEusesxinetdforcommunication.InstallitbeforeinstallingtheNRPEmodule:

 

[user@mon]# yum install xinetd

 

5.                     DownloadthelatestverionoftheCephplug-ins:

 

[user@mon]# cd ~
[user@mon]# git clone --recursive https://github.com/valerytschopp/ceph-nagios-plugins.git [user@mon]# cd ceph-nagios-plugins
[user@mon]# make dist [user@mon]# make install

6.                       Download,makeandinstallNagiosNRPE:

 

[user@mon]# cd ~
[user@mon]# wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe- 3.1.0/nrpe-3.1.0.tar.gz
[user@mon]# tar xvfz nrpe-3.1.0.tar.gz [user@mon]# cd nrpe-3.1.0 [user@mon]# ./configure [user@mon]# make all
[user@mon]# make install-groups-users [user@mon]# make install [user@mon]# make install-config [user@mon]# make install-init

 

7.                     Edit the the /etc/services file, and add the service string nrpe5666/tcp:

 

8.                       Openport5666toallowcommunicationwithNRPE:

 

[user@mon]# firewall-cmd --zone=public --add-port=5666/tcp [user@mon]# firewall-cmd --zone=public --add-port=5666/tcp --permanent

 

 

Additional Resources

 

See https://github.com/valerytschopp/ceph-nagios-plugins for details.

 

 

3.2.             STARTINGTHENAGIOSREMOTEPLUG-INEXECUTORSERVICE

StarttheNagiosRemotePlug-inExecutorservicetocollectdataandreportitbacktotheNagiosCore server.

 

Prerequisites

 


User-level access to the Ceph Monitor node

 

 

Procedure

 

1.               Enable,restart,andreloadxinetd:

 

[user@mon]#systemctlenablexinetd [user@mon]#systemctlrestartxinetd [user@mon]#systemctlreloadxinetd

 

2.                     Enable and startNRPE:

 

[user@mon]# systemctl enable nrpe [user@mon]# systemctl start nrpe

 

 

3.3.              CONFIGURINGNAGIOSCORESERVERACCESSTOREMOTE NODES


In order for the Nagios Core server to access Nagios Remote Plugin Executor (NPRE) on a remote machine,theremotemachine’sxinetdandNRPEconfigurationsmustbeupdatedwiththeIPaddressof the Nagios Coreserver.

 

Prerequisites

 


User-level access to the Nagios Core server.

 

Internet access.

 


Access to the Nagios Remote Plugin Executor.

 

 

Procedure

 

1.               EditthexinetdconfigurationwiththeNagiosserver’sIPaddress:

 

[user@mon]# vi /etc/xinetd.d/nrpe

 

 

# default:off
#description:NRPE(NagiosRemotePluginExecutor) servicenrpe
{
disable = yes socket_type =stream port= 5666
wait           =no
user           =nagios
group          =nagios
server         =/usr/local/nagios/bin/nrpe
server_args     = -c /usr/local/nagios/etc/nrpe.cfg--inetd

only_from       =127.0.0.1,IP_ADDRESS_OF_NAGIOS_CORE_SERVER

log_on_success=
}

 


2.                     AfteraddingtheIPaddressoftheNagiosCoreservertotheonly_fromoption,restartthe

xinetd service:

 

[user@mon]# systemctl restart xinetd

 

3.                     EdittheNRPEconfigurationwiththeNagiosserver’sIPaddress:

 

[user@mon]# vi /usr/local/nagios/etc/nrpe.cfg allowed_hosts=127.0.0.1,IP_ADDRESS_OF_NAGIOS_CORE_SERVER

4.                       AddtheIPaddressoftheNagiosCoreservertotheallowed_hostssetting.Then,restartnrpe:

 

[user@mon]# systemctl restart nrpe

 

5.                     Test theinstallation:

 

[user@host]# /usr/local/nagios/libexec/check_nrpe -H localhost

The check should echo NRPE v3.1.0-rc1 if it is working correctly.


CONFIGURINGTHEREMOTENODEONTHE NAGIOS CORESERVER

Configure the Nagios Core server to be aware of the remote nodes.

 

 

Prerequisites

 

User-level access to the remote node on the Nagios Core server.

 

Internet access.

 

 

Procedure

 

1.               Install the check_nrpeplug-in:

 

[user@nagios]# cd ~
[user@nagios]# wget https://github.com/NagiosEnterprises/nrpe/releases/download/nrpe- 3.1.0/nrpe-3.1.0.tar.gz
[user@nagios]# tar xvfz nrpe-3.1.0.tar.gz [user@nagios]# cd nrpe-3.1.0 [user@nagios]# ./configure [user@nagios]# make check_nrpe [user@nagios]# make install-plugin

 

2.                     Createaconfigurationfortheremotehost:

 

[user@nagios]# cd /usr/local/nagios/etc/objects [user@nagios]# cp localhost.cfg mon.cfg

 

Replacelocalhostwiththehostnameoftheremotehost,andtheloopbackIPaddresswiththe IPaddressoftheremotehost.Finally,deleteorcommentouttheHostGroupdefinition.

 

3.                     ChangethefileownershiptoNagios:

 


[user@nagios]#  chown  nagios:nagiosmon.cfg

 

4.                       Add a cfg_file=referencetothemon.cfgfilein/usr/local/nagios/etc/nagios.cfg:

 


[user@nagios]# vi /usr/local/nagios/etc/nagios.cfg

 

Example

 


cfg_file=/usr/local/nagios/etc/objects/mon.cfg

 

5.                     Restart the Nagiosserver:

 

[user@nagios]# systemctl restart nagios

 

6.                       Ensurethatthemakeandinstallproceduresworkedandthatthereisconnectivitybetweenthe NagiosCoreserverandtheremotehostcontainingNRPE:


 


[user@nagios]# /usr/local/nagios/libexec/check_nrpe -H
IP_ADDRESS_OF_REMOTE_HOST

 

It should echo NRPE v3.1.0-rc1 if it is working correctly.


CONFIGURING THE NAGIOS PLUGINS FOR CEPH

Configure the Nagios plug-ins for Red Hat Ceph Storage cluster.

Prerequisites

User-level access to the Ceph Monitor node.

A running Red Hat Ceph Storage cluster.

Access to the Nagios Core Server.

Procedure

1. Log in to the monitor server and create a Ceph key and keyring for Nagios.


[user@mon]# ssh mon [user@mon]# cd /etc/ceph

[user@mon]# ceph auth get-or-create client.nagios mon 'allow r' > client.nagios.keyring


Each plug-in will require authentication. Repeat this procedure for each node that contains a plug-in.


2. Add a command for the check_ceph_health plug-in:


[user@mon]# vi /usr/local/nagios/etc/nrpe.cfg


Example


command[check_ceph_health]=/usr/lib/nagios/plugins/check_ceph_health --id nagios -- keyring /etc/ceph/client.nagios.keyring


3. Enable and restart the nrpe service:


[user@mon]# systemctl enable nrpe [user@mon]# systemctl restart nrpe


Repeat this procedure for each Ceph plug-in applicable to the node.


4. Return to the Nagios Core server and define a check_nrpe command for the NRPE plug-in:


[user@nagios]# cd /usr/local/nagios/etc/objects [user@nagios]# vi commands.cfg


define command{ command_name check_nrpe

command_line USER1/check_nrpe -H HOSTADDRESS -c ARG1

}


5. On the Nagios Core server, edit the configuration file for the node and add a service for the Ceph plug-in.


Example

 


[user@nagios]# vi /usr/local/nagios/etc/objects/mon.cfg



define service {

use generic-service host_name mon service_description Ceph Health Check

check_command check_nrpe!check_ceph_health

}



NOTE


The check_command setting uses check_nrpe! before the Ceph plug-in name. This tells NRPE to execute the check_ceph_health command on the remote node.


6. Repeat this procedure for each plug-in applicable to the node.


7. Restart the Nagios Core server:


[user@nagios]# systemctl restart nagios


8. Before proceeding with additional configuration, ensure that the plug-ins are working.


Example


[user@mon]# /usr/lib/nagios/plugins/check_ceph_health --id nagios --keyring

/etc/ceph/client.nagios.keyring



NOTE


The check_ceph_health plug-in performs the equivalent of the ceph health

command.



Additional Resources


See the Ceph Nagios plugins web page for usage.


Post a Comment

Previous Post Next Post