NetXMS Support Forum

English Support => General Support => Topic started by: Zebble on February 04, 2021, 11:25:19 PM

Title: Web Service DCI howto?
Post by: Zebble on February 04, 2021, 11:25:19 PM
I can't seem to get an agent to execute a web service check.  It seems fairly simple:  Define the Web Service Definition, then add it as a DCI for a specific agent, including the additional web service path (ie. webservice:/path) as the URL.

It seems to add the DCI and mark it as greent, but never does anything on the agent side if I enable debugging.

I'm using 3.7.145 on the server, 3.7.130 on the agent.

-Zeb
Title: Re: Web Service DCI howto?
Post by: Filipp Sudanov on February 05, 2021, 04:13:43 PM
A possible way to debug here is nxwsget command line app that is included with the server. This way you can isolate, whether the problem is on agent or on the server side. E.g.:
nxwsget 127.0.0.1 http://api.open-notify.org/astros.json number
Title: Re: Web Service DCI howto?
Post by: Zebble on February 05, 2021, 11:12:17 PM
Thanks Filipp, this definitely helped narrow down the problem.

It looks like Web Services require the netsvc.nsm subagent.  netsvc.nsm doesn't appear to be included in the pre-packaged agents, so needs to be built from source.  Any chance of having this included in the pre-packaged agents so this can be easily installed and centrally updated through the standard methods?

A question on nxwsget.  Can it also use a proxy agent to make the call, if that proxy agent is connected via a tunnel (ie. agent -> server tunnel)?

Finally, slightly related but is the asterisk.nsm subagent available anymore?  It appears that the libosip2/libXosip2 library dependency is really old and unsupported with newer version of openssl, so is difficult to build on more modern build environments.

-wade


Title: Re: Web Service DCI howto?
Post by: Victor Kirhenshtein on February 09, 2021, 01:59:04 PM
Quote from: Zebble on February 05, 2021, 11:12:17 PM
Finally, slightly related but is the asterisk.nsm subagent available anymore?  It appears that the libosip2/libXosip2 library dependency is really old and unsupported with newer version of openssl, so is difficult to build on more modern build environments.

Asterisk subagent is supported. We provide binary builds for all supported Debian and Ubuntu versions. Ubuntu 20 does not have libexosip2 package, but when you install Asterisk subagent from our repository it will bring our build of libexosip2. If you build from sources, you can download and build libosip2 and libexosip2 version 5.2.0 - they are fairly new and seems to be building without issues on modern distributions.

Best regards,
Victor
Title: Re: Web Service DCI howto?
Post by: Filipp Sudanov on February 09, 2021, 02:56:56 PM
netsvc should not be required for web services. It should be present in netxms-agent package, please check output of
dpkg-query -L netxms-agent
If its not there, what is the version of OS?

No, nxget, nxaction, nxwsget do not support tunnel connection - they attempt to connect to agent directly.
Title: Re: Web Service DCI howto?
Post by: Zebble on February 11, 2021, 04:30:28 PM
Quote from: Victor Kirhenshtein on February 09, 2021, 01:59:04 PM
Quote from: Zebble on February 05, 2021, 11:12:17 PM
Finally, slightly related but is the asterisk.nsm subagent available anymore?  It appears that the libosip2/libXosip2 library dependency is really old and unsupported with newer version of openssl, so is difficult to build on more modern build environments.

Asterisk subagent is supported. We provide binary builds for all supported Debian and Ubuntu versions. Ubuntu 20 does not have libexosip2 package, but when you install Asterisk subagent from our repository it will bring our build of libexosip2. If you build from sources, you can download and build libosip2 and libexosip2 version 5.2.0 - they are fairly new and seems to be building without issues on modern distributions.

Best regards,
Victor

For the most part, we're using CentOS so we use the linux x86_64 tar for installation, and the APKG packages and the Package Manager for subsequent updates.  The APKG doesn't appear to have the SSH or Asterisk (or some other subagents) installed.  Any chance these will get added to the APKG and tar installation/update methods?

I was able to build the Asterisk subagent finally after searching for libosip2 and libexosip2 version 5.2.0 as you noted.  Not very easy to find!   The subagent works really, really well so far.  Gives us a lot of metrics that often require very expensive tools to monitor.  Nice work!

-zeb
Title: Re: Web Service DCI howto?
Post by: Zebble on February 11, 2021, 04:51:08 PM
Quote from: Filipp Sudanov on February 09, 2021, 02:56:56 PM
netsvc should not be required for web services. It should be present in netxms-agent package, please check output of
dpkg-query -L netxms-agent
If its not there, what is the version of OS?

No, nxget, nxaction, nxwsget do not support tunnel connection - they attempt to connect to agent directly.

Hi Filipp,

We're running mostly on CentOS so we use the tar/APKG packages and there isn't a "netxms-agent" package installed per se.

If I do a nxwsget from the server to one of these agents, I get a "501: Not implemented" error.

I'm not sure what I'm missing.

I did get web services to work on this agent though, just not using nxwsget and the example you provided (nxwsget <ip of agent> http://api.open-notify.org/astros.json number)

-zeb
Title: Re: Web Service DCI howto?
Post by: Filipp Sudanov on February 12, 2021, 04:20:56 PM
Ah, I was thinking of .deb packages.

Generic builds are limited to use only dependencies that are available everywhere. That's why curl, ssh and asterisk stuff is not included. Web services are depending on curl.

We will try to prepare a build that would be suitable for Centos 7/8.
Title: Re: Web Service DCI howto?
Post by: Zebble on February 12, 2021, 04:56:04 PM
Thanks Filipp,

What's the best practice for updates when using agents with deb packages then?  We can't use the Package Manager in NetXMS for these updates and will need to rely on the OS update methods?
Title: Re: Web Service DCI howto?
Post by: Filipp Sudanov on February 17, 2021, 07:19:45 AM
For Debuan/Ubuntu the best practice is to install and upgrade by means of OS package manager (apt / apt-get). There are tools to automate deployment of packages like Puppet, Chef, etc.

Installing using apt and upgrading from NetXMS Package Manager should not be done - location of binary/configuration/log file could be different and there'll be mess on the target system.