Search This Blog

Showing posts with label monitoring script. Show all posts
Showing posts with label monitoring script. Show all posts

Sunday, 22 November 2009

Script for Continuous monitoring of percentage of page file usage in solaris

#script for monitoring page file usage in %. written by latheefp@gmail.com
while true
do
used=`swap -s|awk {'print $9'}|cut -dk -f1`
#echo "Used is :`expr $used / 1024`MB"
avail=`swap -s|awk {'print $11'}|cut -dk -f1`
#echo "Available is :`expr $avail / 1024`MB"
total=`expr $used + $avail`
#echo "Total is :`expr $total / 1024`MB"
percused=`expr $used \* 100`
percent=`expr $percused / $total`
#echo "Percentage of page file usage is :$percent% "
clear
echo "Used Available Total %Used"
echo "`expr $used / 1024`MB `expr $avail / 1024`MB `expr $total / 1024`MB $percent%"
sleep 5
done

Sunday, 11 October 2009

Script for moving system logs to another machine by using with time stamp using crontab

#this is the simple script which run depends on crontab entry
#/bin/sh
HOST=`hostname`
TIMESTAMP=`date +"%b_%d_%y_%H-%M%p"`
cd /var/adm
cp messages.1 messages.$HOST.$TIMESTAMP
sleep 6
gzip /var/adm/messages.$HOST.$TIMESTAMP
scp /var/adm/messages.$HOST.$TIMESTAMP.gz root@10.2.171.101:/home/root/logs #ssh key must be instlled on remote machine, else, it will ask for the password everytime.
rm /var/adm/messages.$HOST.$TIMESTAMP.gz