Filter data and send email


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Filter data and send email
# 8  
Old 01-25-2010
Customers specifying solutions rather than giving requirements is never good!

If you are getting sar data once an hour rather than every 20 minutes then you can do the maths to see hour many lines of data you want...

Otherwise I will hand over to cfajohnson's far better scripting abilities than mine.
# 9  
Old 01-27-2010
The update to the script knowing that a line of data is added every hour is:
Code:
sar -f sa15 | grep -v Average | grep -v "^$" | grep -vi restart | grep -v System | grep -v AIX | tail -48 > sa15.$$
mailx -s "Last 48 hours sar data at `date`" user@domain.com < sa15.$$
rm sa15.$$

# 10  
Old 01-27-2010
Quote:
Originally Posted by TonyFullerMalv
The update to the script knowing that a line of data is added every hour is:
Code:
sar -f sa15 | grep -v Average | grep -v "^$" | grep -vi restart | grep -v System | grep -v AIX | tail -48 > sa15.$$
mailx -s "Last 48 hours sar data at `date`" user@domain.com < sa15.$$
rm sa15.$$


Please read the grep man page; look at the -e option.
# 11  
Old 01-28-2010
I hope that this is the current thread (of many) for this topic.

To my mind the key point is in this statement from O/P. I could be wrong.

Quote:
---- Reply is----
The assumption and calculation are not correct. You must look at the top line where you have the starting date.
next lines have starting time. Use both of these pieces for info. Sar file will not contain 48 hours of data-----
This ties up with my assumption that this is an incorrectly set up "sar" data collection and that there are multiple occurances of the day of the month appended into the sar(nn) data file. There is a strong hint in the quote above that you need to process more than one day file.
Depending on what time of day the report is run it would take two (or three) of these sar data files to get 48 hours data. This is further complicated at month boundaries. It is much too complicated to process in retrospect and requires some forward planning. If my guess is correct the sa(nn) files will grow as more data is appended.

A logical approach would be to prepare one day's summary data at the end of each day in a file named after the date in the sar heading. It is then a case of mailing the most recent two files concatonated.

Last edited by methyl; 01-28-2010 at 02:11 PM.. Reason: Typos
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. SuSE

Send outgoing email to my GroupWise email

Dear users, I have Linux server whose versions are Suse 10 SP 3 and Suse 11. I am trying to send email from these servers to my GroupWise email account. In /etc/postfix/main.cf file, The current value of MYHOSTNAME is LINUX.LOCAL. What should be the right value of MYHOSTNAME? Is... (0 Replies)
Discussion started by: JDBA
0 Replies

2. Shell Programming and Scripting

Shell scripting unable to send the sql query data in table in body of email

I have written a shell script that calls below sql file. It is not sending the query data in table in the body of email. spool table_update.html; SELECT * FROM PROCESS_LOG_STATS where process = 'ActivateSubscription'; spool off; exit; Please use code tags next time for your code and data.... (9 Replies)
Discussion started by: Sharanakumar
9 Replies

3. UNIX for Dummies Questions & Answers

new to ldap, send email to a ou or group, and see a list from email client

hi, i'm running openldap on ubuntu 10.04, creating new items with apache directory studio (windows version). i use the ldap just as an address book to our small office (email clients are windows live mail 2009, 2011, microsoft outlook 2007 and 2010). a. i cant see a list of the contacts,... (0 Replies)
Discussion started by: V4705
0 Replies

4. Shell Programming and Scripting

Script to send email after comparing the folder permissions to a certain permission & send email

Hello , I am trying to write a unix shell script to compare folder permission to say drwxr-x-wx and then send an email to my id in case the folders don't have the drwxr-x-wx permissions set for them . I have been trying to come up with a script for few days now , pls help me:( (2 Replies)
Discussion started by: nairshar
2 Replies

5. Shell Programming and Scripting

Combining header and data and send email without usage of temp file

Dear All- My requirement is as below- Header file $ cat HEADER.txt RequestId: RequestDate: Data file $ cat DATAVAL.txt 1001|2009-03-01 I need to send the combined data below as email body via mailx command ------------------ RequestId:1001 RequestDate:2009-03-01 I would like... (4 Replies)
Discussion started by: sureshg_sampat
4 Replies

6. Solaris

Send an email from Solaris using Linux email server

Hello everyone I have a problem and I need your help: I have a Solaris 10 and Solaris 8 UNIX Servers, and Linux Centos4 as email server. I need send an email from Solaris servers preferably using Centos4 email server. I have no mail service configured in my Solaris computers (1 Reply)
Discussion started by: aflores
1 Replies

7. UNIX for Dummies Questions & Answers

Send email where # is in the email address - Using Unix

Hi All, How do I send an email using malix where email address contains a #. I have a email address like this : #test@test.com I want to send email like malix -s "TEST" #test@test.com < SOMEFILE I tried \# but doesn't work. Please let me know how we can achieve this? I am in... (1 Reply)
Discussion started by: jingi1234
1 Replies

8. UNIX for Advanced & Expert Users

Unable to send eMail from a UNIX-Host ( using mailx ) to a Outlook-email-addres(Win)

Hi A) I am able to send eMail using mailx from a UNIX ( solaris 8 ) host to my Outlook-email-ID : FName.Surname@Citigroup.com ( This is NOT my actual -eMail-ID). But in Outlook the "From :" eMail address is displayed as " usr1@unix-host1.unregistered.email.citicorp.com " .i.e the words... (2 Replies)
Discussion started by: Vetrivela
2 Replies
Login or Register to Ask a Question