Setting up a SwiftStack Node to be monitored by Nagios

../../_images/nagios-nrpe-label.png

Install the Nagios NRPE server agent and plugins:

** Ubuntu **

$ sudo apt-get install nagios-nrpe-server nagios-plugins

** CentOS/RHEL 6.x **

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
sudo rpm -Uvh epel-release-6*.rpm
sudo yum install nrpe nagios-plugins

** CentOS/RHEL 7.x **

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -Uvh epel-release-7*.rpm
sudo yum install nrpe nagios-plugins

Grant passwordless sudo permissions to user nagios (because 2 of 4 SwiftStack plugins require root permissions):

$ sudo visudo

Add the following line:

nagios ALL=(ALL) NOPASSWD: ALL

Edit the /etc/nagios/nrpe.cfg file to allow monitoring from the Nagios server

$ sudo vi /etc/nagios/nrpe.cfg

… and update:

allowed_hosts=<your Nagios server's IP here>

Add the following commands to /etc/nagios/nrpe.cfg (For details on the -w -c switches, please refer to Nagios Plugin Scripts.)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
########################################################
# SwiftStack Plugins command arguments
########################################################

# Drives Mounted
command[check_drives_mounted]=/usr/bin/check_drives_mounted -w 0 -c 1

# Drive Utilization
command[check_drive_utilization]=/usr/bin/check_drive_utilization -w 50 -c 85

# Account Daemon
command[check_account_reaper]=/usr/bin/sudo /usr/bin/check_swift_background_daemon -w 4 -c 12 account-reaper
command[check_account_replicator]=/usr/bin/sudo /usr/bin/check_swift_background_daemon -w 4 -c 12 account-replicator
command[check_account_auditor]=/usr/bin/sudo /usr/bin/check_swift_background_daemon -w 4 -c 12 account-auditor

# Container Daemon
command[check_container_replicator]=/usr/bin/sudo /usr/bin/check_swift_background_daemon -w 4 -c 12 container-replicator
command[check_container_updater]=/usr/bin/sudo /usr/bin/check_swift_background_daemon -w 4 -c 12 container-updater
command[check_container_auditor]=/usr/bin/sudo /usr/bin/check_swift_background_daemon -w 4 -c 12 container-auditor

# Object Daemon
command[check_object_replicator]=/usr/bin/sudo /usr/bin/check_swift_background_daemon -w 4 -c 12 object-replicator
command[check_object_updater]=/usr/bin/sudo /usr/bin/check_swift_background_daemon -w 4 -c 12 object-updater
command[check_object_auditor]=/usr/bin/sudo /usr/bin/check_swift_background_daemon -w 4 -c 12 object-auditor

# Account Sweep
command[check_sweep_account_reaper]=/usr/bin/sudo /usr/bin/check_swift_sweep_time -w 8 -c 12 account-reaper
command[check_sweep_account_replicator]=/usr/bin/sudo /usr/bin/check_swift_sweep_time -w 8 -c 12 account-replicator
command[check_sweep_account_auditor]=/usr/bin/sudo /usr/bin/check_swift_sweep_time -w 8 -c 12 account-auditor

# Container Sweep
command[check_sweep_container_replicator]=/usr/bin/sudo /usr/bin/check_swift_sweep_time -w 8 -c 12 container-replicator
command[check_sweep_container_updater]=/usr/bin/sudo /usr/bin/check_swift_sweep_time -w 8 -c 12 container-updater
command[check_sweep_container_auditor]=/usr/bin/sudo /usr/bin/check_swift_sweep_time -w 8 -c 12 container-auditor

# Object Sweep
command[check_sweep_object_replicator]=/usr/bin/sudo /usr/bin/check_swift_sweep_time -w 8 -c 12 object-replicator
command[check_sweep_object_updater]=/usr/bin/sudo /usr/bin/check_swift_sweep_time -w 8 -c 12 object-updater
command[check_sweep_object_auditor]=/usr/bin/sudo /usr/bin/check_swift_sweep_time -w 8 -c 12 object-auditor

Restart your nrpe server:

$ sudo /etc/init.d/nagios-nrpe-server restart

../../_images/nagios-ssh-label.png

To allow the nagios user to SSH to your SwiftStack node as user swiftstack, copy the public key of the nagios user to the swiftstack user's authorized_keys file:

$ cat nagios_key.pub >> /home/swiftstack/.ssh/authorized_keys