Operating System - HP-UX
1834090 Members
2102 Online
110063 Solutions
New Discussion

Polling intervals in sar.

 
SOLVED
Go to solution
fg_1
Trusted Contributor

Polling intervals in sar.

Hello all

I am trying to figure out how to get the output of my data files to have 30 minute intervals instead of 5 minute intervals which are being written to each of the output files.

I have a script which is gathering a series of sar commands and putting them to seperate files. I am running this from cron and it is taking the information from the /var/adm/sa/sa## file each day. The output files are being listed in 5 minute intervals.

So what I am trying to figure out is where to write in the script that I want a 30 minute listing and not a 5 minute listing.

Attached is a sample output file, listed here are the cron entries and then the script itself.

TY in advance:

Cron entries:
00,15,30,45 * * * * /usr/lbin/sa/sa1 600 6 &
59 23 * * * /home/fgrosb01/sardump/sar.dump > /dev/null

Script: sar.dump

#!/usr/bin/ksh -v
#
# This script is being developed to provide a detailed report of the daily performance
# statistics regarding several different areas of the system.
# This script must be executed utlizing the root user account.

# Environmental section

set -u

BASEDIR=/home/fgrosb01/sardump
DATE=`date +%m/%d/%Y`
YDATE=`TZ=CST+24 date +%m/%d/%Y`
SCRIPT_EXECUTION_TIME=$(date +'%H:%M:%S')
SCRIPT_REVISION="HPUX-b.11.00.01"
SCRIPT_HPUX_VERSION=$(uname -r)
SCRIPT_SYSTEM=$(uname - n)
SCRIPT_USER=$(whoami)
SCRIPT_EXECUTION_TIME=$(date +'%Y/%m/%d/%H:%M:%S')

echo $SCRIPT_SYSTEM \(Version $SCRIPT_REVISION\) $SCRIPT_EXECUTION_TIME
echo _____________________________________________________________________
echo

if [ ${SCRIPT_USER} != "root" ] ; then
echo
echo "This program must be executed utilizing the root logon id only"
echo
return 501
fi
echo _______________________________________________________________________

# Remove old data files

cd $BASEDIR
rm *_act

# Collect CPU
sar -u >> $BASEDIR/cpu_act
#
# Collect Buffer activity
sar -b >> $BASEDIR/buff_act
#
# Collect TTY activity
sar -y >> $BASEDIR/tty_act
#
# Collect System calls
sar -c >> $BASEDIR/call_act
#
# Collect Swap activity
sar -w >> $BASEDIR/swap_act
#
# Collect File access activity
sar -a >> $BASEDIR/acc_act
#
# Collect average Q lenght
sar -q >> $BASEDIR/avq_act
#
# Collect Table activity
sar -v >> $BASEDIR/tab_act
#
# Collect Message and Semaphore activity
sar -m >> $BASEDIR/sem_act
#
# Collect Multi processor activity
sar -M >> $BASEDIR/proc_act
#
# Disk space
/usr/bin/bdf >> $BASEDIR/bdf_act
#
# Paging
vmstat -s| grep "pages swapped in" >> $BASEDIR/inpages_act
vmstat -s| grep "pages swapped out" >> $BASEDIR/outpages_act

5 REPLIES 5
fg_1
Trusted Contributor

Re: Polling intervals in sar.

oops forgot to attach one of the output files:
Chris Wilshaw
Honored Contributor
Solution

Re: Polling intervals in sar.

If you change

00,15,30,45 * * * * /usr/lbin/sa/sa1 600 6 &

to

0 * * * * /usr/lib/sa/sa1 1800 2 &

That will run sar at intervals of 1800 seconds (30 minutes).
Darren Prior
Honored Contributor

Re: Polling intervals in sar.

Hi Frank,

According to the man page for sa1 (1M)the first parameter is the interval between samples in seconds, hence you will need to change this value to 1800. It's worth reading the man page for more info on setting up the cronjobs.

regards,

Darren.

---quote your cron entry---

00,15,30,45 * * * * /usr/lbin/sa/sa1 600 6 &
59 23 * * * /home/fgrosb01/sardump/sar.dump > /dev/null

---end quote---
Calm down. It's only ones and zeros...
fg_1
Trusted Contributor

Re: Polling intervals in sar.

Ok guys

I have changed that parameter at the end of the sa command to reflect the following:

0 * * * * /usr/lbin/sa/sa1 1800 2 &

What i am seeing is that the output files are still being written in 5 minute intervals and that this process is still running. The ps is listed below:

ps -ef|grep sa1
root 11912 1 0 11:26:00 ? 0:00 /usr/lbin/sa/sadc 1800 2 /var/adm/sa/sa18

The question here is whether or not I have to alter any entries in my script where it does the individual sar's or is it the fact that I wont see any results until the end of the day, or at what point should I see results?

Thanks again.
Chris Wilshaw
Honored Contributor

Re: Polling intervals in sar.

Any data already collected would remain intact. Only data collected since the change to the cron job will be at half hourly intervals.