#! /bin/ksh
vmstat 5 5 > /tmp/vmstat.temp
freemem=`sed -n '5p' /tmp/vmstat.temp | awk '{print $5}'`
freecpu=`sed -n '5p' /tmp/vmstat.temp | awk '{print $22}'`
load=`uptime | awk '{print $10}'| cut -c1-4`
ldapstatus=`zlogin lpr-srv-prd-02 /usr/lib/ldap/ldap_cachemgr -g | grep DOWN| wc -l`
date >> /var/tmp/performacestats ; uptime >> /var/tmp/performacestats; prstat -Z 1 1 >> /var/tmp/performacestats; top -b 1 1 >> /var/tmp/performacestats; /usr/lib/ldap/ldap_cachemgr -g >> /var/tmp/performacestats; vmstat 5 5 >> /var/tmp/performacestats ; echo "===================================" >> /var/tmp/performacestats
#Alert on less than 40% free CPU
thresholcpu="40"
#Memory in KB (Alert on less than 25gb free)
thresholdmem="26214400"
#Alert on higher than 40% LOAD
thresholdload="20.00"
if [ "$freemem" -lt "$thresholdmem" ] || [ "$freecpu" -lt "$thresholdcpu" ] || [ "$load" -gt "$thresholdload" ] || [ "$ldapstatus" -gt 0 ]
then
echo "Check performance on <Server Name>. Log file is /var/tmp/performacestats" | mailx -s "ALERT: Performace Test" <E-Mail>
fi
vmstat 5 5 > /tmp/vmstat.temp
freemem=`sed -n '5p' /tmp/vmstat.temp | awk '{print $5}'`
freecpu=`sed -n '5p' /tmp/vmstat.temp | awk '{print $22}'`
load=`uptime | awk '{print $10}'| cut -c1-4`
ldapstatus=`zlogin lpr-srv-prd-02 /usr/lib/ldap/ldap_cachemgr -g | grep DOWN| wc -l`
date >> /var/tmp/performacestats ; uptime >> /var/tmp/performacestats; prstat -Z 1 1 >> /var/tmp/performacestats; top -b 1 1 >> /var/tmp/performacestats; /usr/lib/ldap/ldap_cachemgr -g >> /var/tmp/performacestats; vmstat 5 5 >> /var/tmp/performacestats ; echo "===================================" >> /var/tmp/performacestats
#Alert on less than 40% free CPU
thresholcpu="40"
#Memory in KB (Alert on less than 25gb free)
thresholdmem="26214400"
#Alert on higher than 40% LOAD
thresholdload="20.00"
if [ "$freemem" -lt "$thresholdmem" ] || [ "$freecpu" -lt "$thresholdcpu" ] || [ "$load" -gt "$thresholdload" ] || [ "$ldapstatus" -gt 0 ]
then
echo "Check performance on <Server Name>. Log file is /var/tmp/performacestats" | mailx -s "ALERT: Performace Test" <E-Mail>
fi
No comments:
Post a Comment