NetXMS Support Forum

English Support => General Support => Topic started by: ophelie6989 on November 10, 2009, 09:33:15 PM

Title: API IN C for agent communication
Post by: ophelie6989 on November 10, 2009, 09:33:15 PM
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,
Title: Re: API IN C for agent communication
Post by: Victor Kirhenshtein on November 10, 2009, 11:10:34 PM
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
Title: Re: API IN C for agent communication
Post by: ophelie6989 on November 10, 2009, 11:22:24 PM
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
Title: Re: API IN C for agent communication
Post by: Victor Kirhenshtein on November 10, 2009, 11:26:56 PM
Yes, it should work on OpenBSD.

Best regards,
Victor
Title: Re: API IN C for agent communication
Post by: ophelie6989 on November 10, 2009, 11:57:45 PM
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 ?
Title: Re: API IN C for agent communication
Post by: Alex Kirhenshtein on November 11, 2009, 12:47:53 AM
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.
Title: Re: API IN C for agent communication
Post by: ophelie6989 on November 11, 2009, 05:18:12 PM
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,
Title: Re: API IN C for agent communication
Post by: Alex Kirhenshtein on November 11, 2009, 05:52:13 PM
Yes, you do not need server or console in this case.