first commit
This commit is contained in:
41
scripts/gluster_checks/check_glusterd.sh
Normal file
41
scripts/gluster_checks/check_glusterd.sh
Normal file
@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
#Roy Cohen :roy@wondercohen.nl
|
||||
#objective :Check Gluster deamon state for Nagios
|
||||
#First line of code :15/01/2019
|
||||
#last update :17/01/2019
|
||||
#version :1.0
|
||||
|
||||
#Some general vars
|
||||
#glusterd pid status
|
||||
GLUSTERD_STAT=$(pidof glusterd &>/dev/null)
|
||||
#glusterfsd (brick daemon) pid status
|
||||
GLUSTER_BRICK_STAT=$(pidof glusterfsd &>/dev/null)
|
||||
|
||||
|
||||
######START OF SCRIPT#######
|
||||
|
||||
check_if_glusterd_is_running() {
|
||||
#check if glusterd is running
|
||||
if ! $GLUSTERD_STAT &>/dev/null; then
|
||||
echo "CRITICAL: glusterd management daemon not running"
|
||||
exit 2
|
||||
else
|
||||
echo "OK: glusterd management daemon is running"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
check_if_glusterfsd_is_running() {
|
||||
# check for glusterfsd (brick daemon)
|
||||
if ! $GLUSTER_BRICK_STAT; then
|
||||
echo "CRITICAL: glusterfsd brick daemon not running"
|
||||
exit 2
|
||||
else
|
||||
echo "OK: glusterfsd brick daemon is running"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
#### CALL THE FUNCTIONS ######
|
||||
check_if_glusterd_is_running
|
||||
check_if_glusterfsd_is_running
|
Reference in New Issue
Block a user