1833707 Members
2258 Online
110063 Solutions
New Discussion

SAR output (ASCII)

 
Mike Keys
Regular Advisor

SAR output (ASCII)

Is it possible to run sar via a cron job and have the output written to an ASCII compatible file. I woul like to capture the sar data and ship to someone else. I realize that it is written as binary and that I can review the old logs.
5 REPLIES 5
Alex Lavrov.
Honored Contributor

Re: SAR output (ASCII)

AFAIK sar's output is ascii ... You can put some script in crontab that runs sar and redirecting the output into the file.

Just "man sar" to see all the options and that's it. Hmm, why did you think it outputs binary data or am I missing somethin?
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Steven E. Protter
Exalted Contributor

Re: SAR output (ASCII)

I've posted a series of sar scripts that does that very thing.

Here is a copy attached.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Rick Garland
Honored Contributor

Re: SAR output (ASCII)

There are many different options to getting results from sar.

Here is one that will produce results from CPU, buffers, swap, IO, etc...

Whatever you think of.

Listed below is the cron entry. This is producing the binary output.

# will produce output every 20 min during work hours
# and hourly otherwise
#0 * * * 0,6 /usr/lbin/sa/sa1
#0 7-18 * * 1-5 /usr/lbin/sa/sa1 1200 3
#0 19-6 * * 1-5 /usr/lbin/sa/sa1


Attached is a script that will parse and convert the binary output into ASCII output.

Notice this script will create and keep all stats by day. Up to you to make sure to rotate the files.


Cem Tugrul
Esteemed Contributor

Re: SAR output (ASCII)

Hi Mike,

take a look my attachment about "Check system
activity with sar"

Good Luck,
Our greatest duty in this life is to help others. And please, if you can't
Pete Randall
Outstanding Contributor

Re: SAR output (ASCII)

Mike,

You need to take a look at the man page for sa1. The sadc, sa1, sa2 suite is setup to do exactly what you're after.


Pete

Pete