Operating System - HP-UX
1834375 Members
1628 Online
110066 Solutions
New Discussion

Re: Script for logging performance monitoring

 
PSS SYS ADMIN
Super Advisor

Script for logging performance monitoring

Hi everyone,
I need an help to write a script to log to a txt the cpu, disk, network and the memory utilization day by day of an hpux 11.00 server.
Please do not respond me to install some software. I have to use only a script.

Regards...
PSS
6 REPLIES 6
Christian Gebhardt
Honored Contributor

Re: Script for logging performance monitoring

"sar" is your command, look at man sar

Example

sar -u 10 10 > file.txt

writes 10 times all 10 seconds an output of CPU utilization to file.txt

cronjob:

* * * * * sar -u 1 1 > file.txt

writes every minute the CPU utilization to file.txt

Chris


Christian Gebhardt
Honored Contributor

Re: Script for logging performance monitoring

"sar" is your command, look at man sar

Example

sar -u 10 10 > file.txt

writes 10 times all 10 seconds an output of CPU utilization to file.txt

cronjob:

* * * * * sar -u 1 1 >> file.txt

writes every minute the CPU utilization to file.txt

Chris


Steve Steel
Honored Contributor

Re: Script for logging performance monitoring

Hi

here you go

#!/usr/bin/ksh
#Do this
#---------
/bin/rm /tmp/sarlis /tmp/toplis 2>/dev/null
top -d5 -n60 -f /tmp/toplis&
sar -A -o /tmp/sarlis 5 10 >/dev/null 2>&1
#
file=/tmp/sarlis
wait
xx="u d q b w c a y v m"
for f in $xx
do
echo "sar -$f -f $file" >> /tmp/toplis
echo "======================================================================
========" >> /tmp/toplis
sar -$f -f $file >> /tmp/toplis
echo "======================================================================
========" >> /tmp/toplis
done


Or go to
http://www.introcomp.co.uk/examples/index.html

there are plenty of example there


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Leif Halvarsson_2
Honored Contributor

Re: Script for logging performance monitoring

Hi,
The most simple solution is to run commands as "bdf" and "vmstat" from cron and output to a logfile ex:

0,15,30,45 * * * * /usr/bin/vmstat >>/tmp/vmstat_log
Keely Jackson
Trusted Contributor

Re: Script for logging performance monitoring

Hi

I had to do something similar so cobbled together a quick shell/awk script.

Feel free to pick out anything useful from it.

Cheers
Keely
Live long and prosper
Keely Jackson
Trusted Contributor

Re: Script for logging performance monitoring

Hi again

Have a look at this thread, you will probably find something useful here.

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x836cc1c4ceddd61190050090279cd0f9,00.html

Cheers
K
Live long and prosper