Operating System - HP-UX
1827593 Members
2668 Online
109965 Solutions
New Discussion

Re: Silly Question on MCSG

 
Vishal Augustine
Frequent Advisor

Silly Question on MCSG

Hi,

I wanted to know if this scenario can be worked out in MCSG.

Two machines AA and BB are running in Active/Active mode. There are 3 packages A, B and C - are configured in such a way.
A runs in AA. (it won't failover to BB)
B runs in BB. (it won't failover to AA)
C runs in AA and can failover to BB.

Is it pssoble to configure the MCSG package such that when A fails, a script is run in BB and when B fails a script is run in AA ?

Thanks an Regards
Vishal
6 REPLIES 6
Sridhar Bhaskarla
Honored Contributor

Re: Silly Question on MCSG

Hi Vishal,

You can use EMS to monitor packages and do action based on it's state.

I am not a big fan of EMS+MCSG. I would do the following.

1. Create|Modify the monitoring script for A and B.
2. Script for A monitors the state of B and takes the action.
3. Script for B monitors the state of A and takes the action.

A simple script will be like this (Package monitoring script for A)

stamp=0
while [ true ]
Status=(cmviewcl -p pkgB|awk '/pkgB/ {print $2}'
case $Status in

'up') stamp=0

;;

'down')

if [ "$stamp" != 1 ]
then
run_your_script
fi

;;
esac

(write code to monitor your processes here. Exit if the processes won't run)

done

Create a service called "pkgA" in your package config file and keep the above script in the control file. Search for SERVICE word in both the files for more explanation.

Repeat the same for pkgB

Only problem is that it needs the other package to be running for this to work.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sridhar Bhaskarla
Honored Contributor

Re: Silly Question on MCSG

Forgot to set the stamp to 1 in the "down" condition otherwise it will run your script every $MONITORING_INTERVAL. This will be reset once package B is up.

if [ "$stamp" != 1 ]
then
run_your_script
stamp=1
fi


-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Sridhar Bhaskarla
Honored Contributor

Re: Silly Question on MCSG

And there are two more cases I can think of

1) Run the same script above with "nohup" option outside the serviceguard on systemA. Since this has to continuously run, make it to test for a lock file and exit if it finds it. For ex.,

while true
do

if [ -f /etc/cmcluster/pkgB.lock ]
then
exit
else

Status=(cmviewcl.....
case
..

esac
done

2. If you are using .rhosts, then put a line like this in the shutdown part of pkgB.

remsh pkgA path_to_your_script

So when pkgB comes down, it will run the script and then halt.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Vishal Augustine
Frequent Advisor

Re: Silly Question on MCSG

Sri, Thanks but I am confused !!!

For this I have to install EMS right ?

Let me admit that I have no idea about these sysadmin tolls/utilities. The machine I have has MCSG and HP GlancePlus/UX Pak.

Do you think it is still possible ?

Thanks and Regards
Vishal
Stanimir
Trusted Contributor

Re: Silly Question on MCSG

Hi!
1. I suppose you can use in pkgB's service monitoring script something like:

remsh AA "echo ... pkgB down here!!!"

This way when pkgB get down, system AA will
be informed.

2. You can run on AA script, included
"cmviewcl"-command catch the output "halted"
for pkgB using sed&awk. I thing, it is
simple, but will work. :)

Regards, Stan
Rita C Workman
Honored Contributor

Re: Silly Question on MCSG

They did a very simplistic thing here for the SG environment that was set up when I got here.

They run a simple script that greps cmviewcl and greps for uname -a and then writes out the hostname to a file. They have another simple script that says if the hostname is equal to the failover box (BB) then haltpkgs on (BB). In the custom startup scripts they check the results in the file...if it's on server A they run pkg(s) for server A.
Now if pkg fails over and hits the other box...when it checks for that status.hostname file it finds the other servers hostname and then the script takes the other option on the statement and runs that little shutdown script and shuts down pkg(s) for B and then continues on and starts up the pkg(s) for A again.

At this point getting everything back to it's own box, would be a manual stop/start of pkgs - and of course ensure that the status file is cleared and not left over on the other failover server.

Like I said it's really just a couple small shell scripts that are referenced in the custom startup/shutdown scripts in each package.

Rgrds,
Rita