HPE StoreVirtual Storage / LeftHand
cancel
Showing results for 
Search instead for 
Did you mean: 

Monitor total cluster utilization via SNMP on Nagios

teledata
Respected Contributor

Monitor total cluster utilization via SNMP on Nagios



Graph Label: Lefthand Cluster Utilization
Service: nsm_clust_utilization_
Use Service as a Regular Expression ON
Host: *
Status Text Parsing Regular Expression: SNMP OK - (\d+)\s+(\d+)\s+(\d+)
Use Status Text Parsing instead of Performance Data OFF
RRD Name /usr/local/groundwork/rrd/$HOST$_$SERVICE$.rrd
RRD Create Command $RRDTOOL$ create $RRDNAME$ --step 300 --start n-1yr DS:clustersize:GAUGE:1800:U:U DS:available:GAUGE:1800:U:U DS:warning:GAUGE:1800:U:U DS:critical:GAUGE:1800:U:U DS:provisioned:GAUGE:1800:U:U RRA:AVERAGE:0.5:1:8640 RRA:AVERAGE:0.5:12:9480
RRD Update Command $RRDTOOL$ update $RRDNAME$ -t clustersize:available:warning:critical:provisioned $LASTCHECK$:$VALUE1$:$VALUE2$:$VALUE3$:$VALUE4$:$VALUE5$ 2>&1
Custom RRDtool Graph Command ''
Enable ON

Check_command: check_nsm_clus_util
$USER1$/check_lhcluster.sh $HOSTADDRESS$ $USER7$ $ARG1$ $ARG2$ $ARG3$

ARG1=warning threshold
ARG2=critical threshold
ARG3=# of Cluster (in management group)

usage: check_nsm_clus_util!94!98!1

results:
OK - "LHProdClust01" is 15.00 % free | clustersize=8233 available=1251 warning=7739 critical=8068 provisioned=6982



example of check_lhcluster.sh:

#! /bin/sh
#

STATE_OK=$(expr 0)
STATE_WARNING=$(expr 1)
STATE_CRITICAL=$(expr 2)
STATE_UNKNOWN=$(expr 3)
CLUSTERINSTANCE=$5



RET=$?
if [[ $RET -ne 0 ]]
then
echo "query problem - No data received from host"
exit $STATE_UNKNOWN
fi

# figure out the name of the cluster for instance supplied on command line
clustername=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusClusterName.$CLUSTERINSTANCE|cut -d" " -f4)
#echo "Clustername=$clustername"

# total number of modules in management group
totalmodules=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusModuleCount.0|cut -d" " -f4)
#echo "totalmodules=$totalmodules"

# total number of modules in this particular cluster
clustermodules=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusClusterModuleCount.$CLUSTERINSTANCE|cut -d" " -f4)
#echo "clustermodules=$clustermodules"

checkcount=0

#cycle through each module. Get the totalsize, check only those who match our clustername, then find the smallest sized module in our cluster, multiply it by
# the number of modules in our cluster - that should give us our total cluster capacity.
while [ "$checkcount" -lt $totalmodules ]
do
ck=$(echo $checkcount + 1 | bc)

ibelongto=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusModuleClusterName.$ck|cut -d" " -f4)

#echo "does $ibelongto equal $clustername ? "
if [ "$ibelongto" = "$clustername" ] ; then

modtotal=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusModuleTotalSize.$ck|cut -d" " -f4)

modtotal=$(echo "$modtotal" | bc)
if [ checkmodtota=0 ] ; then
checkmodtotal=$(echo "$modtotal" | bc)
fi
# echo "Check to see if $modtotal is -le $checkmodtotal"
if [ $modtotal -le $checkmodtotal ] ; then
checkmodtotal=$(echo "$modtotal" | bc)
#echo "setting total to $checkmodtotal"
fi
fi

#echo "checkmodtotal is $checkmodtotal"
checkcount=$(($checkcount+1))
done

# How many volumes are in this management group? Let's cycle through them all and count the used space of the volume, and its snapshots (but only
# if they belong to OUR cluster:
numbervolumes=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusVolumeCount.0|cut -d" " -f4)
#echo "Total Volumes in this Management Group is $numbervolumes"

addvolumes=1
totalused=0
while [ "$addvolumes" -le $numbervolumes ]
do
ibelongto=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusVolumeClusterName.$addvolumes|cut -d" " -f4)
if [ "$ibelongto" = "$clustername" ] ; then
#echo "Sure does... check replication level, then look to see if there are snapshots"
repllevel=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusVolumeReplicaCount.$addvolumes|cut -d" " -f4)
#echo "Got a rep level of $repllevel"
snapcount=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusVolumeSnapshotCount.$addvolumes|cut -d" " -f4)
#echo "found $snapcount snapshots"
snapcheck=1
# get the used space of the volume for now.
thisvolumeprov=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusVolumeProvisionedSpace.$addvolumes|cut -d" " -f4)
#echo "non snap size is $thisvolumeprov"
# now cycle through all the snapshots, and add their used space together
while [ "$snapcheck" -le $snapcount ]
do
thissnapprov=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusVolumeSnapshotProvisionedSpace.$addvolumes.$snapcheck|cut -d" " -f4)
#echo "bare snap is $thissnapprov - now add volume plus snapshot"
thisvolumeprov=$(echo "$thisvolumeprov + $thissnapprov" | bc)
#echo "This volumes size so far is $thisvolumeprov"
snapcheck=$(($snapcheck+1))
done

repllevel=$(echo "$repllevel / 1" | bc)
#thisvolumeprov=$(echo "$repllevel * $thisvolumeprov" | bc)
totalused=$(echo "$totalused + $thisvolumeprov" | bc)
dispgb=$(echo "$thisvolumeprov/1024" | bc)
dispgb=$(echo "$dispgb/1024" | bc)
#echo "thisvolume=$dispgb ($repllevel way replication)"
fi
addvolumes=$(($addvolumes+1))
done

#echo "done checking volumes - let's total it up!"
# Lefthand SNMP reports usage in KB, so divide by 1024
totalused=$(echo "$totalused / 1024" | bc)
#echo "total MB $totalused"

# now divide by 1024 to convert MB to GB
totalused=$(echo "$totalused / 1024" | bc)
#echo "total GB $totalused"


clustertotal=$(echo "$checkmodtotal * $clustermodules" | bc)
#echo "clustertotal=$clustertotal"

# There's some overhead to the cluster total due to formating etc etc. Dunno if this is scientific, but this number seemed
# to give me a relatively accurate clustersize across a few different builds, so I'm gonna run with .9845
clustertotal=$(echo "$clustertotal * .9845" | bc)
clustertotal=$(echo "$clustertotal/1" | bc)
#echo "newclustertotal=$clustertotal"

clustertotal=$(echo "$clustertotal / 1024" | bc)
clustertotal=$(echo "$clustertotal / 1024" | bc)
#echo "clustertotal in GB = $clustertotal"

clusteravail=$(echo $clustertotal - $totalused | bc)
#echo "clusteravail=$clusteravail"

# calculate the current percentage free of the cluster
percentfree=$(echo "scale=2; $clusteravail/$clustertotal " |bc)
#echo "percentfree=$percentfree"

wp=$(echo "scale=2; .01*$3" | bc)
cp=$(echo "scale=2; .01*$4" | bc)

# calculate the GB that equals the warning threshhold:
wt=$(echo "scale=10; $clustertotal * $wp" | bc)
# get rid of the decimal places that bash can't deal with
wt=$(echo "$wt /1" | bc)
#echo "the wt is $wt"

# calculate the GB that equals the critical threshhold:
ct=$(echo "scale=2; $clustertotal * $cp" | bc)
# get rid of the decimal places that bash can't deal with
ct=$(echo "$ct /1" | bc)
#echo "the ct is $ct"

#echo "wp=$wp"
#echo "ct=$ct"
#echo "wt= $wt"


cu=$(expr $clustertotal - $clusteravail)

percentfree=$(echo "$percentfree*100" | bc)


if [ $cu -ge $ct ] ; then
echo "CRITICAL - *$clustername is $percentfree % free* | clustersize=$clustertotal available=$clusteravail warning=$wt critical=$ct provisioned=$totalused"
exit $STATE_CRITICAL

elif [ $cu -le $wt ] ; then
echo "OK - $clustername is $percentfree % free | clustersize=$clustertotal available=$clusteravail warning=$wt critical=$ct provisioned=$totalused"
exit $STATE_OK

elif [ $cu -gt $wt ] ; then
echo "WARNING - *$clustername is $percentfree % free* | clustersize=$clustertotal available=$clusteravail warning=$wt critical=$ct provisioned=$totalused"
exit $STATE_WARNING

else
echo "problem - No data received from host"
exit $STATE_UNKNOWN
fi





http://www.tdonline.com
4 REPLIES
ictcths
Occasional Visitor

Re: Monitor total cluster utilization via SNMP on Nagios

Thanks for the massive assist in getting some basic SNMP checking working Teledata. I have fixed some bugs and have this check working again and ready to plug into Icinga.

I am a bit worried about the maths involved though and I am now working on rewriting this from scratch. None the less its a huge help.

Updated version below;

#!/bin/sh

# Credit to Teledata for the initial script at http://forums11.itrc.hp.com/service/forums/postanswer.do?threadid=1373346&forumId=1&closedFlag=0

# Updated by Sam Wilson kahn@the-mesh.org
# Fixed deprecated cluster size OID
# Made using nagios, icinga, groundworks easier
# $Id: check_lh_cluster.sh 209 2011-05-05 04:08:21Z swilson $


STATE_OK=$(expr 0)
STATE_WARNING=$(expr 1)
STATE_CRITICAL=$(expr 2)
STATE_UNKNOWN=$(expr 3)
CLUSTERINSTANCE=$5
LIBEXEC="/usr/local/icinga/libexec"

RET=$?
if [[ $RET -ne 0 ]]
then
echo "query problem - No data received from host"
exit $STATE_UNKNOWN
fi

# figure out the name of the cluster for instance supplied on command line
clustername=$($LIBEXEC/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusClusterName.$CLUSTERINSTANCE|cut -d" " -f4)
#echo "Clustername=$clustername"

# total number of modules in management group
totalmodules=$($LIBEXEC/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusModuleCount.0|cut -d" " -f4)
#echo "totalmodules=$totalmodules"

# total number of modules in this particular cluster
clustermodules=$($LIBEXEC/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusClusterModuleCount.$CLUSTERINSTANCE|cut -d" " -f4)
#echo "clustermodules=$clustermodules"

checkcount=0

#cycle through each module. Get the totalsize, check only those who match our clustername, then find the smallest sized module in our cluster, multiply it by
# the number of modules in our cluster - that should give us our total cluster capacity.
while [ "$checkcount" -lt $totalmodules ]
do
ck=$(echo $checkcount + 1 | bc)

ibelongto=$($LIBEXEC/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusModuleClusterName.$ck|cut -d" " -f4)

#echo "does $ibelongto equal $clustername?"
if [ "$ibelongto" = "$clustername" ] ; then

modtotal=$($LIBEXEC/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusModuleUsableSpace.$ck|cut -d" " -f4)

modtotal=$(echo "$modtotal" | bc)
#echo "stdin errors above...."

if [ checkmodtotal=0 ] ; then
checkmodtotal=$(echo "$modtotal" | bc)
fi
#echo "Check to see if $modtotal is -le $checkmodtotal"
if [ $modtotal -le $checkmodtotal ] ; then
checkmodtotal=$(echo "$modtotal" | bc)
#echo "setting total to $checkmodtotal"
fi
fi

#echo "checkmodtotal is $checkmodtotal"
checkcount=$(($checkcount+1))
done

# How many volumes are in this management group? Let's cycle through them all and count the used space of the volume, and its snapshots (but only
# if they belong to OUR cluster:
numbervolumes=$($LIBEXEC/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusVolumeCount.0|cut -d" " -f4)
#echo "Total Volumes in this Management Group is $numbervolumes"

addvolumes=1
totalused=0
while [ "$addvolumes" -le $numbervolumes ]
do
ibelongto=$($LIBEXEC/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusVolumeClusterName.$addvolumes|cut -d" " -f4)
if [ "$ibelongto" = "$clustername" ] ; then
#echo "Sure does... check replication level, then look to see if there are snapshots"
repllevel=$($LIBEXEC/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusVolumeReplicaCount.$addvolumes|cut -d" " -f4)
#echo "Got a rep level of $repllevel"
snapcount=$($LIBEXEC/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusVolumeSnapshotCount.$addvolumes|cut -d" " -f4)
#echo "found $snapcount snapshots"
snapcheck=1
# get the used space of the volume for now.
thisvolumeprov=$($LIBEXEC/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusVolumeProvisionedSpace.$addvolumes|cut -d" " -f4)
#echo "non snap size is $thisvolumeprov"
# now cycle through all the snapshots, and add their used space together
while [ "$snapcheck" -le $snapcount ]
do
thissnapprov=$($LIBEXEC/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusVolumeSnapshotProvisionedSpace.$addvolumes.$snapcheck|cut -d" " -f4)
#echo "bare snap is $thissnapprov - now add volume plus snapshot"
thisvolumeprov=$(echo "$thisvolumeprov + $thissnapprov" | bc)
#echo "This volumes size so far is $thisvolumeprov"
snapcheck=$(($snapcheck+1))
done

repllevel=$(echo "$repllevel / 1" | bc)
#thisvolumeprov=$(echo "$repllevel * $thisvolumeprov" | bc)
totalused=$(echo "$totalused + $thisvolumeprov" | bc)
dispgb=$(echo "$thisvolumeprov/1024" | bc)
dispgb=$(echo "$dispgb/1024" | bc)
#echo "thisvolume=$dispgb ($repllevel way replication)"
fi
addvolumes=$(($addvolumes+1))
done

#echo "done checking volumes - let's total it up!"
# Lefthand SNMP reports usage in KB, so divide by 1024
totalused=$(echo "$totalused / 1024" | bc)
#echo "total MB $totalused"

# now divide by 1024 to convert MB to GB
totalused=$(echo "$totalused / 1024" | bc)
#echo "total GB $totalused"


clustertotal=$(echo "$checkmodtotal * $clustermodules" | bc)
#echo "clustertotal=$clustertotal"

# There's some overhead to the cluster total due to formating etc etc. Dunno if this is scientific, but this number seemed
# to give me a relatively accurate clustersize across a few different builds, so I'm gonna run with .9845
clustertotal=$(echo "$clustertotal * .9845" | bc)
clustertotal=$(echo "$clustertotal/1" | bc)
#echo "newclustertotal=$clustertotal"

clustertotal=$(echo "$clustertotal / 1024" | bc)
clustertotal=$(echo "$clustertotal / 1024" | bc)
#echo "clustertotal in GB = $clustertotal"

clusteravail=$(echo $clustertotal - $totalused | bc)
#echo "clusteravail=$clusteravail"

# calculate the current percentage free of the cluster
percentfree=$(echo "scale=2; $clusteravail/$clustertotal " |bc)
#echo "percentfree=$percentfree"

wp=$(echo "scale=2; .01*$3" | bc)
cp=$(echo "scale=2; .01*$4" | bc)

# calculate the GB that equals the warning threshhold:
wt=$(echo "scale=10; $clustertotal * $wp" | bc)
# get rid of the decimal places that bash can't deal with
wt=$(echo "$wt /1" | bc)
#echo "the wt is $wt"

# calculate the GB that equals the critical threshhold:
ct=$(echo "scale=2; $clustertotal * $cp" | bc)
# get rid of the decimal places that bash can't deal with
ct=$(echo "$ct /1" | bc)
#echo "the ct is $ct"

#echo "wp=$wp"
#echo "ct=$ct"
#echo "wt= $wt"


cu=$(expr $clustertotal - $clusteravail)

percentfree=$(echo "$percentfree*100" | bc)


if [ $cu -ge $ct ] ; then
echo "CRITICAL - *$clustername is $percentfree % free* | clustersize=$clustertotal available=$clusteravail warning=$wt critical=$ct provisioned=$totalused"
exit $STATE_CRITICAL

elif [ $cu -le $wt ] ; then
echo "OK - $clustername is $percentfree % free | clustersize=$clustertotal available=$clusteravail warning=$wt critical=$ct provisioned=$totalused"
exit $STATE_OK

elif [ $cu -gt $wt ] ; then
echo "WARNING - *$clustername is $percentfree % free* | clustersize=$clustertotal available=$clusteravail warning=$wt critical=$ct provisioned=$totalused"
exit $STATE_WARNING

else
#echo "problem - No data received from host"
exit $STATE_UNKNOWN
fi


teledata
Respected Contributor

Re: Monitor total cluster utilization via SNMP on Nagios

Aaah, that was my first stab at the cluster size query.

I have a newer version that I created. It uses some counters that were introduced in later version of SAN/iQ. It is simplified, and takes much less time to run. (it no longer has to cycle through all the volumes) I think you have to be running 8.5 or newer (maybe 9, I can't remember). Anyway, here's the code:

#! /bin/sh
#

STATE_OK=$(expr 0)
STATE_WARNING=$(expr 1)
STATE_CRITICAL=$(expr 2)
STATE_UNKNOWN=$(expr 3)
CLUSTERINSTANCE=$5



RET=$?
if [[ $RET -ne 0 ]]
then
echo "query problem - No data received from host"
exit $STATE_UNKNOWN
fi

# figure out the name of the cluster for instance supplied on command line
clustername=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusClusterName.$CLUSTERINSTANCE|cut -d" " -f4)
#echo "Clustername=$clustername"

# figure out Available Space
clusteravail=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusClusterAvailableSpace.$CLUSTERINSTANCE|cut -d" " -f4)


# total number of modules in management group
totalmodules=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusModuleCount.0|cut -d" " -f4)
#echo "totalmodules=$totalmodules"

# total number of modules in this particular cluster
clustermodules=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusClusterModuleCount.$CLUSTERINSTANCE|cut -d" " -f4)
#echo "clustermodules=$clustermodules"

checkcount=0

#cycle through each module. Get the totalsize, check only those who match our clustername, then find the smallest sized module in our cluster, multiply it by
# the number of modules in our cluster - that should give us our total cluster capacity.
while [ "$checkcount" -lt $totalmodules ]
do
ck=$(echo $checkcount + 1 | bc)

#echo "checking $ck"
ibelongto=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusModuleClusterName.$ck|cut -d" " -f4)
#echo "ibelongto is $ibelongto"

#echo "does $ibelongto equal $clustername ? "
if [ "$ibelongto" = "$clustername" ] ; then

modtotal=$(/usr/local/groundwork/nagios/libexec/check_snmp -P 2c -H $1 -C $2 -o LEFTHAND-NETWORKS-NSM-CLUSTERING-MIB::clusModuleUsableSpace.$ck|cut -d" " -f4)
#echo "modtotal is $modtotal"
modtotal=$(echo "$modtotal" | bc)
if [ checkmodtotal=0 ] ; then
checkmodtotal=$(echo "$modtotal" | bc)
fi

# echo "Check to see if $modtotal is -le $checkmodtotal"
if [ $modtotal -le $checkmodtotal ] ; then
checkmodtotal=$(echo "$modtotal" | bc)
# echo "setting total to $checkmodtotal"
fi



fi

#echo "checkmodtotal is $checkmodtotal"
checkcount=$(($checkcount+1))
done

clustertotal=$(echo "$checkmodtotal * $clustermodules" | bc)


#convert to MB
clustertotal=$(echo "$clustertotal / 1024" | bc)
clusteravail=$(echo "$clusteravail / 1024" | bc)

#convert to GB
clustertotal=$(echo "$clustertotal / 1024" | bc)
clusteravail=$(echo "$clusteravail / 1024" | bc)
totalused=$(echo "$clustertotal - $clusteravail" |bc)

# calculate the current percentage free of the cluster
percentfree=$(echo "scale=2; $clusteravail/$clustertotal " |bc)
#echo "percentfree=$percentfree"

wp=$(echo "scale=2; .01*$3" | bc)
cp=$(echo "scale=2; .01*$4" | bc)

# calculate the GB that equals the warning threshhold:
wt=$(echo "scale=10; $clustertotal * $wp" | bc)
# get rid of the decimal places that bash can't deal with
wt=$(echo "$wt /1" | bc)
#echo "the wt is $wt"

# calculate the GB that equals the critical threshhold:
ct=$(echo "scale=2; $clustertotal * $cp" | bc)
# get rid of the decimal places that bash can't deal with
ct=$(echo "$ct /1" | bc)
#echo "the ct is $ct"

#echo "wp=$wp"
#echo "ct=$ct"
#echo "wt= $wt"


cu=$(expr $clustertotal - $clusteravail)

percentfree=$(echo "$percentfree*100" | bc)


if [ $cu -ge $ct ] ; then
echo "CRITICAL - *$clustername is $percentfree % free* | clustersize=$clustertotal available=$clusteravail warning=$wt critical=$ct provisioned=$totalused nodes=$clustermodules"
exit $STATE_CRITICAL

elif [ $cu -le $wt ] ; then
echo "OK - $clustername is $percentfree % free | clustersize=$clustertotal available=$clusteravail warning=$wt critical=$ct provisioned=$totalused nodes=$clustermodules"
exit $STATE_OK

elif [ $cu -gt $wt ] ; then
echo "WARNING - *$clustername is $percentfree % free* | clustersize=$clustertotal available=$clusteravail warning=$wt critical=$ct provisioned=$totalused nodes=$clustermodules"
exit $STATE_WARNING

else
echo "problem - No data received from host"
exit $STATE_UNKNOWN
fi





http://www.tdonline.com
Uwe Zessin
Honored Contributor

Re: Monitor total cluster utilization via SNMP on Nagios

I'm not the "forums police", but if you don't mind....

you can put the script in a .TXT file and attach it.
That retains its formatting and keeps the thread 'shorter' for reading the explanation.
Thanks.
.
Majed17
Occasional Visitor

Re: Monitor total cluster utilization via SNMP on Nagios

hi i used your script but it didn't and the same result is with teledata's, first it was error on line 41 and now it is error on line 43!

i have hp left hand 4300 and here is the command i used:

 

./check_lefthand.sh 10.1.1.215 snmp 94 98 1

reusult:

./check_lefthand.sh: line 43: bc: command not found
./check_lefthand.sh: line 43: bc: command not found
./check_lefthand.sh: line 90: [: 1: unary operator expected
./check_lefthand.sh: line 99: bc: command not found
./check_lefthand.sh: line 101: bc: command not found
./check_lefthand.sh: line 102: bc: command not found
./check_lefthand.sh: line 103: bc: command not found
./check_lefthand.sh: line 111: bc: command not found
./check_lefthand.sh: line 115: bc: command not found
./check_lefthand.sh: line 119: bc: command not found
./check_lefthand.sh: line 124: bc: command not found
./check_lefthand.sh: line 125: bc: command not found
./check_lefthand.sh: line 128: bc: command not found
./check_lefthand.sh: line 129: bc: command not found
./check_lefthand.sh: line 132: bc: command not found
./check_lefthand.sh: line 136: bc: command not found
./check_lefthand.sh: line 139: bc: command not found
./check_lefthand.sh: line 140: bc: command not found
./check_lefthand.sh: line 143: bc: command not found
./check_lefthand.sh: line 145: bc: command not found
./check_lefthand.sh: line 149: bc: command not found
./check_lefthand.sh: line 151: bc: command not found
./check_lefthand.sh: line 161: bc: command not found
./check_lefthand.sh: line 164: [: -: unary operator expected
./check_lefthand.sh: line 168: [: -: unary operator expected
./check_lefthand.sh: line 172: [: -: unary operator expected
any idea of what is wrong?