issues with sar command on Red Hat Enterprise Linux Server release 5.3 (Tikanga)

Hi,

when I run the sar command I get the following

[root@xxxx ~]# sar -d
Requested activities not available in file


but sar -d 5 1 works

what's the difference in these options


Also instead of just one month of sar files how can I have 3 years of sar files ?
anshumaEngineeringAsked:
Who is Participating?
 
farzanjConnect With a Mentor Commented:
It is version specific.  Newer version work differently.

On RHEL4, sar -d gave the entire data plus the averages.
On the newer versions, you have to give the number of iterations and time between iterations.

Now if you do

sar -d <Time In Seconds> <Number of Iterations>

This would show you data and then average in the last iteration.

You need to have data in your sar logs for 3 years to be able to see it.
It mostly logs in /var/log/sa/ folder.  You can check how far it goes in your system.

0
 
wesly_chenConnect With a Mentor Commented:
Which sar version do you use?
$ rpm -q sysstat

My vesrion is
sysstat-7.0.2-3.el5.x86_64

and I kept one month of data and
# sar -d
# sar -d 5 1
all works for me.

You might want to upgrade sysstat package first.
0
 
NopiusConnect With a Mentor Commented:
>Also instead of just one month of sar files how can I have 3 years of sar files ?

Start logging your data and keep it for next 3 years...

Say, run this command (it runs continuously) from one of rc.d scripts:
sar -o /var/log/sa/sar.log -d 5 0 > /dev/null

then rotate log file (create /etc/logrotate.d/sa) with the following lines:

/var/log/sa/sar.log {
  missingok
  daily
  rotate 1095
  compress
}

Open in new window



Regards,
Arty
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
joolsConnect With a Mentor Commented:
You have to configure sar to log device data, it doesnt do it in the base configs.

sar -d 5 1 works because you're running it from the command line, not trying to extract the archive information from the collected data.

The cron entries in /etc/cron.d (at least on my system) use sa1 and sa2
If you want to add -d logging, edit /usr/lib/sa/sa1 and add it to the exec code, see below.
#!/bin/sh
# /usr/lib/sa/sa1.sh
# (C) 1999-2006 Sebastien Godard (sysstat <at> wanadoo.fr)
#
umask 0022
ENDIR=/usr/lib/sa
cd ${ENDIR}
if [ $# = 0 ]
then
# Note: Stats are written at the end of previous file *and* at the
# beginning of the new one (when there is a file rotation) only if
# outfile has been specified as '-' on the command line...
        exec ${ENDIR}/sadc -d -F -L 1 1 -
else
        exec ${ENDIR}/sadc -d -F -L $* -
fi

Open in new window

0
 
joolsCommented:
forgot to mention, you probably need to restart sysstat;

# service sysstat restart
0
 
anshumaEngineeringAuthor Commented:
thank you experts
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.