[ClusterLabs] [Q] Pacemaker: Kamailio resource agent

Ken Gaillot kgaillot at redhat.com
Fri Jan 8 18:19:31 EST 2016

On 12/26/2015 05:27 AM, Sebish wrote:
> Hello to all ha users,
> first of all thanks for you work @ mailinglist, pacemaker and ras!
> I have an issue with the kamailio resource agent
> <https://github.com/ClusterLabs/resource-agents/blob/master/heartbeat/kamailio>
> (ra) and it would be great, if you could help me a little.

I'm not familiar with kamailio, but I can make some general comments ...

> -- 
> _Status:
> _Debian 7.9
> Kamailio - running
> Heartbeat & Pacemaker - running (incl. running virtual IP and apache ra)
> and more
> _What I did__:_
>  * Create /usr/lib/ocf/resource.d/heartbeat/kamailio and chmod 755'd it
>  * Then I inserted the code of the ra and changed the following:
>      o RESKEY_kamuser_default="*myuser*"

It's not necessary to change the defaults in the code; when you create
the resource configuration in the cluster, you can specify options (such
as "kamuser=*myuser*") to override the defaults.

>      o Line 52 to:
>        RESKEY_pidfile_default="/var/run/kamailio/kamailio.pid(This is
>        in my kamctlrc file too, exists and works)
>      o Line 53 to: RESKEY_monitoring_ip_default=*IPOFMYKAMAILIOSERVER*
>      o Changed : ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat} ->
>        /usr/lib/ocf/lib/heartbeat , because he did not find it

This shouldn't be necessary; pacemaker should set the OCF_ROOT
environment variable before calling the agent. If you were having
trouble testing it from the command line, simply set
OCF_ROOT=/usr/lib/ocf before calling it.

>      o Changed html snippet &amps to &&

I'm not sure what you mean here. The example given in the agent's XML
metadata should stay as && since it's XML and may not parse
correctly otherwise. If you're talking about your kamailio.cfg, then
yes, you should use && there.

>      o listen_address:*virtualipofkamailioserver*
>      o (For more see attachment)
>  * Installed sipsak
> _What I get:_
> crm status gives me: STOPPED - Kamailio_start_0 (node=node1, call=22,
> rc=-2, status=Timed Out): unknown exec error (on all nodes)

This means that pacemaker tried to call the "start" action of the
resource agent, but it timed out on every node. It's possible the start
action isn't working, or that the timeout is too short. You can set the
timeout by defining a start operation for the resource in the cluster
configuration, with a timeout= option.

> _
> What I need:_
>  * In the ra at line 155 it says to insert a code snippet to the
>    kamailio.cfg, but not where exactly.
>      o Please tell me, at which spot exactly I have to insert it. (I
>        pasted it at line ~582, # Handle requests within SIP dialogs)
>  * Is there a way to debug the kamailio ra, if inserting the code
>    snipped using your help will not be enough?

Any output from resource agents should be in the system log and/or
pacemaker.log. That's a good place to start.

There are also tools such as ocf-tester and ocft to test resource agents
from the command line (though they're not always made available in

> Thank you very mich for your time and interest!
> Sebastian

More information about the Users mailing list