- Community Home
- >
- Storage
- >
- Midrange and Enterprise Storage
- >
- StoreVirtual Storage
- >
- Monitor total cluster utilization via SNMP on Nagi...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2009 08:38 AM
тАО09-22-2009 08:38 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-04-2011 08:09 PM
тАО05-04-2011 08:09 PM
Re: Monitor total cluster utilization via SNMP on Nagios
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-05-2011 05:07 AM
тАО05-05-2011 05:07 AM
Re: Monitor total cluster utilization via SNMP on Nagios
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-05-2011 05:11 AM
тАО05-05-2011 05:11 AM
Re: Monitor total cluster utilization via SNMP on Nagios
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-11-2012 10:40 PM - edited тАО01-11-2012 10:41 PM
тАО01-11-2012 10:40 PM - edited тАО01-11-2012 10:41 PM
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?