Tools: Monitoring Unix Resource Script ver 1.0
0 Comments Published by Hs on Wednesday, July 11, 2007 at 9:23 AM.Due to the past experiences working in my organization, having the problem of not able to monitor the Unix system resources due to whatever reasons (rstatd configuration, dynamic ports, security reasons or lazy administrators) had always been bothering us.
Our team came up with the simple initiative to monitor using the same concept as perfmon. We requested (outsourced) one of our interims to search for unix monitoring scripts and modify it to collect data periodically. And here we are, special thanks to the interim, we finally got the first-cut of the scripts.
Copy and paste the below script starting from here ==================================================================
#!/bin/bash
# (C) 2006 Mark Boddington, http://www.badpenguin.co.uk/
# (C) 2007 Modified by Hwee Seong, http://loadrunnertnt.blogspot.com
# Licensed under the GNU GPL Version 2.
# ***** Configuration *****
# set LOG to the directory you want to write the performance data to.
# set HDD to the number of had disks in your machine.
# NOTE : Do not change the variable LIMIT
LOG=/home/Admin/report
HDD=2
LIMIT=0
genStat()
{
test=$1
SLEEP=$2
filename=$(date +%Y%m%d%H%M%S)
for((num=0;num
sleep $SLEEP
done
if [[ LIMIT -eq test ]]
then
#VM csv
echo Date,Time,Procs in Run Queue,Procs Blocked,Virtual Memory Used,Idle Memory,Buff Memory Used,Cache Memory Used,Swap In,Swap Out,Blocks Received,Blocks Sent,System Interrupt,Context Switches/sec,Cpu User Time,Cpu System Time,Cpu Idle Time,Cpu Waiting Time> ${LOG}/vm.${filename}.csv
cat ${LOG}/vm.${filename}.log awk '{for(l=1;l<17;l++)>> ${LOG}/vm.${filename}.csv
fi
}
case $1 in
run)
genStat $2 $3
;;
*)
echo -e ":::: Usage ::::"
echo -e "$0 run 5 10 : Collect stats for 5 times with 10 seconds interval"
echo -e "Note : Change the first parameter for the number of stats"
echo -e " Change the second parameter for the number of seconds between each stats"
;;
esac
==================================================================
The original script was developed by Mark Boddington and could be obtained from http://www.badpenguin.co.uk
The modified script allows the interval between each collection and the number of times the collection is made. However, this script lacks the ability to set the output path and it is created based on vmstat. Also, you will have to estimate the completion time for the scenario to complete.
To use the script, copy the quoted content (above) and name it MonitorPerformance.sh. Then in the directory that the script exists, type the following:
\MonitorPerformance.sh 5 10
Where 5 is the number of times the collection is made and 10 is the interval between each collection in seconds.
Once the collection is complete, import the file in analysis. Our settings in Analysis are as follows.
This is a minimal start for us and we intend to further enhance the script to allow the following (provided we can squeeze some time out):
1. Changing of the output path
2. Include iostat and netstat.
Please feel free to use the script and we welcome suggestions, modifications and enhancement to the scripts to make it a better tool.
(simple tools making lifes easier)
Related Topics
Tools: Duplicating Files Prior Load Test
Tools: Determine the Windows patches installed using Windows 2003 Resource Kit
Labels: iostat, monitor, monitoring, netstat, Tools, unix, vmstat





0 Responses to “Tools: Monitoring Unix Resource Script ver 1.0”
Post a Comment