Sponsored Content
Full Discussion: Logic for alert scripts.
Top Forums Shell Programming and Scripting Logic for alert scripts. Post 302549832 by drbiloukos on Wednesday 24th of August 2011 05:01:11 AM
Old 08-24-2011
Logic for alert scripts.

Hello,
In my system, I have implemented various alerts.
An example:

Code:
#!/bin/sh
BILL=bill@company.com
#GETS THE CURRENT NO OF SESSIONS OPENED IN ORACLE
SESSION_NO=`sqlplus -s ${TEST_USER} <<EOF
SET HEAD OFF
@/home/alerts/vlib/cur_session_no.sql
EOF`
 
#MANUALLY SET A THRESHOLD FOR THE SESSONS
SESSION_THRESHOLD=300
 
MAX_SESSIONS=`sqlplus -s ${TEST_USER} <<EOF
SET HEAD OFF
@/home/alerts/vlib/max_session_no.sql
EOF`
 
#IF NO OF SESSIONS EXCEED THE THRESHOLD SEND ME AN EMAIL
if [ $SESSION_NO -gt $SESSION_THRESHOLD ];
then
mailx -s "Number of processes in $ORACLE_SID Critical" $BILL <<EOF
Current No. of sessions in $ORACLE_SID: $SESSION_NO
Max No. of sessions are $MAX_SESSIONS
EOF
fi
exit

And these alerts are scheduled hourly.
My problem is that untill the problem is solved, it keeps sending the mail every hour.

Please give my any ideas (logic) on how I can have the alerts send to me once.
e.g use a flag that I will manually delete when the problem is resolved ?

Any ideas welcomed

Thank you in advance for your help.

---------- Post updated at 12:01 PM ---------- Previous update was at 11:50 AM ----------

I am thinking of:
1)Send the email once,
2)if the check (if [ $SESSION_NO -gt $SESSION_THRESHOLD ];
) does not change do not send the mail again.
3) When problem solved (check fails)
reenable the alert mechanism.
 

3 More Discussions You Might Find Interesting

1. Emergency UNIX and Linux Support

Logic of 3 scripts and 1 header

Hi, I am hitting my head for weeks now, I run 3 sites that are basically serving 1 community, a job search, a wiki and a social networking platform. Rather than promote all three I want to create the illusion that its all 1 website, and I identify 3 areas to make this possible. 1) unified... (7 Replies)
Discussion started by: lawstudent
7 Replies

2. Shell Programming and Scripting

Help with Logic - Copying the same files by 2 Linux scripts to same directory

Hi All, Good Morning ! Can anyone help me understand the following scenario. Scenario 1 : 2 LINUX Scripts(Process 1 & 2) are trying to copy the same file (lets call it FileA.txt) to the same directory (lets say, /home/abc/zyz) at the same time. If both copy is happening at the same... (9 Replies)
Discussion started by: dsfreddie
9 Replies

3. Shell Programming and Scripting

Perl scripts: requesting for logic explanation

Hi, balajesuri and durden_tyler, I have found your perl script for the thread https://www.unix.com/shell-programming-scripting/176370-perl-script-help-me-extracting-string.html, but find it difficult to understand the syntax. Could you or any forum members kindly shed some light on the logic... (3 Replies)
Discussion started by: royalibrahim
3 Replies
set_color(1)                                                           fish                                                           set_color(1)

NAME
set_color - set_color - set the terminal color set_color - set the terminal color Synopsis set_color [-v --version] [-h --help] [-b --background COLOR] [COLOR] Description Change the foreground and/or background color of the terminal. COLOR is one of black, red, green, brown, yellow, blue, magenta, purple, cyan, white and normal. o -b, --background Set the background color o -c, --print-colors Prints a list of all valid color names o -h, --help Display help message and exit o -o, --bold Set bold or extra bright mode o -u, --underline Set underlined mode o -v, --version Display version and exit Calling set_color normal will set the terminal color to whatever is the default color of the terminal. Some terminals use the --bold escape sequence to switch to a brighter color set. On such terminals, set_color white will result in a grey font color, while set_color --bold white will result in a white font color. Not all terminal emulators support all these features. This is not a bug in set_color but a missing feature in the terminal emulator. set_color uses the terminfo database to look up how to change terminal colors on whatever terminal is in use. Some systems have old and incomplete terminfo databases, and may lack color information for terminals that support it. Download and install the latest version of ncurses and recompile fish against it in order to fix this issue. Version 1.23.1 Sun Jan 8 2012 set_color(1)
All times are GMT -4. The time now is 03:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy