Sponsored Content
Full Discussion: Counting Errors
Top Forums Shell Programming and Scripting Counting Errors Post 302266768 by himvat on Thursday 11th of December 2008 02:39:48 AM
Old 12-11-2008
Counting Errors

Hi ,

I am trying to make a script which can count the errors in the log each time it scans. When ever it scans & counts the errors, it should do the comparison with the last count.

If the number is > than last time, you have errors.
If the number is < last time, ignore (new log file).
If the number is = last time, no change.


&

If errors <= 5 then WARN
If errors > 5 then ERROR


I have prepared the below given script ,,,but some how it is not working .
Kindly guide me , what is wrong with this script.

#!/bin/sh
tail -f sample_file.log > a.log
fCOUNT = grep ERROR a.log | wc -l
while (1)
do
iCOUNT= grep ERROR a.log | wc -l
COUNT=$(($fCOUNT -$iCOUNT))
if ($COUNT -eq 0) then
exit(1)
elif ($COUNT -le 5 ) then
echo "WARNING"
elif ($COUNT -gt 5) then
echo "ALERT"
fi
sleep 10
done


Regards
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Adapter Errors and Link Errors

$ errpt | more IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION 3074FEB7 0802050205 T H fscsi1 ADAPTER ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR 3074FEB7 0802050205 T H fscsi0 ADAPTER ERROR B8113DD1 ... (0 Replies)
Discussion started by: mcastill66
0 Replies

2. AIX

Adapter Errors and Link Errors

$ errpt | more IDENTIFIER TIMESTAMP T C RESOURCE_NAME DESCRIPTION 3074FEB7 0802050205 T H fscsi1 ADAPTER ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR B8113DD1 0802050205 T H fcs1 LINK ERROR 3074FEB7 0802050205 T H fscsi0 ADAPTER ERROR B8113DD1 ... (2 Replies)
Discussion started by: mcastill66
2 Replies

3. UNIX for Dummies Questions & Answers

Major OS errors/Bash errors help!!!!

Hi all, dummy here.... I have major errors on entering the shell. On login I get: -bash: dircolors: command not found -bash: tr: command not found -bash: fgrep: command not found -bash: grep: command not found -bash: grep: command not found -bash: id: command not found -bash: [: =: unary... (12 Replies)
Discussion started by: wcmmlynn
12 Replies

4. Shell Programming and Scripting

Counting with Awk

I need "awk solution" for simple counting! File looks like: STUDENT GRADE student1 A student2 A student3 B student4 A student5 B Desired Output: GRADE No.of Students A 3 B 2 Thanks for awking! (4 Replies)
Discussion started by: saint2006
4 Replies

5. Shell Programming and Scripting

counting users?

Is it possible to count the number of users? or specifically emac users? I know that you can count certain file sizes, like find /usr/bin/ -size 11k -exec ls {} \;|wc -1 but how would I count users? (3 Replies)
Discussion started by: gordonheimer
3 Replies

6. Shell Programming and Scripting

Counting

Hi, I want to count how many rows are in a file for a specific column. eg. K NM K NM K NM K JK K NM K JK K NM so the file is tab-delimited. I want to count how many rows are in column 2 and how many NMs there are. I used awk awk '{OFS="\t"}; {count++} {print i,... (3 Replies)
Discussion started by: phil_heath
3 Replies

7. UNIX for Dummies Questions & Answers

counting words

if i have a long list of data, with every line beginning with an ip-address, like this: 62.165.8.187 - - "GET /bestandnaam.html HTTP/1.1" 200 5848 "http://www.domeinnaam.nl/bestandnaam.html" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" how do i count which ip-adresses are mentioned... (3 Replies)
Discussion started by: FOBoy
3 Replies

8. Shell Programming and Scripting

Counting

Hi, The following output shows how many pmon process are started by users named : oracle or yoavb $ ps -ef |grep pmon |grep -v grep |grep -v ipmon oracle 11268 1 0 Sep 2 ? 36:00 ora_pmon_qerp oracle 17496 1 0 Oct 11 ? 8:58 ora_pmon_bcv oracle 15081 1 0 ... (5 Replies)
Discussion started by: yoavbe
5 Replies

9. Shell Programming and Scripting

counting using awk

Hi, I want to perform a task using shell script. I am new to awk programming and any help would be greatly appreciated. I have the following 3 files (for example) file1: Name count Symbol chr1_1_50 10 XXXX chr3_101_150 30 YYYY File2: Name ... (13 Replies)
Discussion started by: Diya123
13 Replies

10. UNIX for Dummies Questions & Answers

counting?

Hi all, I promise this is my very last dumb question.. but how to you count how many unique names you have. My dataset is: >Bac1 afdsgrr >Bac4 egege >Bac8 dgrjh >Bac1 afdsgrr >Bac1 afdsgrr >Bac8 dgrjh What i want to know is that how many unique names there is, so the output would... (3 Replies)
Discussion started by: Iifa
3 Replies
GStreamer(1)						      General Commands Manual						      GStreamer(1)

NAME
gst-feedback - generate debug info for GStreamer bug reports SYNOPSIS
gst-feedback DESCRIPTION
gst-feedback is a utility that scans the system for various information that is useful to GStreamer developers to help diagnose user prob- lem. Depending on the type of bug report, it may be useful to attach the output of gst-feeback when you contact the developers. NOTE: The current version of this script scans many dirs: /usr/lib /usr/local/lib /home /usr/include /usr/local/include /home (again) for various GStreamer installations. Depending on your system you may not want to do this. Improvements to the script are welcome. USAGE
Generate the feedback information by running gst-feedback: gst-feedback Possibly redirect output and errors to a file: gst-feedback &> myfeedback WARNING
The gst-feedback dumps a lot of information about a system, some of which may be considered sensitive. If this is a concern, review the information before posting to a public forum, such as the GStreamer bug tracking system. SEE ALSO
gst-launch(1), gst-register(1), gst-inspect(1), AUTHOR
The GStreamer team at http://gstreamer.net/ June 2002 GStreamer(1)
All times are GMT -4. The time now is 11:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy