filtering and sending sar output via email


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting filtering and sending sar output via email
# 1  
Old 01-19-2010
filtering and sending sar output via email

We have a program which create sar output files which has a weeks data...
To read file we use sar -f sa15 command which has multiple days data( a weeks data)....we need to only get last 48 hours data and email it to different users....

I guess we can use combination of sar -o or even awk. Please help
# 2  
Old 01-19-2010
Please post:
Operating system and version.
Exact crons which are doing the data collection.

If this is unix, I strongly suspect that you are running "sa1" but not running "sa2" (or running some other way of causing rotation of the sar "sann" data files).
When set up correctly your sar data file for the 15th of the month "sa15" should only contain 24 hours data. Without proper maintenance these files grow and the content becomes meaningless (in your case "sa15" probably contains contaconated data for every 15th of the month rather than consecutive days data).
Beware that "sa2" on many systems only keeps 7 days data and you will need to either change "sa2" (it is a shell script), or write something better that suits your situation, and/or make external provision to save the sar "sann" data files. The "sa2" script also stores a human-readble report of the "sann" files which may or may not be useful.
Well worth planning what information you want from the system then configuring the "sar" package to your requirements.

See "man sadc"
# 3  
Old 01-19-2010
In my home directory in server , you will find a file called sa15 that contains sar data

To read this file, run:
sar -f sa15


We will need to parse the output, send last 48 hrs of data and email it....

This is the requirement.

Please could you write a sample program.


(Means that awk is what we need to parse, and by combining it with ksh we can email whatever you want)

Your help would be appreciated
# 4  
Old 01-19-2010
Quote:
Originally Posted by noorm
In my home directory in server , you will find a file called sa15 that contains sar data

To read this file, run:
sar -f sa15


We will need to parse the output, send last 48 hrs of data and email it....

This is the requirement.
[...]
This sounds suspiciously like homework. And given that you already have a, as of yet uncontested, homework violation chalked up against you, I'm very much inclined to treat this one the same way. Unless you can provide information that indicates otherwise.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sending sql output to email body with conditional subject line

hi , i have written below piece of code to meet the requirement but i am stuck in the logic here. the requirement are: 1) to send the sql out put to email body with proper formatting. 2) if count_matching = Yes then mail should triggered with the subject line ... (10 Replies)
Discussion started by: itzkashi
10 Replies

2. Red Hat

Sar output

I am facing situation where sar -u command is showing 0 for all cps, so does it mean all the cpus are fully utilized, os is oracle Linux 6.8 01:34:13 PM all 0 0 0 0 0.00 0 (2 Replies)
Discussion started by: manoj.solaris
2 Replies

3. Solaris

Odd output from sar

We're experiencing some intermittent freezes on one of our systems and I'm trying to figure out what is happening. We're running Solaris 10 zones mounting shares from netapp through nfs. On the zone that freezes we have sar running and are getting this output: SunOS prodserver 5.10... (3 Replies)
Discussion started by: Jyda
3 Replies

4. UNIX for Advanced & Expert Users

Need help with sendmail email filtering on FreeBSD

Hi All, Sorry, for the double posting. Don't know how to move to a different forum. I am very new to Unix. I have a test server running FreeBSD 10.1 and SendMail 8.14.9. I need to filter incoming emails based on the sender's email address or domain and forward them to another address on a... (1 Reply)
Discussion started by: simplemind
1 Replies

5. Solaris

sar output

One of my servers giving all zero sar output. Could anyone explain this behaviour. Thanks CHaandana Sample: 10:43:37 %usr %sys %wio %idle 16:15:01 2 1 0 97 16:20:02 2 1 0 97 16:25:02 2 1 0 97 16:30:01 ... (3 Replies)
Discussion started by: chaandana
3 Replies

6. Shell Programming and Scripting

Using top command to email if process is exceeding 25% and sending an email alert if so

This is my first time writing a script and Im having some trouble, Im trying to use the top command to monitor processes and the amount of CPU usage they require, my aim is to get an email if a process takes over a certain percentage of CPU usage I tried grep Obviosly that hasnt worked, Any... (8 Replies)
Discussion started by: jay02
8 Replies

7. AIX

Sending script output as email

Hi i have a script which executes daily through cron. The output of the script is appended to a log file everyday It also emails me the output of the logfile as we have the mailx command in the script The below is my requirement : Normally When I get the email it sends the entire content... (3 Replies)
Discussion started by: newtoaixos
3 Replies

8. Solaris

Strange sar output

I was reviewing yesterday's sar file and came across this strange output! What in the world? Any reason why there's output like that? SunOS unixbox 5.10 Generic_144488-07 sun4v sparc SUNW,T5240 Solaris 00:00:58 device %busy avque r+w/s blks/s avwait avserv 11:20:01 ... (4 Replies)
Discussion started by: dangral
4 Replies

9. Shell Programming and Scripting

sending output of command via email

Hi all i want to send the output of a command by email, i have done this <comand> | mail -s <subject> <email address> which works well, but if the command retunrs noting then i just get a blank email, is there a way to stop this thanks Adam (4 Replies)
Discussion started by: ab52
4 Replies

10. Solaris

extraction of sar output

Hi, Anyone knows how to extract sar command output to excel or Is there any free grapical tools to extract this sar log file. thanks, regards (2 Replies)
Discussion started by: vijill
2 Replies
Login or Register to Ask a Question