Re: SNMPd can register from one keepalived only

Quentin Armitage <[email protected]>
Newsgroups gmane.linux.keepalived.devel
Organization The Armitage family
Message-ID <[email protected]>
On Mon, 2016-07-18 at 09:30 +0000, Łukasz Margiela wrote:
> Hi,
> 
> 
> 
> I'm struggling with a problem when I run multiple keepalived in
> separated network namespaces. The first keepalived registers
> flawlessly and I can query it without any problem, but when the second
> one starts I get tons of errors like:
> 
> duplicate registration: MIB modules AgentX subagent 11, session
> 0xef45d0, subsession 0xf07cd0 and AgentX subagent 15, session
> 0xf11540, subsession 0xf4f180 (oid .1.3.6.1.4.1.9586.100.5.3.4.1.26)
> 
> 
> After that I still can snmpwalk on KEEPALIVED-MIB::vrrp and get
> informations about the first one.
> 
> 
> Note that it doesn't matter which of keepalived starts first. The one
> which will start first, will get registered.
> 
> 
> 
> 
> I'm starting my keepalived with:
> 
> keepalived -f /run/conf/keepalived.conf -D -x -n -l
> 
> 
> (each network namespace has separated /run directory)
> 

I've never used network namespaces, so my comments are based on reading
information available on the internet.

First of all, keepalived isn't network namespace aware (I like the look
of the network namespaces so I'll make provide a patch to make it
namespace aware). On the basis that it isn't currently namespace aware,
it appears to me that you need to run it as follows:

ip netns exec NETNS_NAME1 keepalived -f /run/conf/keepalived.conf -D -x
-n -l

and the second instance as:
ip netns exec NETNS_NAME2 keepalived -f /run/conf/keepalived.conf -D -x
-n -l

You will also need to run separate instances of snmpd for each instance
of keepalived, since the same MIB cannot be registered by difference sub
agents with the same instance of snmpd.

By default, keepalived communicates with snmpd via the Unix domain
socket /var/agentx/master. Since the keepalived instances are already in
separate network namespaces, it might be simplest to specify:
snmp_socket udp:127.0.0.1:161
in the global section of the keepalived configurations so that
keepalived uses network communication with snmpd, which of course will
be in the separate network namespaces. 2 instances of snmpd will need to
be run prior to running the keepalvied instances, using ip netns
NETNS_NAME1 snmpd ... and ip netns NETNS_NAME2 snmpd ... (or use nsenter
for the keepalived processes to run in the same network namespaces as
the snmpd instances). 

An alternative would be to use different unix domain sockets,
e.g. /var/agentx/master1 and /var/agentx/master2 (specified with the -x
option to snmpd) and configured in keepalived with "snmp_socket
unix:/var/agentx/master1" etc in the global section of the keepalived
configs.

A further option might be to run each instance of snmpd in a separate
IPC namespace, and then use nsenter to run the keepalived processes in
the same IPC namespaces as the snmpd processes.

I hope that helps, and that some of the above works.

Quentin Armitage

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev

_______________________________________________
Keepalived-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/keepalived-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.