#!/bin/bash monitor="/usr/sbin/crm_mon -1" # check cluster is healthy ${monitor} -s 1>/dev/null if [ "$?" != "0" ]; then echo "Cluster is not OK!" exit 2 else # # check if there is at least one nfs server active # ${monitor} | grep nfsclusterserver | grep -i started 1>/dev/null if [ "$?" != "0" ]; then echo "NFS server is not running anywhere!" exit 2 else hname=$(hostname -s) ${monitor} | grep $hname | grep nfsclusterserver 1>/dev/null if [ "$?" = "0" ]; then # # I am the nfs server: check if I'm healthy # exec /usr/lib64/nagios/plugins/check_nfs4 else # # I am not the nfs server but: # - the cluster is ok # - the service is running # echo "NFS is running somewhere..." exit 0 fi fi fi