1846311 Members
3485 Online
110256 Solutions
New Discussion

Re: Script help

 
SHABU KHAN
Trusted Contributor

Script help

Hi All,

I was wondering if anyone has a script already that would check for an "error pattern" in the logs and emails/pages out if that error occurs. I need to cron that every 5 minutes.

Any help would be greatly appreciaed.

Thanks,
Shabu
8 REPLIES 8
SHABU KHAN
Trusted Contributor

Re: Script help

Hi,

For now, the script that I am testing currently works if run every 30 minutes. I couldn't think of any other methods that the script could be modified to run more frequently.

I've attached the script.

Any suggestions/ideas ?

Thanks,
Shabu
Mark Greene_1
Honored Contributor

Re: Script help

why not put it in cron and run it every 5 minutes? or, have the script rerun itself in 1 minute should if find an error:

echo "[full path of script]|at -m 1

HTH
mark
the future will be a lot like now, only later
Justo Exposito
Esteemed Contributor

Re: Script help

Hi,

Do you try to put:
if [ "${CTIME}" -le 040000 ]; then
TSPREAD="999999"
else
TSPREAD="0500"
fi
Where are this:
if [ "${CTIME}" -le 040000 ]; then
TSPREAD="999999"
else
TSPREAD="3000"
fi

Hope this helps,

Justo.
Help is a Beatiful word
Sachin Patel
Honored Contributor

Re: Script help

Hi Khan,
Attached is the script that I use.
It does check for named, yp, sendmail syslog etc...
Is photography a hobby or another way to spend $
SHABU KHAN
Trusted Contributor

Re: Script help


Initially changing the tspread logic to 5 minutes didn't work and later I changed the logic further down the program and forgot to change it back to 5 minutes.

The testing so far has been successful.

Thanks for pointing me in the right direction Justo !

-Shabu
Dave La Mar
Honored Contributor

Re: Script help

Attached is a down and dirt that works fine for us. As you can see, you may grep for additional entries.
The date portion parses out only the current month's errors.
Best of Luck.
dl
"I'm not dumb. I just have a command of thoroughly useless information."
Justo Exposito
Esteemed Contributor

Re: Script help

You are welcome Shabu.

Cheers,

Justo.
Help is a Beatiful word
John Carr_2
Honored Contributor

Re: Script help

Hi

you coluld set up crontab to do this

dmesg - | mailx ...

this will give you any error messages which have occured since the last time dmesg was run after the first time.

cheers
John.