1827885 Members
1311 Online
109969 Solutions
New Discussion

Re: monitoring

 
Piotr Kirklewski
Super Advisor

monitoring


Hi there.

I nead to check if apache + mysql + certain webapage (virtual) is running and if not then send email to admin@xxxx.com.
Unfortunately I don't know much about scripting.

Can you help me?

Jesus is the King
1 REPLY 1
Fat Scrape
Honored Contributor

Re: monitoring

Yes,

Simple script to verify if processes are running otherwise send a mail notification.

#!/usr/bin/ksh

#
# This is a processes list
#
proc_list="process1 process2 process3 ... processN"


ps -ef >/tmp/process_$$

for process in $proc_list
do
if [ $(grep -c $process /tmp/process_$$) -gt 0 ]
then
echo "process $process is running"
else
echo "process $process is down"
echo "process $process is down" |mailx -s "process down" user@domain
fi
done
rm /tmp/process_$$