-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathcheck_nova_services
More file actions
32 lines (29 loc) · 872 Bytes
/
check_nova_services
File metadata and controls
32 lines (29 loc) · 872 Bytes
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
#!/bin/bash
# Created by: Taha Ali (tahazohair@gmail.com)
# Created Date: 12/16/2014
# Nagios nrpe plugin for openstack. This plugin checks nova services if they are enable and up or not.
#
#set -e
export OS_TENANT_NAME=$1
export OS_AUTH_URL=$2
export OS_USERNAME=$3
export OS_PASSWORD=$4
EXIT="GOOD"
CMD=$(nova service-list | egrep -v "+----|Binary" | awk -F'|' '{print $2,$3,$4,$5,$6,$8}')
#while read BINARY HOST ZONE STATUS STATE REASON <<<echo $CMD
while read BINARY HOST ZONE STATUS STATE REASON
do
if [ "$STATE" != "up" ]
then
EXIT="BAD"
echo "$BINARY on $HOST is $STATE, reason: $REASON"
continue
fi
done < <(echo "$CMD")
if [ "$EXIT" == "BAD" ]
then
exit 2
else
echo "all nova services are up and running"
exit 0
fi