Nagios Server Setup¶
This example assumes the Nagios server is installed on Ubuntu 12.04 Server 64-bit.
To set up Nagios to take advantage of the Nagios Swift plugins installed on the SwiftStack nodes, we need to create several files in /etc/nagios3/conf.d.
You need to create a file to include the nodes in your cluster. (You can name it whatever you like, but it has to end with .cfg.)
$ sudo vi /etc/nagios3/conf.d/swift-cluster1-nodes.cfg
Here's an example of what it could look like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | define host{
use swift-host ; change this to your object inheritance file
host_name ssdemo-01 ; change this
alias ssdemo-01 ; change this
address 192.168.1.211 ; change this
}
define host{
use swift-host
host_name ssdemo-02
alias ssdemo-02
address 192.168.1.212
}
# You can add more nodes with the template
#define host{
# use %inheritance file
# host_name %HostName
# alias %Alias
# address %IP_of_the_node
# }
|
Create another config file to define the SwiftStack plugins and manage the Swift cluster host groups. In the following .cfg file, you need to change some parameters to match your conditions, namely:
- hostgroup_name in "Define Service base template" section
- hostgroup block in "Define Swift clusters" section

To define objects for NRPE, run
$ sudo vi /etc/nagios3/conf.d/swift-definition.cfg
and add the following lines:
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | # ============= Define Swift host base template ===============
define host{
name swift-host ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
check_command check-host-alive
max_check_attempts 10
notification_interval 0
notification_period 24x7
notification_options d,u,r
contact_groups admins
register 1 ; Host definition is enabled
}
# ============ Define service base template =============
define service{
name swift-service
active_checks_enabled 1
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 1
check_freshness 0
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
failure_prediction_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 0
is_volatile 0
check_period 24x7
normal_check_interval 5
retry_check_interval 1
max_check_attempts 4
notification_period 24x7
notification_options w,u,c,r
contact_groups admins
hostgroup_name ssdemo-nodes ;,%Cluster2 ;append new cluster(host_group) here
register 0
}
# ============ Define Swift Clusters ============
# A list of nodes in a cluster
define hostgroup {
hostgroup_name ssdemo-nodes ; change this
alias SwiftStack ssdemo nodes ; change this
members ssdemo-01, ssdemo-02 ; change this
}
# You can add additional hostgroups here
#define hostgroup {
# hostgroup_name %Cluster2
# alias %I_love_SwiftStack
# members %N1, $N2, ....
# }
# ============ Define Swift Services ==============
# The following services are inheriting parameters from swift-service.
# Generally, you don't need to change the following lines
# === Check Swift drives mounting status ===
define service {
service_description Swift Drives Mounted
check_command check_nrpe_1arg!check_drives_mounted!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
# === Check Swift drive space utilization ===
define service {
service_description Swift Drives Utilization
check_command check_nrpe_1arg!check_drive_utilization!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
# === Check Swift background daemons ===
# Account
define service {
service_description Account Reaper
check_command check_nrpe_1arg!check_account_reaper!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
define service {
service_description Account Replicator
check_command check_nrpe_1arg!check_account_replicator!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
define service {
service_description Account Auditor
check_command check_nrpe_1arg!check_account_auditor!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
# Container
define service {
service_description Container Replicator
check_command check_nrpe_1arg!check_container_replicator!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
define service {
service_description Container Updater
check_command check_nrpe_1arg!check_container_updater!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
define service {
service_description Container Auditor
check_command check_nrpe_1arg!check_container_auditor!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
# Object
define service {
service_description Object Replicator
check_command check_nrpe_1arg!check_object_replicator!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
define service {
service_description Object Updater
check_command check_nrpe_1arg!check_object_updater!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
define service {
service_description Object Auditor
check_command check_nrpe_1arg!check_object_auditor!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
# === Check Swift sweeps ===
# Account
define service {
service_description Sweep Account Reaper
check_command check_nrpe_1arg!check_sweep_account_reaper!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
define service {
service_description Sweep Account Replicator
check_command check_nrpe_1arg!check_sweep_account_replicator!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
define service {
service_description Sweep Account Auditor
check_command check_nrpe_1arg!check_sweep_account_auditor!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
# Container
define service {
service_description Sweep Container Replicator
check_command check_nrpe_1arg!check_sweep_container_replicator!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
define service {
service_description Sweep Container Updater
check_command check_nrpe_1arg!check_sweep_container_updater!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
define service {
service_description Sweep Container Auditor
check_command check_nrpe_1arg!check_sweep_container_auditor!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
# Object
define service {
service_description Sweep Object Replicator
check_command check_nrpe_1arg!check_sweep_object_replicator!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
define service {
service_description Sweep Object Updater
check_command check_nrpe_1arg!check_sweep_object_updater!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
define service {
service_description Sweep Object Auditor
check_command check_nrpe_1arg!check_sweep_object_auditor!$HOSTADDRESS$
use swift-service
notification_interval 10 ; set > 0 if you want to be renotified
}
|

To define a new command object for check_by_ssh, add the following lines in /etc/nagios3/commands.cfg:
1 2 3 4 5 6 7 8 | ###############################################################################
# Check by SSH base command - SwiftStack
###############################################################################
define command {
command_name check_by_ssh
command_line $USER1$/check_by_ssh -H $HOSTADDRESS$ -l $ARG1$ -C $ARG2$
}
|
$ sudo vi /etc/nagios3/conf.d/swift-non-nrpe-definition.cfg
… add the following lines:
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | # =============Define Swift Host bash template ===============
define host{
name swift-host-test ; The name of this host template
notifications_enabled 1 ; Host notifications are enabled
event_handler_enabled 1 ; Host event handler is enabled
flap_detection_enabled 1 ; Flap detection is enabled
failure_prediction_enabled 1 ; Failure prediction is enabled
process_perf_data 1 ; Process performance data
retain_status_information 1 ; Retain status information across program restarts
retain_nonstatus_information 1 ; Retain non-status information across program restarts
check_command check-host-alive
max_check_attempts 10
notification_interval 0
notification_period 24x7
notification_options d,u,r
contact_groups admins
register 1 ; DONT REGISTER THIS DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
}
# ============ Define service base =============
define service{
name swift-non-nrpe-service
active_checks_enabled 1
passive_checks_enabled 1
parallelize_check 1
obsess_over_service 1
check_freshness 0
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
failure_prediction_enabled 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
notification_interval 0
is_volatile 0
check_period 24x7
normal_check_interval 5
retry_check_interval 1
max_check_attempts 4
notification_period 24x7
notification_options w,u,c,r
contact_groups admins
hostgroup_name swiftstack-non-nrpe ;,staging-nodes ;append new cluster(host_group) here
register 0
}
# ============ Define Swift Clusters ============
# A list of Swift ssdemo servers
define hostgroup {
hostgroup_name swiftstack-non-nrpe ; change this
alias SwiftStack non NRPE ; change this
members ssnode-centos7-non-nrpe ; change this
}
#define hostgroup {
# hostgroup_name staging-nodes
# alias SwiftStack Staging nodes
# members swift-01, swift-02, swift-03, swift-04
# }
# ============ Define Swift Services ==============
#Check Swift drives mounting status
define service {
service_description Swift Drives Mounted
check_command check_by_ssh!swiftstack!check_drives_mounted!$HOSTADDRESS$
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
#Check Swift dirves space utilization
define service {
service_description Swift Drives Utilization
check_command check_by_ssh!swiftstack!check_drive_utilization!$HOSTADDRESS$
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
#Check Swift Background Daemons
#Account
define service {
service_description Account-reaper
check_command check_by_ssh!swiftstack!"check_swift_background_daemon -w 4 -c 12 account-reaper"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
define service {
service_description Account-replicator
check_command check_by_ssh!swiftstack!"check_swift_background_daemon -w 4 -c 12 account-replicator"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
define service {
service_description Account-auditor
check_command check_by_ssh!swiftstack!"check_swift_background_daemon -w 4 -c 12 account-auditor"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
#Container
define service {
service_description Container-replicator
check_command check_by_ssh!swiftstack!"check_swift_background_daemon -w 4 -c 12 container-replicator"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
define service {
service_description Container-updater
check_command check_by_ssh!swiftstack!"check_swift_background_daemon -w 4 -c 12 container-updater"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
define service {
service_description Container-auditor
check_command check_by_ssh!swiftstack!"check_swift_background_daemon -w 4 -c 12 container-auditor"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
#Object
define service {
service_description Object-replicator
check_command check_by_ssh!swiftstack!"check_swift_background_daemon -w 4 -c 12 object-replicator"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
define service {
service_description Object-updater
check_command check_by_ssh!swiftstack!"check_swift_background_daemon -w 4 -c 12 object-updater"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
define service {
service_description Object-auditor
check_command check_by_ssh!swiftstack!"check_swift_background_daemon -w 4 -c 12 object-auditor"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
#Check swift SWEEP
#Account
define service {
service_description Sweep-Account-reaper
check_command check_by_ssh!swiftstack!"check_swift_sweep_time -w 8 -c 12 account-reaper"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
define service {
service_description Sweep-Account-replicator
check_command check_by_ssh!swiftstack!"check_swift_sweep_time -w 8 -c 12 account-replicator"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
define service {
service_description Sweep-Account-auditor
check_command check_by_ssh!swiftstack!"check_swift_sweep_time -w 8 -c 12 account-auditor"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
#Container
define service {
service_description Sweep-Container-replicator
check_command check_by_ssh!swiftstack!"check_swift_sweep_time -w 8 -c 12 container-replicator"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
define service {
service_description Sweep-Container-updater
check_command check_by_ssh!swiftstack!"check_swift_sweep_time -w 8 -c 12 container-updater"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
define service {
service_description Sweep-Container-auditor
check_command check_by_ssh!swiftstack!"check_swift_sweep_time -w 8 -c 12 container-auditor"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
#Object
define service {
service_description Sweep-Object-replicator
check_command check_by_ssh!swiftstack!"check_swift_sweep_time -w 8 -c 12 object-replicator"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
define service {
service_description Sweep-Object-updater
check_command check_by_ssh!swiftstack!"check_swift_sweep_time -w 8 -c 12 object-updater"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
define service {
service_description Sweep-Object-auditor
check_command check_by_ssh!swiftstack!"check_swift_sweep_time -w 8 -c 12 object-auditor"!
use swift-non-nrpe-service
notification_interval 60 ; set > 0 if you want to be renotified
}
|
Both NRPE and SSH require Nagios to be restarted to apply the changes:
$ sudo service nagios3 restart
You should now see Swift-specific information listed in your Nagios GUI.
Tip

To verify that the NRPE server plugin is working, you can run the following command on your Nagios server against one of your nodes:
$ /usr/lib/nagios/plugins/check_nrpe -H <NRPE_SERVER_IP> -c <COMMAND>
As an example, if you wanted to check the account-reaper daemon on 192.168.1.211, you would run:
$ /usr/lib/nagios/plugins/check_nrpe -H 192.168.1.211 -c check_account_reaper

You can verify that the SSH plugin is working from the Nagios server. For example, here's how you would check that the disks are mounted on 192.168.201.179:
$ /usr/lib/nagios/plugins/check_by_ssh -H 192.168.201.179 -l swiftstack -C check_drives_mounted