emails using sar or parsar commands


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting emails using sar or parsar commands
# 1  
Old 08-03-2010
emails using sar or parsar commands

Hi,

I am using a script to send email from parsar / sar command for, if there is a specific value for CPU usage. If condition is not working but I can see the variable declared in echo command

I am using following script for send email from parsar command, If I comment if and then line then echo is working but script is not working with if and else condition

Code:
parsar --peakonly --daily > peakonly_daily
result1=$(grep "6.9"  peakonly_daily)
if [ "$result1" = "6.9" ];
then
              echo $result1
#mail -s "Web-03: Daily and Peakonly Utilization of Memory and CPU" xyz@email.com < peakonly_daily
fi;

content of peakonly_daily is as follow:

Code:
================================================
TIMESTAMP     CPU%   IOWAIT%    MEM USED    MEM FREE     SWAP USED
---------     ----   -------    --------    --------     ---------
07/26:peak     5.4       3.7     3093.4M     6551.6M         74.6M
07/27:peak     6.9       3.6     4076.4M     6689.8M         74.6M
07/28:peak     6.0       3.6     4076.1M     6445.4M         74.6M
07/29:peak     5.3       3.7     2122.8M     6666.6M         74.6M
07/30:peak     8.8       3.6     3702.1M     6667.9M         74.1M
07/31:peak     5.3       4.1     2700.9M     5897.9M         74.1M
08/01:peak     5.7       3.8     2717.2M     6017.6M         74.1M
08/02:peak     6.7       3.8     4723.9M     6074.6M         74.1M
================================================


can any one help me to resolve this issue

Regards
Asif Shams

Last edited by pludi; 08-03-2010 at 06:32 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

What is the relation between values from TOP and SAR commands?

Hi, Please have a look at the look at the below top and sar commands. top -bn1 | grep load | awk '{printf "CPU Load: %.2f\n", $(NF-2)}' CPU Load: 0.52 sar -u 1 1 Linux 3.10.0-514.16.1.el7.x86_64 (mymac) 06/01/2017 _x86_64_ (2 CPU) 03:27:40 PM CPU %user %nice ... (1 Reply)
Discussion started by: mohtashims
1 Replies

2. Solaris

Emails issue

Dear all, I am facing an issue in my data Center environment related to mails being generated by users on my machines. Let me walk you through the issue one by one. Each system (100+ servers in my DC) has a user sysmon on it that sends mails to a specific Email ID. The user runs scripts... (8 Replies)
Discussion started by: Junaid Subhani
8 Replies

3. Shell Programming and Scripting

extracting emails from a file

i have a large html file that has emails like something@domain.com and somethingdomain.com how can i print the emails? its fine if duplicates show up and it doesnt need to save into a file or anything, just whatever is the easiest way to make some basic code for this thanks! :) (2 Replies)
Discussion started by: vanessafan99
2 Replies

4. UNIX for Dummies Questions & Answers

send emails

hi guys I need to send emails to some accounts 1. I need sendmail up and running right? 2. I need my local sendmail to use an existing SMTP server to send emails (10.x.x.x)? in that case what I need to configure to send emails? since using mail myaccount@companyame.com is not sending emails... (3 Replies)
Discussion started by: karlochacon
3 Replies

5. UNIX for Dummies Questions & Answers

Combining two commands that use sar.

hey can anyone tell me how can i combine these two commands so that it is executed only once, but gives me both the results. IDLE=`sar 30 6 | grep Average | awk '{print $1 $5}' ` sar 30 120 | awk '{print $1" "$5}' >> mailx -m -s "$MSG" xyz@abc.com. (5 Replies)
Discussion started by: Ankur Khatri
5 Replies

6. UNIX for Dummies Questions & Answers

Emails on HP-UX

Hi Guys I am running Oracle database on HP-UX, every now and then I get emails that are sent to me by root. When check with the sysadmin know one have a clue as to where does the emails come from. I need to stop this emails...how do I check which script is sending me the emails. Thanks ... (0 Replies)
Discussion started by: Phuti
0 Replies

7. UNIX for Dummies Questions & Answers

duplicate emails

Hi all new here. Question. My mail server is sending out duplicate emails but its not system wide. We have several virtual host that use our email server and some are having the duplicate emails issue and some are not. For example in the office some people are getting duplicate emails but i am... (1 Reply)
Discussion started by: mcraul
1 Replies

8. UNIX for Dummies Questions & Answers

Creating emails

Hi, I posted here 2 months ago, saying I wanted to learn UNIX for my work running a small ISP. I had the problem of practically no technical support for our system. Many courses later, I can just about do everything I need to do. The server is a FreeBSD i386. I can now create email accounts for... (4 Replies)
Discussion started by: ferret495
4 Replies

9. UNIX for Dummies Questions & Answers

UNIx junk emails

HI, I schedule some programs and mail the reports as attachments But one of the attachment always is directed to junk email folder.Is there any way to avoid it in UNIX. My mail server is outlook. Thanks, Sireesha (6 Replies)
Discussion started by: sireesha15
6 Replies

10. UNIX for Advanced & Expert Users

Commands on Digital Unix equivalent to for "top" and "sar" on other Unix flavour

Hi, We have a DEC Alpha 4100 Server with OSF1 Digital Unix 4.0. Can any one tell me, if there are any commands on this Unix which are equivalent to "top" and "sar" on HP-UX or Sun Solaris ? I am particularly interested in knowing the CPU Load, what process is running on which CPU, etc. ... (1 Reply)
Discussion started by: sameerdes
1 Replies
Login or Register to Ask a Question