1830939 Members
2764 Online
110017 Solutions
New Discussion

Sar Utility

 
SOLVED
Go to solution
Ian Derringer
Regular Advisor

Sar Utility

Hi,
I am running RHAS 3.0 64-bits and my server is missing 'sar' utility. Would someone please direct me to where I can download this rpm file for my server?

Thank you in advance.

Ian
18 REPLIES 18
Alex Lavrov.
Honored Contributor
Solution

Re: Sar Utility

You need "sysstat" rpm. I believe this one will do it:

sysstat-5.0.5-5.rhel3.src.rpm

http://linuxsoft.cern.ch/repository/ia64updates/sysstat-5.0.5-5.rhel3.ia64.html

But you can search for another hardware archeture, if it's not good enough.

It's src rpm, so you'll have to build rpom from it, this is how you do it:

rpmbuild --rebuild
and then, install it:
rpm -Uvh
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Gopi Sekar
Honored Contributor

Re: Sar Utility


this utility is part of sysstat rpm. it should be available in first or second cd of your RH cd set.
Never Never Never Giveup
Vipulinux
Respected Contributor

Re: Sar Utility

Alex Lavrov.
Honored Contributor

Re: Sar Utility

Vipul,
why to install old rpm for rh9.1?

There is a new version for redhat enterprise .....
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Ian Derringer
Regular Advisor

Re: Sar Utility

Also, I am running RHAS 3.0 64-bits version as well.

Thanks,
Ian Derringer
Regular Advisor

Re: Sar Utility

Many thanks to Alex for pointing me to the right direction. Now, I have the systats installed. I need help to write a quick batch job to do sar -B or iostats at every 15 mins. Would someone please help!!

Thank you in advance.

Ian
Alex Lavrov.
Honored Contributor

Re: Sar Utility

Just put this command in crontab (man crontab) and redirect the output to some file:

sar bla bla bla >> /tmp/sar.log


That's it.



(Btw, you can also assign some points to the ppl that helped you!)
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Ian Derringer
Regular Advisor

Re: Sar Utility

Great! Does it keep multiple versions out there or something I have to do to give it a new name every time it runs?? If yes, what would be the easiest way to do that?

Thanks so much!!

Ian
Alex Lavrov.
Honored Contributor

Re: Sar Utility

if you use ">>", it appends to the file. It does not remove it, so you'll see output one after another. To make it more clear you can do this in the script:

output_file="/tmp/blalba.log"
now_date=`date`

echo "============ $now_date ===========" >> $output_file
sar bla bla bla >> $output_file
echo "==================================" >> $output_file

So, you'll see in the file somthing like this:

============= 20/5/2005 14:35:23 ===========
bla bla bla
bla bla bla
============================================

============= 20/5/2005 14:50:23 ===========
bla bla bla
bla bla bla
============================================

and so on ....

I don't give a damn for a man that can only spell a word one way. (M. Twain)
Ian Derringer
Regular Advisor

Re: Sar Utility

Alex,
I am getting an EOF error after I tried running the script. Any ideas?

Thanks,
Ian
Alex Lavrov.
Honored Contributor

Re: Sar Utility

Can you attach the script you are trying to run? Probably some error in syntax.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Ian Derringer
Regular Advisor

Re: Sar Utility

Here it is:

./perfmon_stats: line 13: unexpected EOF while looking for matching `"'
./perfmon_stats: line 17: syntax error: unexpected end of file


Script:
# !/bin/bash
. $HOME/.bash_profile
#############################################
clear
output_file="/tmp/perfmon.log
now_date=`date`
echo " "
echo "--------------------------- $now_date -------------------------" >> $output_file
sar -b >> $output_file
EOF
exit


Thanks,
Ian
Ian Derringer
Regular Advisor

Re: Sar Utility

Hi,
Don't worry...I got it to work. Hopefully, I can setup the cron tab to run every 15 minutes or so.

Thanks,
Ian
Raimo Lesonen_1
Advisor

Re: Sar Utility

Put a line like this in your crontab:
0 7-16 * * 1-5 /usr/lib/sa/sa1 300 12 &

This will collect all sar-data into daily files in /var/log/sa-directory. Then you can later get some historical data using
sar [ options... ] -f /var/log/sa/saxx.
Gopi Sekar
Honored Contributor

Re: Sar Utility


the problem is variable declaration of $output_file, double quote is not closed

to make it run every 15 mins all through the year, following is the crontab entry

*/15 * * * * performance_script

Hope this helps,
Gopi


Never Never Never Giveup
Ian Derringer
Regular Advisor

Re: Sar Utility

This is what my crontab looks like:
*,5 * * * * /home/admin/sysmon/perfmon_stat root 1>/dev/null 2>&1
*,5 * * * * /home/admin/sysmon/
perfmon_stat_2 root 1>/dev/null 2>&1

However, it's executing every 1 minute - What
s with that?? Help!!


Thanks,
Ian

Alex Lavrov.
Honored Contributor

Re: Sar Utility

You have a mistake there, instead of "*,5" put as it was said "*/15" and it will work.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Ian Derringer
Regular Advisor

Re: Sar Utility

Got it!!

Thanks everyone!

Ian