Operating System - HP-UX
1833601 Members
3536 Online
110061 Solutions
New Discussion

how to monitor some daemons/programs and automaticaly make them up if they go down for some reason

 
Alexander_101
Advisor

how to monitor some daemons/programs and automaticaly make them up if they go down for some reason

Hi all,

i have installed a product (NNM) on my HP-UX machine. Is there any way my HP-UX to monitor some daemons - nnm daemons an start them over if some of them get down ?
10 REPLIES 10
RAC_1
Honored Contributor

Re: how to monitor some daemons/programs and automaticaly make them up if they go down for some reason

UNIX95= ps -C"daemon_name" || "start_program"
There is no substitute to HARDWORK
Geoff Wild
Honored Contributor

Re: how to monitor some daemons/programs and automaticaly make them up if they go down for some reason

How about - install MC/ServiceGuard.

Though Anil's way should work...

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Alex Lavrov.
Honored Contributor

Re: how to monitor some daemons/programs and automaticaly make them up if they go down for some reason

We wrote script that has configuration file with values to check with ps and how many instances there should be. It runs every 5 minutes in crontab and if the process is down or there are not enough instances of it, it starts the program with the line that is also written in the config file.

Not complicated at all.


About ServiceGuard, I'll say it's a bit expensive solution for a such small problem :)
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Bill Hassell
Honored Contributor

Re: how to monitor some daemons/programs and automaticaly make them up if they go down for some reason

If NNM daemons are stopping, you need to get the latest patches. NNM is not cheap and the required programs (daemons) should never disappear. Install the current patches for your HP-UX system and the latest patches for NNM.


Bill Hassell, sysadmin
Alexander_101
Advisor

Re: how to monitor some daemons/programs and automaticaly make them up if they go down for some reason

Hello Bill,

I think, this is not such a bad idea !

Now my question is how to determine which patches/updates do i need ?? they are hundrets !

I need some sort of "service guard", because there are some additional thinks i need to be always UP and running (vncserver for example), what happens if I'm not at the office and something goes wrong ?
Alexander_101
Advisor

Re: how to monitor some daemons/programs and automaticaly make them up if they go down for some reason

Hi Alex,

sounds intresting, but i can't do ANY programing/scripting, if you can help me a bit ??

or at least give me some links to reed about it ??
Alex Lavrov.
Honored Contributor

Re: how to monitor some daemons/programs and automaticaly make them up if they go down for some reason

Hey, I'll give guidelines for this script:

conf file (example):

test.prog:5:/usr/bin/test.prog

script (in crontab, runs let's say every 5 minutes):

cat conf.file | while read line
do

grep_line=`echo $line | awk -F : '{print $1}'`
num=`echo $line | awk -F : '{print $2}'`
command_line=`echo $line | awk -F : '{print $3}'`

num_procs=`ps -ef | grep test.prog | grep -v grep | wc -l`

if [ $num_procs -lt $num ]
then
# exeute the program with command_line
# may be send an email to someone that the process is down
fi


Well, it's just a skeleton, that gives the general idea of the script. I checks every line and gets the info it need to check the process and how to execute it if the number of instances is less than it should be.

There are ofcourse more scripting to do, may be send an email, of more complex checks, bt this is the direction.


I don't give a damn for a man that can only spell a word one way. (M. Twain)
Alexander_101
Advisor

Re: how to monitor some daemons/programs and automaticaly make them up if they go down for some reason

Bill, don't bother, i found the latest patch bundle for my hp-ux
Alexander_101
Advisor

Re: how to monitor some daemons/programs and automaticaly make them up if they go down for some reason

thanks Alex,

sounds a little complicated... i'll desipher it ;)
Alexander_101
Advisor

Re: how to monitor some daemons/programs and automaticaly make them up if they go down for some reason

http://cr.yp.to/ <- daemontools

It's free and it's nice !