Re: [ClusterLabs] [Q] Pacemaker: Kamailio resource agent

2016-01-08 Thread Ken Gaillot
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
> 
> (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  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
packages).

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


___
Users mailing list: Users@clusterlabs.org
http://clusterlabs.org/mailman/listinfo/users

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://bugs.clusterlabs.org


[ClusterLabs] [Q] Pacemaker: Kamailio resource agent

2015-12-26 Thread Sebish

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 
 
(ra) and it would be great, if you could help me a little.


--
_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*"
 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
 o Changed html snippet  to &&
 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)

_
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?


Thank you very mich for your time and interest!

Sebastian
#!/bin/bash
#
#   OCF resource agent for Kamailio for pacemaker
#

# Copyright (c) 2013 FREQUENTIS AG,
#Authors: Stefan Wenk
# Rainer Brestan
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it would be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# Further, this software is distributed without any warranty that it is
# free of the rightful claim of any third person regarding infringement
# or the like.  Any license provided herein, whether implied or
# otherwise, applies only to this software file.  Patent licenses, if
# any, provided herein do not apply to combinations of this program with
# other software, or any other product whatsoever.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
#

# OCF input parameters:
#  OCF_RESKEY_binary
#  OCF_RESKEY_conffile
#  OCF_RESKEY_pidfile
#  OCF_RESKEY_monitoring_ip
#  OCF_RESKEY_listen_address
#  OCF_RESKEY_port
#  OCF_RESKEY_proto
#  OCF_RESKEY_sipsak
#  OCF_RESKEY_kamctlrc
#  OCF_RESKEY_kamuser

# Initialization:

: ${OCF_FUNCTIONS_DIR=/usr/lib/ocf/lib/heartbeat}
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs

###
# Defaults

RESKEY_binary_default="/usr/sbin/kamailio"
RESKEY_conffile_default="/etc/kamailio/kamailio.cfg"
RESKEY_pidfile_default="/var/run/kamailio/kamailio.pid"
RESKEY_monitoring_ip_default=10.10.65.200
RESKEY_port_default=5060
RESKEY_proto_default="udp"
RESKEY_sipsak_default="/usr/bin/sipsak"
RESKEY_kamctlrc_default="/etc/kamailio/kamctlrc"
RESKEY_kamuser_default="kamailio"

###
: ${OCF_RESKEY_binary=${RESKEY_binary_default}}
: ${OCF_RESKEY_conffile=${RESKEY_conffile_default}}
: ${OCF_RESKEY_pidfile=${RESKEY_pidfile_default}}
: ${OCF_RESKEY_monitoring_ip=${RESKEY_monitoring_ip_default}}
: ${OCF_RESKEY_port=${RESKEY_port_default}}
: ${OCF_RESKEY_proto=${RESKEY_proto_default}}
: ${OCF_RESKEY_sipsak=${RESKEY_sipsak_default}}
: ${OCF_RESKEY_kamctlrc=${RESKEY_kamctlrc_default}}
: ${OCF_RESKEY_kamuser=${RESKEY_kamuser_default}}

###
usage() {
cat <


1.0


 Resource agent for the Kamailio SIP proxy/registrar.
 Multiple instances are possible when using following parameter combinations:

 Parameters for Kamailio instance 1:
listen_address=192.168.159.128
monitoring_ip=192.168.159.128
proto=udptcp
port=5060 

 Parameters for Kamailio instance 2:
listen_address=192.168.159.128
monitoring_ip=192.168.159.128
proto=udp
port=5070
conffile=/etc/kamailio/kamailio2.cfg
kamctlrc=""

 Only one instance can be monitored via the command "kamctl monitor"
 because the kamctl tool of kamailio 4.x is not designed for multiple
 instances. Therefore, the provided kamctrlrc file path needs to be 
 empty for instance 2, 3 ...