Web Services Monitoring
NetXMS can monitor web services and REST APIs by sending HTTP requests and extracting data from JSON, XML, or text responses. This enables monitoring of cloud services, microservices, application APIs, and any system exposing an HTTP interface.
Overview
Web service monitoring in NetXMS provides:
-
HTTP/HTTPS request execution with configurable methods, headers, and authentication
-
Response data extraction using jq expressions, XPath, or regular expressions
-
Centralized web service definition with reuse across multiple DCIs
Web Service Definitions
Web service definitions are created in the management client and can be reused across multiple nodes and DCIs.
Creating a Web Service Definition
-
In the management client, go to Configuration > Web Service Definitions
-
Click Create
-
Configure the web service properties
Properties
| Property | Description |
|---|---|
Name |
Descriptive name for the web service |
Description |
Optional free-form description |
URL |
HTTP/HTTPS URL to request (supports macro substitution) |
HTTP request method |
GET, POST, PUT, DELETE, PATCH |
Request data |
Request body for POST/PUT methods (sent as-is, without macro substitution) |
Authentication |
NONE, BASIC, DIGEST, NTLM, BEARER, ANY, or ANYSAFE |
Verify peer’s certificate |
Whether to validate the server’s SSL certificate |
Verify host name in certificate |
Whether to verify the hostname in the certificate |
Follow location header in a 3xx response |
Follow HTTP redirects (3xx responses) |
Process response as plain text |
Do not parse the response as JSON or XML; values are extracted with regular expressions |
Cache retention time |
How long to cache responses (seconds). Multiple DCIs querying the same service within this period reuse the cached response. |
Request timeout |
HTTP request timeout in seconds (0 = default of 10 seconds) |
Custom HTTP headers are configured as name/value pairs on the separate Headers property page.
URL Macros
The URL and header values support macro substitution (the request body is sent as-is, without macro expansion):
| Macro | Description |
|---|---|
|
Name of the target object |
|
Primary IP address of the target node |
|
Value of the custom attribute |
|
Arguments given in the DCI metric ( |
The same macros are available in header values configured on the Headers property page.
Example URL with macros (deviceId is a custom attribute of the node):
https://api.example.com/v1/status/%{deviceId}
Data Extraction
JSON (jq)
For JSON responses, use jq expressions to extract values:
Given this response:
{
"status": "healthy",
"uptime": 86400,
"metrics": {
"cpu": 45.2,
"memory": 72.8,
"connections": 150
}
}
jq examples:
| jq expression | Result |
|---|---|
|
|
|
|
|
|
|
|
Legacy slash-separated paths (e.g. /metrics/cpu) are automatically converted to jq expressions.
Creating Web Service DCIs
-
Create a DCI on the target node
-
Set origin to Web Service
-
In the Metric field, enter
serviceName:pathorserviceName(arg1,arg2):path, whereserviceNameis the name of the web service definition, the optional arguments are available in the URL and request body as%1–%99, andpathis the extraction expression (jq, XPath, or regular expression) -
Set the data type according to the expected value
Multiple DCIs can use the same web service definition with different extraction paths, and the response caching prevents redundant HTTP requests.
Authentication
Supported authentication types: NONE, BASIC, DIGEST, NTLM, BEARER, ANY (a suitable supported method is selected automatically), and ANYSAFE (a suitable secure method is selected automatically).
Username and password configured in the web service definition are used by all types except BEARER, which instead sends the configured token in the Authorization: Bearer <token> header.
For services that expect an API key in a custom header, add a header on the Headers property page, e.g. name X-API-Key with the key as the value.
Monitoring HTTP Response Properties
HTTP response code, request duration, and certificate expiration are not available through web service DCIs. To monitor them, use the NETSVC subagent metrics with agent origin instead:
-
NetworkService.Status(url)andNetworkService.ResponseTime(url)— response check and timing -
TLS.Certificate.ExpiresIn(hostname, port)andTLS.Certificate.ExpirationDate(hostname, port)— SSL/TLS certificate expiration
Troubleshooting
Connection Errors
-
Requests are executed by the agent acting as web service proxy — the web service proxy configured for the node, or the NetXMS server’s own agent when none is configured. Verify the URL is accessible from that agent’s host.
-
Check firewall and proxy settings
-
Verify SSL certificate if HTTPS is used
-
Check authentication credentials