Script to raise the alarm in the log File


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to raise the alarm in the log File
# 1  
Old 11-04-2008
CPU & Memory Script to raise the alarm in the log File

Hi All,

Please help to write the script that should raise an alarm if the new logs will not come in the log file.
In other words i want to write a script which will monitor the log file continuously and will raise an alarm if the logs will not come after some time suppose 5 minutes.My boss asked me to do this so please help me, it is Urgent.

Advance Thanks,
Akhtar Bhat (9718200827)
# 2  
Old 11-04-2008
Are there timestamps in there so you know what is 5 minutes old? Do you see an entry in the log or can you use it in the script when the action is taken, that should cause such a log entry?
You can also try to copy (if you have enough free space) the actual log away, wait 5 mins, then diff it to the actual log and check the diff if there is the entry in it and if not, launch your alarm.
# 3  
Old 11-04-2008
Hi Zaxxon,
No there are no time stamps in the log file.I think u donot understand my question the problem is the script will monitor the live log file and if new logs are not coming/generating in the file within some time suppose 5 minutes then the alarm should be raised.Hope u got it this time.I was thinking that script should contain a counter which will be incremented evry time some thing like that.

here r some logs

16732823 [AGIML SERVER REQUEST WORKER [86_2]] DEBUG message - DBG [] STACKMGR........................freeProcessor - freeProcessor start mgrId=6377
16732823 [AGIML SERVER REQUEST WORKER [86_2]] DEBUG client - DBG AGIML SERVER[86] RESPONSE Q .................put() (trans id=[6377])
16732824 [AGIML SERVER RESPONSE WORKER [86_1]] DEBUG client - DBG AGIML SERVER[86].............................write() (<agiml><header><responsetype>TOPUP</
responsetype></header><response><resultcode>29</resultcode><value>30.0</value><timestamp>2008-11-04 17:20:54</timestamp><account>9810815334</account><transno
>6377</transno><agenttransno>123</agenttransno><resultdescription>Topup value not defined or allowed</resultdescription></response></agiml>)
16732825 [SERVER CXN READER [86 [/127.0.0.1:35900]]] INFO client - INF SERVER CXN READER [86 [/127.0.0.1:35900]]....run() (Received NULL input from client!!
)
16732825 [SERVER CXN READER [86 [/127.0.0.1:35900]]] INFO client - INF SERVER CXN READER [86 [/127.0.0.1:35900]]....run() (Connection Reader Thread terminat
ed... )
16732827 [AGIML SERVER REQUEST WORKER [86_2]] DEBUG client - DBG AGIML SERVER[86] REQUEST Q ..................get() ()
16732831 [AGIML SERVER RESPONSE WORKER [86_1]] DEBUG client - DBG AGIML SERVER[86] RESPONSE Q .................get() ()
16733555 [SERVER CXN READER [83 [/127.0.0.1:35897]]] INFO client - INF CLIENT CONNECTION MGR........................removeClient() (Removing agiml client 83
)
16733561 [SERVER CXN READER [84 [/127.0.0.1:35898]]] INFO client - INF CLIENT CONNECTION MGR........................removeClient() (Removing agiml client 84
)
16733808 [SERVER CXN READER [85 [/127.0.0.1:35899]]] INFO client - INF CLIENT CONNECTION MGR........................removeClient() (Removing agiml client 85
)
16733828 [SERVER CXN READER [86 [/127.0.0.1:35900]]] INFO client - INF CLIENT CONNECTION MGR........................removeClient() (Removing agiml client 86
# 4  
Old 11-04-2008
Ah ok, now I got it, I think Smilie

Just use cksum or get the size with "ls -l" or number of lines/characters with wc on the log file, write the result of one of those commands to a file in /tmp for example. Start the script every 5 mins and compare the actual result with the one taken 5 minutes before in the file in /tmp. If nothing changed just launch the alarm.
# 5  
Old 11-05-2008
Hi Sir,

This is what I was looking for. Thanks for this, now the problem is that it is so hectic to start the script after every five minutes, Do you have any idea to start the script automatically without using the crontab command
# 6  
Old 11-05-2008
Hi Zaxxon,

Thanks for the help, I did it
bye
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Calculate e raise to the power in awk | UNIX

Input data: I'd like to calculate using value in second column. The value needs to be created using a formula, that employs exp (that is e raise to the power). awk '{ if(FNR==1){ ##if first line than print as is and add third column print $0,"weight" } else{ if($2<=0.01){... (2 Replies)
Discussion started by: genome
2 Replies

2. Shell Programming and Scripting

Shell script to find the wrong filename in a path and raise a trap for it

Example: I have server name A with an IP : 125.252.235.455 I have an username /password to login into this server under SSH connection In this server i have a path /apps/user/filename(Big.txt) Everyday we used to get the filename as Big.txt. I want a shell script to monitor this path... (4 Replies)
Discussion started by: ChandruBala73
4 Replies

3. Shell Programming and Scripting

Alarm clock error while executing the script

I am executing perl script on Linux machine and the script is running for the last 5 hours and while running the script I had an error message in a single line Alarm Clock and the script got stopped. I havnt scheduled the script.I have executed the script manually. There is no syntax errors in... (1 Reply)
Discussion started by: scriptscript
1 Replies

4. Solaris

How to log an alarm with a specific message ID on Solaris

Hi gurus, I was wondering if it's possible to log an alarm using logger to hardcode the alarm with a specific message id? For example: Apr 27 13:43:55 testhost sendmail: I would want to change the ID to something else, as shown below: Apr 27 13:43:55 testhost sendmail: 100421... (0 Replies)
Discussion started by: gilberteu
0 Replies

5. Shell Programming and Scripting

Script to raise a integer by a exponent (while loop)

I am trying to write a script that raises a integer (m) by a exponent (n) using a while loop ex. 5 raised to the power of 2 .. I am a beginner and i dont know what is the opperand or command i have to use to make this happen..this is what i have so far... echo "Enter a integer for the... (3 Replies)
Discussion started by: jibz
3 Replies

6. Shell Programming and Scripting

raise an alarm in Unix

Hi members, I am working in WebSphere in Unix environment. we are working with 500 odd servers and most of the times processes got down. Can i have any shell script through whih some popup with alarm get raised whenever some server get down. kindly help.. Thanks Rishi (1 Reply)
Discussion started by: rishi.madan
1 Replies

7. Shell Programming and Scripting

If any file resides for more than an hour in this directory then to raise an alert

Hi If there is a file upload done from a remote server and if the file remains without being extracted for more than an hour, I need to identify the files and create an alert message to the users in the other end. please help me writing a shell script for it. Regards Yazhini (2 Replies)
Discussion started by: yazhini.t
2 Replies

8. Shell Programming and Scripting

File Accessed Alarm ??

Hey, I want to ask a simple Question.... How would I be able to come to know that files/directoires in a Parent directory has been accessed (means contents of the file has been just viewed) by the user(s) in a group ? and mail the name(s) of those files/directories which has been accessed... (16 Replies)
Discussion started by: varungupta
16 Replies

9. AIX

File Accessed Alarm ??

Hey, I want to ask a simple Question.... How would I be able to come to know that files/directoires in a Parent directory has been accessed (means contents of the file has been just viewed) by the user(s) in a group ? and mail the name(s) of those files/directories which has been accessed... (1 Reply)
Discussion started by: varungupta
1 Replies

10. Programming

[Problem] raise a signal in FreeBSD

I am trying to send a SIGUSR1 to a set of process. Please tell me how to do. I've tried the system call raise(int sig) but it just raise a signal of to the 'current process.' My program is about a network chat server. When a client connects in, The main process will fork a new process... (1 Reply)
Discussion started by: Namely
1 Replies
Login or Register to Ask a Question