Hi Bj?rn Boschman,
Hoping you are fine. Well I've done integration with HA + Opensips, using
the link you provided
http://www.anders.com/cms/259/Linux.Tutorial/OpenSIPS/OpenSER/Linux-HA/ the
integration fails. I'll provide u script which will work perfectly as u can
see in attachment;
Before executing, edit the script file what i sent u. In ipaddr2=[ENTER
VIRTUAL IP] section enter ur virtual IP i.e. ipaddr2=1.2.3.4, save and quit
it and test with ocf_test.
> Message: 3
> Date: Mon, 25 Jan 2010 17:09:17 +0100
> From: Bj?rn Boschman <[email protected]>
> Subject: [Linux-HA] OpenSIPS integration
> To: "[email protected]" <[email protected]>
> Message-ID:
> <
> 1825fbab6f2848428942088a0d0a8c287064418...@qhexmbox1.hosting.inetserver.de
> >
>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi,
>
> I'm trying to integrate OpenSIPS via some agent which can be found here
> http://www.anders.com/1offs/OpenSer.txt
> http://www.anders.com/cms/259/Linux.Tutorial/OpenSIPS/OpenSER/Linux-HA/
>
> When I set the mandatory SHELL variables (OCF_ROOT, OCF_RESKEY_ip,
> OCF_RESKEY_port) and run the agent (start/stop/monitor and so on) everything
> works fine.
>
> /usr/lib/ocf/resource.d/nfon/opensips start
> echo $? -> 0
>
> /usr/lib/ocf/resource.d/nfon/opensips monitor
> echo $? -> 0
>
> /usr/lib/ocf/resource.d/nfon/opensips stop
> echo $? -> 0
>
> /usr/lib/ocf/resource.d/nfon/opensips monitor
> echo $? -> 7
>
> Unfortunatelly when I run ocf-tester it fails:
>
> ocf-tester -n opensips -o ip=127.0.0.1 -o port=5060 -o provid=reg
> /usr/lib/ocf/resource.d/nfon/opensips
> Beginning tests for /usr/lib/ocf/resource.d/nfon/opensips...
> * rc=7: Monitoring an active resource should return 0
> * rc=7: Monitoring an active resource should return 0
> Tests failed: /usr/lib/ocf/resource.d/nfon/opensips failed 2 tests
>
> Also integrating into heartbeat does not bring the resource up.
>
> Does anyone has a clue what I am doing wrong?
>
>
> Cheers
>
> Bj?rn Boschman
>
> nfon AG
> Leonrodstra?e 68
> D-80636 M?nchen
> ?
> fon +49 (0)89 453 00-0
> fax +49 (0)89 453 00-100
> mail [email protected]
> web www.nfon.net
>
> Support-Hotline der nfon AG
> mail [email protected]
> fon??? +49 (0)89 453 00-555
>
> ??
> Vorsitzender des Aufsichtsrats: Prof. Dr. Henning Werner
> Vorst?nde: Fabian Hoppe, Marcus Otto, Jens Blomeyer
> Sitz der Gesellschaft M?nchen
> Amtsgericht M?nchen, HRB 168022
> USt-ID DE254495743
>
>
>
>
--
Regards,
Ahmed Munir
#!/bin/sh
# Initialization:
#. ${OCF_ROOT}/usr/lib/ocf/resource.d/heartbeat/.ocf-shellfuncs
. /usr/lib/ocf/resource.d/heartbeat/.ocf-shellfuncs
usage() {
cat <<-!
usage: $0 {start|stop|status|monitor|meta-data|validate-all}
!
}
meta_data() {
cat <<END
<?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
<resource-agent name="OpenSIPS">
<version>1.0</version>
<longdesc lang="en">
Resource Agent for the OpenSIPS SIP Proxy.
</longdesc>
<shortdesc lang="en">OpenSIPS resource agent</shortdesc>
<parameters>
<parameter name="ip" unique="0" required="1">
<longdesc lang="en">
IP Address of the OpenSIPS Instance. This is only used for monitoring.
</longdesc>
<shortdesc lang="en">IP Address</shortdesc>
<content type="string" default="" />
</parameter>
<parameter name="port" unique="0" required="1">
<longdesc lang="en">
Port of the OpenSIPS Instance. This is only used for monitoring.
</longdesc>
<shortdesc lang="en">Port</shortdesc>
<content type="string" default="5060" />
</parameter>
</parameters>
<actions>
<action name="start" timeout="30" />
<action name="stop" timeout="30" />
<action name="status" depth="0" timeout="30" interval="10" start-delay="30" />
<action name="monitor" depth="0" timeout="30" interval="10" start-delay="30" />
<action name="meta-data" timeout="5" />
<action name="validate-all" timeout="5" />
<action name="notify" timeout="5" />
<action name="promote" timeout="5" />
<action name="demote" timeout="5" />
</actions>
</resource-agent>
END
}
OpenSIPS_Status() {
#/etc/init.d/opensips status > /dev/null
#rc=$?
#if
#[ $rc -ne 0 ]
#then
#return $OCF_NOT_RUNNING
#else
#/etc/init.d/opensips reload
#return $OCF_SUCCESS
#fi
ipaddr2=[ENTER VIRTUAL IP]
if [ $OCF_RESKEY_ip = $ipaddr2 ]; then
check=(`netstat -tapn | grep opensips | cut -d" " -f16 | cut -d":" -f1
| tr "\n" " "`)
if [ ${check[0]} = $ipaddr2 -o ${check[1]} = $ipaddr2 ]; then
/etc/init.d/opensips status > /dev/null
rc=$?
if [ $rc -ne 0 ]; then
return $OCF_NOT_RUNNING
else
return $OCF_SUCCESS
fi
else
/etc/init.d/opensips reload
return $OCF_SUCCESS
fi
else
/etc/init.d/opensips status > /dev/null
rc=$?
if [ $rc -ne 0 ]; then
return $OCF_NOT_RUNNING
else
return $OCF_SUCCESS
fi
fi
}
OpenSIPS_Monitor( ) {
OpenSIPS_Status
}
OpenSIPS_Start( ) {
if OpenSIPS_Status ; then
ocf_log info "OpenSips already running."
return $OCF_SUCCESS
else
/etc/init.d/opensips start >/dev/null
rc=$?
if [ $rc -ne 0 ]; then
return $OCF_ERR_PERM
else
return $OCF_SUCCESS
fi
fi
}
OpenSIPS_Stop( ) {
/etc/init.d/opensips stop >/dev/null
return $OCF_SUCCESS
}
OpenSIPS_Validate_All( ) {
return $OCF_SUCCESS
}
if [ $# -ne 1 ]; then
usage
exit $OCF_ERR_ARGS
fi
case $1 in
meta-data) meta_data
exit $OCF_SUCCESS
;;
start) OpenSIPS_Start
;;
stop) OpenSIPS_Stop
;;
monitor) OpenSIPS_Monitor
;;
status) OpenSIPS_Status
;;
validate-all) OpenSIPS_Validate_All
;;
notify) exit $OCF_SUCCESS
;;
promote) exit $OCF_SUCCESS
;;
demote) exit $OCF_SUCCESS
;;
usage) usage
exit $OCF_SUCCESS
;;
*) usage
exit $OCF_ERR_ARGS
;;
esac
exit $?
_______________________________________________
Linux-HA mailing list
[email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems