1834020 Members
3127 Online
110063 Solutions
New Discussion

Sar Question

 
SOLVED
Go to solution
Robert Smith_1
New Member

Sar Question

Fellow Admins,

This is something I think I should know but it has been giving me a problem. I am trying to run SAR as a Cron job to collect performance data. Here is the cron entry:

5 18 * * 1-5 /usr/lbin/sa/sa2 -s 8:00 -e 18.01 -i 1800 -u -b -d -w -q

But this is the e-mail I get everday:

sar: Can't open /var/adm/sa/sa06
*************************************************
Cron: The previous message is the standard output
and standard error of one of your crontab commands:

/usr/lbin/sa/sa2 -s 8:00 -e 18.01 -i 1800 -u -b -d -w -q

I looked at the file permissions and that looks good, I even tried to create the files ahead of time and that didn?t work. What am I missing? Thanks in advance.

Robert Smith
Systems Administrator
Biomatrix Inc.
(201) 945-9550
But it was working 5 minutes ago!!!!!
7 REPLIES 7
Elizabeth_2
Valued Contributor

Re: Sar Question


Hi Robert,


The sar program is looking for the binary file /usr/adm/sa/saXX, where XX
is the current date of the month. To create this file, do the following:

/usr/lib/sa/sadc /usr/adm/sa/sa`date +%d`

Kofi ARTHIABAH
Honored Contributor

Re: Sar Question

Robert:

make sure that the directory /var/adm/sa has been created. It isn't created by default - you have to create it:

mkdir -p /var/adm/sa

viola!
nothing wrong with me that a few lines of code cannot fix!
Elizabeth_2
Valued Contributor

Re: Sar Question


Sorry Robert... Here is the correct path:

/var/adm/sa/saXX, when XX is the current month.

You will need to create the file by:
/var/lib/sa/sadc /var/adm/sa/sa`date +%d`

Paula J Frazer-Campbell
Honored Contributor
Solution

Re: Sar Question

Hi

This script runs sar every 5 min (300 seconds) for 10 hours
I start it at 08:00 hrs each morning
-----------------------Cut here--------------------------------
#!/bin/sh
# sardump
# 5 minutes
period=${1:-"300"}
# 10 hours worth
iterations=${2:-"120"}

echo "sar: $iterations iterations at $period second intervals"
/usr/sbin/sar -ubdcvwq
-o /var/adm/sa/sa`date +%d`
$period
$iterations > /dev/null
-----------------------Cut here--------------------------------


Crontab entry is :-

00 08 * * * /sardump

Modify the switches to suit.

HTH
Paula
If you can spell SysAdmin then you is one - anon
CHRIS_ANORUO
Honored Contributor

Re: Sar Question

Hi Robert,

There is a mistake in your cron, your start is 8.00 and stop is 18.01 for Monday to Friday. So you cann't set the cron time for 18.05.
Anyway, create the /var/adm/sa directory, then update your cron file as follows:
0 6-22 * * * /usr/lbin/sa/sa1 1200 4
30 18 * * * /usr/lbin/sa/sa2 -s 00:00 -e 20:00 1800 -u -b -d -w -q
When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
Rick Garland
Honored Contributor

Re: Sar Question

You need the /var/adm/sa directory.

Can do a mkdir for that directory.
Brad Marks
Super Advisor

Re: Sar Question

Robert,
FYI, the XX in "var/adm/sa/saXX" is not the current monthname but the day of the month. SAR will maintain only 31 of these files, overwriting the previous month's day with the current month's day giving you a backlog of one month's data.
Just making sure, the problem you were having was that cron was not looking in
/var/adm/sa.
It's not impossible -- it'll just cost more...