Author Topic: Agent on FreeBSD  (Read 2161 times)

zillo

  • Newbie
  • *
  • Posts: 4
    • View Profile
Agent on FreeBSD
« on: May 20, 2014, 10:52:49 am »
Hi,

I try to run the NetXMS Agent on FreeBSD under a normal user (non-root).
First, for this to be possible, this user must be member in kmem group in order for kvm_openfiles and kvm_read operations to properly work.
With this settings, now the Net.Interface.BytesIn and related probes properly return the value requested by DCIs.

I still have some problem and questions.
When I start the Agent as root (with DebugLevel 9) the log looks clean. This is not the case when I start the Agent as normal user (non-root).
In the latest case I see log like this:
Quote
[20-May-2014 09:26:08.827] [DEBUG] External parameters providers poller thread will not start
[20-May-2014 09:26:08.828] [DEBUG] Core Agent Trying to bind on 0.0.0.0:4700
[20-May-2014 09:26:08.828] [INFO ] Listening on socket 0.0.0.0:4700
[20-May-2014 09:26:08.828] [DEBUG] StorageDiscoveryConnector: bind failed (Address already in use)
[20-May-2014 09:26:08.828] [DEBUG] StorageDiscoveryConnector: listener thread stopped
[20-May-2014 09:26:08.828] [DEBUG] PushConnector: bind failed (Address already in use)
[20-May-2014 09:26:08.828] [DEBUG] PushConnector: listener thread stopped
[20-May-2014 09:26:09.829] [INFO ] NetXMS Agent started

I was trying to see why StorageDiscoveryConnector and PushConnector failed. I need to understand exactly what this are need for.
I have surfing the code and in the src/agent/core/nxagentd.cpp file beginning from line no 917 (Agent start time), I have found an if/else test which run in one case "MasterAgentListener" and in the other "ListenerThread" and "SessionWatchdog". In this second case there is call to StartPushConnector and StartStorageDiscoveryConnector which I have found to log the "bind failed" error seen in the log.

I try to debug and hope to fix this, but I need some explanation from the developers as why this test is there and what are the differences between those different executions path. I will love to learn more about the code and I try to do this reading the sources, but a little help here will be mode than welcomed.

My real problem is that I still can not use the FreeBSD NetXMS Agent as proxy for other agents. At this moment I try to find the problem by myself and right now it is not clear for me if the proxy problem can be related to the above error ("bind failed") and different execution path.

Info:
NetXMS Agent & Server 1.2.14 on (uname -a):
FreeBSD amstel.DOMAIN.TLD 9.2-STABLE FreeBSD 9.2-STABLE #0 r264299: Thu Apr 10 01:10:40 EEST 2014
NetXMS Agent 1.2.7 - 1.2.14 on different platform including (uname -a):
FreeBSD neo.DOMAIN.TLD 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Thu Sep 26 22:50:31 UTC 2013

Thanks,
V.V.

Victor Kirhenshtein

  • Lead Developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 7010
    • View Profile
Re: Agent on FreeBSD
« Reply #1 on: May 20, 2014, 06:52:42 pm »
Hi!

Storage discovery connector is part of not finished feature and can be safely ignored. Push connector used by nxapush command line tool to push DCI values through agent's connection with server. Both are using UNIX sockets, with file names /tmp/.nxagentd.push and /tmp/.nxagentd.sd. Most likely they was left on file system and owned by root - this is why agent cannot open them as non-root user.

Line

if (g_dwFlags & AF_SUBAGENT_LOADER)

determines two execution paths depending on agent mode - is it master agent (the default one) or external subagent loader. NetXMS agent can be divided into multiple processes usually run under different accounts - in that case one is a master and others are external subagent loaders. External loaders communicates with master using UNIX sockets.

Best regards,
Victor