The second of my posts, concerning Netapp monitoring : this time we'll monitor Network IN and OUT. Refer to the previous article in order to get system dependencies, and software needed.
With the same perl script which reads SNMP entries, we'll get values for Netwok in and Network out for the Filer.
As for the operations per second, here we get TOTAL Network in and out. This explains why we have to stock it into a "COUNTER" and not a "GAUGE".
As usual, the crontab, every minute reads the value, updates the RRD and creates the graph :
* * * * * cd /root/scripts/; /root/scripts/netapp1_net_rrd
And now the script which does all that :
#!/bin/bash
check="/root/scripts/check_netapp"
args=" -H 192.168.xxx.xxx "
stockage="/data/rrd"
rep_logs="/root/logs"
rep_img="/data/www/monitoring"
declare -ar durees='([0]="1" [1]="10" [2]="30" [3]="90" )'
creation_rrd(){
if [ ! -f $stockage/netapp1_net.rrd ]
then
echo "rrdtool create $stockage/netapp1_net.rrd -s 60 \\" > /tmp/create.sh
echo "DS:netin:COUNTER:180:U:U \\" >> /tmp/create.sh
echo "RRA:MAX:0.5:1:14400 \\" >> /tmp/create.sh
echo "RRA:AVERAGE:0.5:30:960 \\" >> /tmp/create.sh
echo "RRA:AVERAGE:0.5:180:480 \\" >> /tmp/create.sh
echo "DS:netout:COUNTER:180:U:U \\" >> /tmp/create.sh
echo "RRA:MAX:0.5:1:14400 \\" >> /tmp/create.sh
echo "RRA:AVERAGE:0.5:30:960 \\" >> /tmp/create.sh
echo "RRA:AVERAGE:0.5:180:480 \\" >> /tmp/create.sh
echo >> /tmp/create.sh
. /tmp/create.sh
rm -f /tmp/create.sh
fi
}
maj_rrd(){
commande="rrdtool update $stockage/netapp1_net.rrd N"
comm=$(echo $check$args" -v NETIN")
res=$($comm)
cifsops=$(echo $res| awk '{print $7}' )
comm=$(echo $check$args" -v NETOUT")
res=$($comm)
nfsops=$(echo $res| awk '{print $7}' )
commande=$commande":"$cifsops":"$nfsops
#echo $commande
$($commande)
}
creation_graph(){
for i in ${durees[*]}
do
echo "rrdtool graph $rep_img/netapp1_net_"$i".png \\" > /tmp/graph_netapp1_net.sh
echo "-s \"now -"$i" days\" -e now \\" >> /tmp/graph_netapp1_net.sh
echo "--title=\"Entrees sorties reseau sur Netapp1, les "$i" derniers jours\" \\" >> /tmp/graph_netapp1_net.sh
echo "--vertical-label=\"KOctets / sec \" \\" >> /tmp/graph_netapp1_net.sh
echo "--imgformat=PNG \\" >> /tmp/graph_netapp1_net.sh
echo "--color=BACK#CCCCCC \\" >> /tmp/graph_netapp1_net.sh
echo "--color=CANVAS#343434 \\" >> /tmp/graph_netapp1_net.sh
echo "--color=SHADEB#9999CC \\" >> /tmp/graph_netapp1_net.sh
echo "--width=600 \\" >> /tmp/graph_netapp1_net.sh
echo "--base=1000 \\" >> /tmp/graph_netapp1_net.sh
echo "--height=400 \\" >> /tmp/graph_netapp1_net.sh
echo "--interlaced \\" >> /tmp/graph_netapp1_net.sh
echo "--lower-limit=0 \\" >> /tmp/graph_netapp1_net.sh
echo "DEF:netin=$stockage/netapp1_net.rrd:netin:MAX \\" >> /tmp/graph_netapp1_net.sh
echo "AREA:netin#FE8A06:\" Flux entrant reseau\" \\" >> /tmp/graph_netapp1_net.sh
echo "DEF:netout=$stockage/netapp1_net.rrd:netout:MAX \\" >> /tmp/graph_netapp1_net.sh
echo "LINE1:netout#06FE40:\" Flux sortant reseau\" \\" >> /tmp/graph_netapp1_net.sh
. /tmp/graph_netapp1_net.sh
rm -f /tmp/graph_netapp1_net.sh
done
}
cd /root/scripts
creation_rrd
maj_rrd
creation_graph
Have fun !
No comments:
Post a Comment