Operating System - HP-UX
1823913 Members
3424 Online
109667 Solutions
New Discussion юеВ

how to monitor unix process via mcsg control script ?

 
SOLVED
Go to solution
Sammy_2
Super Advisor

how to monitor unix process via mcsg control script ?

mcsg 11.16, hpux 11.11

Need to use mcsg pkg control script to monitor
certain processes ?
What do I put for SERVICE NAME ?


script to start process : "/sbin/init.d/nimbus_boot stop"

process to monitor by using ps is:
"./nimbus /opt/nimbus"

Need to restart once if not failover to secondary node
===================
I am assuming SERVICE command in mcsg pkg control script will work but dont know seems to be working . see log below.

SERVICE_NAME[0]="nimbus"
SERVICE_CMD[0]="./nimbus /opt/nimbus"
SERVICE_RESTART[0]="r 1"


I get following in the log.


Aug 3 10:21:03 - Node "ojrdhes3": Starting service nimbus using
"./nimbus /opt/nimbus"
cmrunserv : Service name nimbus does not exist.
ERROR: Function start_services
ERROR: Failed to start service nimbus
Aug 3 10:21:03 - Node "ojrdhes3": Halting service nimbus
cmhaltserv : Service name nimbus is not running.
good judgement comes from experience and experience comes from bad judgement.
6 REPLIES 6
Steven E. Protter
Exalted Contributor

Re: how to monitor unix process via mcsg control script ?

Hi Sammy,

This thread seems familiar.

Can you post your monitor script please.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sammy_2
Super Advisor

Re: how to monitor unix process via mcsg control script ?

Steve,
Thanks for replying again.

Well, Your question makes realize i am doing something wrong. I dont have a monitoring script.

I was thinking (maybe wrongly) that if I specify the parameters below in my pkg control script
1) app. startup script for SERVICE NAME
2) app process to monitor for SERVICE CMD
3) times to restart for SERVICE RESTART,

then if if kill SERVICE CMD process, the mcsg will try to restart on the same node using SERVICE NAME script once and then failover to other node based on SERVICE RESTART.
Maybe I am totally off base.
here is what i had:

SERVICE_NAME[0]="nimbus"
SERVICE_CMD[0]="./nimbus /opt/nimbus"
SERVICE_RESTART[0]="r 1"

How does monitoring of the process work and make the pkg failover to other box if the process fails?

good judgement comes from experience and experience comes from bad judgement.
melvyn burnard
Honored Contributor
Solution

Re: how to monitor unix process via mcsg control script ?

What you are trying to do is not correct.
Your service monitoring requires a script, usually in the package sub-directory, that is run when the the package is started.
This script does NOT start an application, it should start a process that goes out to monitor the application process(es) you are concerned about.

For example

SERVICE_NAME[0]=myservice
SERVICE_CMD[0]=/etc/cmcluster/mypkg/myscript
SERVICE_RESTART[0]="r 1"

and the script /etc/cmcluster/mypkg/myscript basically would do something like an infinite loop, checking for the existance of the process you are worried about. If this process is NOT there, then the servcei dies, and the package manager halts the package and switches it to the other node.

I recommend you read the Managing Serviceguard manual at:
htpp://docs.hp.com/en/ha
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Sammy_2
Super Advisor

Re: how to monitor unix process via mcsg control script ?

Thanks Mel,
Make sense now but What would SERVICE NAME be ?
good judgement comes from experience and experience comes from bad judgement.
Stephen Doud
Honored Contributor

Re: how to monitor unix process via mcsg control script ?

Use the customer_define_run_cmds function to start the application, such as:

/sbin/init.d/nimbus_boot start

and the customer_defined_halt_cmds to stop the application, such as:

/sbin/init.d/nimbus_boot stop

Define a Service Name for the application monitor in the package configuration file, such as:

SERVICE_NAME nimbusmon

cmapplyconf the pkg config file so that SG will have a link to the SERVICE_NAME and SERVICE_CMD that the package control script runs.

Use the same SERVICE_NAME reference in the package control script.
In the SERVICE_CMD parameter, reference the script that will periodically check for the existence of the nimbus process (see Melvyn's description above). The script should exit when it does not find the nimbus process. This exit signals Serviceguard to look at the SERVICE_RESTARTS, and if set to SERVICE_RESTART[0]="-r 1", it performs the SERVICE_CMD one more time before faulting the package and potentially failing it to an adoptive node.
Sammy_2
Super Advisor

Re: how to monitor unix process via mcsg control script ?

Makes more sense now , Steve. Thanks to Mel, steve and SEP for making the clear . I am on my way to creatign a monitoring script.
Thanks
good judgement comes from experience and experience comes from bad judgement.