1838804 Members
5290 Online
110130 Solutions
New Discussion

Creating sar report

 
Saneesh S
Advisor

Creating sar report

when I give following command to create sar report with 5 secs interval and for 12 hrs. and redirect it to one out put file the file gets created of 0 byte.why?

sar -ud 5 8640 > /tmp/sar23

what do u mean by

/usr/lbin/sa/sa2 -s 8:00 -e 18:00 -i 3600 -A

Is this mean I will get reports for the period
from 8:00 am to 18:00 pm and what this -A option does.

5 REPLIES 5
bhavin asokan
Honored Contributor

Re: Creating sar report

hi,

sar format is like this

for creating a sar report file for 10 minutes
with 1 min intervels.

sar -o /tmp/sa123 60 10


in your case it is

sar -o /tmp/sa123 5 144 &

(as 12 hours is (60/5)*12 intervels)

regds,
bhavin asokan
Honored Contributor

Re: Creating sar report

hi,

sorry for error in old reply.

for 12 hours it is (60/5)*60*12 ie. 8640 only

to view output

sar -d -f /tmp/sa123 (for disk)
sar -u -f /tmp/sa123 (for cpu)


Review cpu utilization on a multi-processor system later:

sar -u -M -f /tmp/sa123


regds,
Sunil Sharma_1
Honored Contributor

Re: Creating sar report

Hi,

you can use

sar -u -s -e -i -f


the option -A in sa2 is same as -A in sar it stand for report all data.

Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
OldSchool
Honored Contributor

Re: Creating sar report

Saneesh S ,

I run this canned script on my servers:


#! /usr/bin/sh
# Script for collecting System Activitey Reports
# Ran from the cron as:
# 0 0 * * * /usr/sbin/sar_all -u -d 900 96
#
HOSTNAME=`hostname`
DATE=`date +%Y%m%d`
RPT=/var/adm/sa/sar-$HOSTNAME-$DATE
DFILE=/var/adm/sa/sar-$HOSTNAME
ENDIR=/usr/sbin
cd $ENDIR
$ENDIR/sar $* -f $DFILE > $RPT

_____________________________________
This outputs the information every 15 minutes for a 24 hour period. When it completes the 24 hour period it provides me with the averages for the period.

You will probably have to create the dir /var/adm/sa/

Hope this helps you out.

Tom
Rick Garland
Honored Contributor

Re: Creating sar report

As mentioned, the -A reports ALL

Attached you will find a sar reporting script that I have been using for a long time. It will report with the various options of sar at 300 second intervals - you may want to adjust this to fit your needs. This script runs in conjunction with the sar commands as listed in the cron (below).

To start I have this entry in the cron to gather the binary data for the day.
0,15,30,45 * * * * /usr/lib/sa/sa1

This other cron entry will run at the end of a day and parse through the binary format to produce ASCII output.
# sar data collection
56 23 * * * /var/adm/sa/get_sars 2>&1 > /dev/null


You will want to keep tabs on the dir size as this method does not overwrite previous month's data.