API IN C for agent communication

Started by ophelie6989, November 10, 2009, 09:33:15 PM

Previous topic - Next topic

ophelie6989

Hello,

I want to know if there is an API in C to develop our own communication channel with the agents. I mean, without using the dashboard. We have a custom application (for customer use) which does snmp requests to collect information on servers/workstations and we want to use the data collected by GFI Max agents to get more detailed informations that we cannot collect with snmp (like hard drive usage, services running, etc...). Is there a way to do that ? Will there be a way to do that in the future ?

Thanks,

Victor Kirhenshtein

Hello!

API is available, but for C++, not plain C. You will need libnxsrv and all it dependencies to use it. API is not documented, but is very straightforward:

1. You should create object if class AgentConnection;
2. Call Connect() method for it;
3. Call GetParameter() method to retrieve data from agent (you can call GetParameter multiple times to retrieve multiple parameters);
4. Destroy connection object.

There are command line tool called nxget which can be used to retrieve data from agents. You can use nxget's source code as a reference to build your own communication tool.

Best regards,
Victor

ophelie6989

Ok thanks.

Do you know if we can use this libnxsrv library on openBSD ? If so, i guess we can download it. It would be great.

Thank you

Victor Kirhenshtein

Yes, it should work on OpenBSD.

Best regards,
Victor

ophelie6989

Ok, i'll look into it. The thing is, when we install agents, for example agent for Windows x86, during setup it asks for IP address of NetXMS server. But I just want to install the agent and communicate with it, without going through any NetXMS server. Is it possible ?

Alex Kirhenshtein

#5
It's required to generate initial configuration file for an agent, to set access control settings - basically it's an address which is allowed to get data from the agent.

Check nxagentd.conf sample (provided in distribution, you can take a look at https://svn.netxms.org/public/netxms/trunk/contrib/nxagentd.conf-dist), especially parameters: Server, ControlServers, and MasterServers.

ophelie6989

Ok. Sorry for my misunderstanding. I just installed the agent and my (last) question is : if I configured the nxagentd.conf by myself, will I be able to communicate with the agent without installing the NetXMS Server and Console ?
(for example I will put the IP address of the server running my own application in Servers and ControlServers fields).
(I can see the agent running as a Windows Service and during the setup, I left the NetXMS Server field blank, so I guess I should be able to talk to the agent now..)

Thank you again,

Alex Kirhenshtein

Yes, you do not need server or console in this case.