Search This Blog

Tuesday, 8 June 2010

Ganglia gmetric Scripts

Script for monitoring SAN disk activity (Avg % of total disk busy). 

Eg: for monitoring the disk activity on Controller 8 (c8)

while true;
iostat -xcn 2 15 |grep c8|grep -v b|awk {'print $10'}>/tmp/iostat
DTot=`iostat-en|grep c8|wc -l` #Total Number of disk in Controller c8
tail -$DTot  /tmp/iostat >/tmp/
Per=`awk 'BEGIN{total=0}{total += $1} END{print total}' /tmp/`
Aper=`echo $Per / $DTot |bc`
/usr/local/bin/gmetric --name Avarage_SAN_usage_of_168_disks  --value $Aper --type int32 --unit Avg_%

Mastering Unix Shell Scripting: Bash, Bourne, and Korn Shell Scripting for Programmers, System Administrators, and UNIX Gurus

No comments:

Post a Comment