Hallo,
> We in the implementation of heartbeat with squid. we done the script for
> starting squid during heartbeat takeover. But when the service (squid in
> this case) is stopped, the heartbeat will not takeover. I saw that there
> are some resource monitoring solutions are available, but i don't know how
> to configure them. I have attached the sample configuration files for your
> reference.
> Please provide a solution for monitoring the service.
I am pretty new to the topic, but I think you are using HA-1 and
Resource Monitoring - the infrastructure that you need to monitor if a
service is running - is only available with HA-2. I have configured such
a setup with HA-2. It is more or less this:
cibadmin -U -X '
<configuration>
<resources>
<primitive class="ocf" provider="heartbeat" type="tomcattg"
id="tomcat">
<operations>
<op name="monitor" interval="60s"
timeout="120s" start_delay="1m" id="monitor-tomcat"/>
</operations>
</primitive>
</resources>
<constraints/>
</configuration>
'
One thing that is very important is the "monitor operation" this isn't
configured automatically. You also need a OCF Ressource Agent which
supports the monitor operation. I have attached an OCF Agent which does
exactly do this for tomcat you could adopt it for squid.
Thomas
#!/bin/sh
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# OCF Ressource Agent on top of tomcat init script shipped with debian. #
# Thomas Glanzmann --tg 21:22 07-12-30 #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# This script manages a Heartbeat Tomcat instance
# usage: $0 {start|stop|status|monitor|meta-data}
# OCF exit codes are defined via ocf-shellfuncs
. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
case "$1" in
start)
/etc/init.d/tomcat5.5 start > /dev/null 2>&1 && exit || exit 1
;;
stop)
/etc/init.d/tomcat5.5 stop > /dev/null 2>&1 && exit || exit 1
;;
status)
/etc/init.d/tomcat5.5 status > /dev/null 2>&1 && exit || exit 1
;;
monitor)
# Check if Ressource is stopped
/etc/init.d/tomcat5.5 status > /dev/null 2>&1 || exit 7
# Otherwise check services (XXX: Maybe loosen retry / timeout)
wget -o /dev/null -O /dev/null -T 1 -t 1
http://localhost:8180/eccar/ && exit || exit 1
;;
meta-data)
cat <<END
<?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
<resource-agent name="tomcattg">
<version>1.0</version>
<longdesc lang="en">
OCF Ressource Agent on top of tomcat init script shipped with debian.
</longdesc>
<shortdesc lang="en">OCF Ressource Agent on top of tomcat init script shipped
with debian.</shortdesc>
<actions>
<action name="start" timeout="90" />
<action name="stop" timeout="100" />
<action name="status" timeout="60" />
<action name="monitor" depth="0" timeout="30s" interval="10s" start-delay="10s"
/>
<action name="meta-data" timeout="5s" />
<action name="validate-all" timeout="20s" />
</actions>
</resource-agent>
END
;;
esac
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems