Chapter 5. Configuring the Nagios Plugins for Ceph
Configure the Nagios plug-ins for Red Hat Ceph Storage cluster.
Prerequisites
- Root-level access to the Ceph Monitor host and Nagios Core Server.
- A running Red Hat Ceph Storage cluster.
Procedure
Log in to the Ceph monitor host and create a Ceph key and keyring for Nagios.
Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ssh user@host01 sudo su - cd /etc/ceph ceph auth get-or-create client.nagios mon 'allow r' > client.nagios.keyring
[root@nagios ~]# ssh user@host01 [user@host01 ~]$ sudo su - [root@host01 ~]# cd /etc/ceph [root@host01 ceph]# ceph auth get-or-create client.nagios mon 'allow r' > client.nagios.keyring
Each plug-in will require authentication. Repeat this procedure for each host that contains a plug-in.
Add a command for the
check_ceph_health
plug-in:Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow vi /usr/local/nagios/etc/nrpe.cfg
[root@host01 ~]# vi /usr/local/nagios/etc/nrpe.cfg
Copy to Clipboard Copied! Toggle word wrap Toggle overflow command[check_ceph_health]=/usr/lib/nagios/plugins/check_ceph_health --id nagios --keyring /etc/ceph/client.nagios.keyring
command[check_ceph_health]=/usr/lib/nagios/plugins/check_ceph_health --id nagios --keyring /etc/ceph/client.nagios.keyring
Enable and restart the
nrpe
service:Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow systemctl enable nrpe systemctl restart nrpe
[root@host01 ~]# systemctl enable nrpe [root@host01 ~]# systemctl restart nrpe
Repeat this procedure for each Ceph plug-in applicable to the host.
Return to the Nagios Core server and define a
check_nrpe
command for the NRPE plug-in:Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow cd /usr/local/nagios/etc/objects vi commands.cfg
[root@nagios ~]# cd /usr/local/nagios/etc/objects [root@nagios objects]# vi commands.cfg
Syntax
Copy to Clipboard Copied! Toggle word wrap Toggle overflow define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ }
define command{ command_name check_nrpe command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$ }
On the Nagios Core server, edit the configuration file for the node and add a service for the Ceph plug-in.
Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow vi /usr/local/nagios/etc/objects/host01.cfg
[root@nagios objects]# vi /usr/local/nagios/etc/objects/host01.cfg
Syntax
Copy to Clipboard Copied! Toggle word wrap Toggle overflow define service { use generic-service host_name HOSTNAME service_description Ceph Health Check check_command check_nrpe!check_ceph_health }
define service { use generic-service host_name HOSTNAME service_description Ceph Health Check check_command check_nrpe!check_ceph_health }
Replace HOSTNAME with the hostname of the Ceph host you want to monitor.
Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow define service { use generic-service host_name host01 service_description Ceph Health Check check_command check_nrpe!check_ceph_health }
define service { use generic-service host_name host01 service_description Ceph Health Check check_command check_nrpe!check_ceph_health }
NoteThe
check_command
setting usescheck_nrpe!
before the Ceph plug-in name. This tells NRPE to execute thecheck_ceph_health
command on the remote node.- Repeat this procedure for each plug-in applicable to the host.
Restart the Nagios Core server:
Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow systemctl restart nagios
[root@nagios ~]# systemctl restart nagios
Before proceeding with additional configuration, ensure that the plug-ins are working on the Ceph host:
Syntax
Copy to Clipboard Copied! Toggle word wrap Toggle overflow /usr/lib/nagios/plugins/check_ceph_health --id NAGIOS_USER --keyring /etc/ceph/client.nagios.keyring
/usr/lib/nagios/plugins/check_ceph_health --id NAGIOS_USER --keyring /etc/ceph/client.nagios.keyring
Example
Copy to Clipboard Copied! Toggle word wrap Toggle overflow /usr/lib/nagios/plugins/check_ceph_health --id nagios --keyring /etc/ceph/client.nagios.keyring
[root@host01 ~]# /usr/lib/nagios/plugins/check_ceph_health --id nagios --keyring /etc/ceph/client.nagios.keyring HEALTH OK
NoteThe
check_ceph_health
plug-in performs the equivalent of theceph health
command.
Additional Resources
- See Nagios plugins for Ceph for more information about Ceph Nagios plug-ins usage.