Subagents
Subagents extend the NetXMS agent with additional monitoring capabilities. Each subagent is a loadable module (shared library) that registers new metrics, lists, tables, and actions with the agent.
For metrics provided by the agent core and subagents, see Agent Metrics Reference. For agent configuration file syntax, see Agent Configuration.
Loading Subagents
Subagents are loaded through the agent configuration file:
SubAgent = logwatch.nsm
SubAgent = filemgr.nsm
SubAgent = dbquery.nsm
The .nsm extension is the standard subagent module extension (NetXMS Subagent Module).
On UNIX-like systems, the agent searches for subagent files in its library directory (typically /usr/lib/netxms on Linux).
On Windows, subagent DLLs are installed into the agent’s bin directory and found through the default DLL search path.
Subagents can also be loaded via agent configuration policies (see Agent Policies).
Platform Subagents
Platform subagents provide operating system-specific metrics. They are the primary source for OS monitoring data:
| Subagent | Platform | Description |
|---|---|---|
|
Linux |
CPU, memory, disk, network, process metrics for Linux systems |
|
Windows |
System metrics for Windows |
|
FreeBSD |
System metrics for FreeBSD |
|
NetBSD |
System metrics for NetBSD |
|
OpenBSD |
System metrics for OpenBSD |
|
Solaris |
System metrics for Solaris/SunOS |
|
AIX |
System metrics for IBM AIX |
|
macOS |
System metrics for macOS |
The platform subagent is loaded automatically on all platforms: on UNIX-like systems the agent derives the module name from the operating system name reported by uname (e.g., linux.nsm), and on Windows it loads winnt.nsm (a separate module, not built into the agent).
An explicit SubAgent entry for the platform subagent is unnecessary when automatic loading is enabled.
|
Feature Subagents
Feature subagents add specific monitoring capabilities:
| Subagent | Description |
|---|---|
|
AI file operations — provides file search and content analysis tools for the AI assistant. See AI Assistant. |
|
Asterisk PBX monitoring — collects call statistics, channel data, and SIP registration status. See Asterisk Monitoring. |
|
BIND 9 DNS — collects BIND 9 DNS server statistics. |
|
Database query — executes SQL queries against databases and returns results as metrics. See Database Monitoring. |
|
Device emulator — emulates devices for testing purposes. |
|
DS18x20 temperature sensors — reads temperature from 1-Wire DS18x20 sensors. See Hardware Monitoring. |
|
Deprecated — legacy alias for |
|
ENTSO-E — collects European electricity market and grid data from the ENTSO-E Transparency Platform. |
|
Framebuffer screenshots — captures screenshots from the Linux framebuffer device. |
|
Remote file management — browse, view, download, and upload files on the agent host. See Remote File Management. |
|
GPS receiver — reads location data from GPS devices connected via serial port. |
|
IBM Informix monitoring — collects database metrics. See Database Monitoring. |
|
Java subagent — loads Java-based monitoring plugins (Docker, JMX, OPC UA, Ubiquiti LiteWave). See Java Subagent below. |
|
lldpd integration — provides LLDP topology information collected by the |
|
lm-sensors — reads hardware sensor data via Linux lm-sensors. See Hardware Monitoring. |
|
Log file monitoring — watches log files for patterns and generates events. See Log Monitoring. |
|
MongoDB — monitors MongoDB instances. See Database Monitoring. |
|
MQTT client — subscribes to MQTT topics and collects data from IoT brokers. |
|
Microsoft SQL Server monitoring — collects SQL Server database metrics. See Database Monitoring. |
|
MySQL monitoring — collects MySQL/MariaDB database metrics. See Database Monitoring. |
|
NETCONF — communicates with network devices using the NETCONF protocol. |
|
Network service checks — HTTP, SMTP, POP3, SSH, and custom TCP service monitoring. See Service Monitoring. |
|
Open-Meteo — collects weather data from the Open-Meteo service. |
|
Oracle Database monitoring — collects Oracle database metrics. See Database Monitoring. |
|
PostgreSQL monitoring — collects PostgreSQL database metrics. See Database Monitoring. |
|
ICMP ping from the agent — allows the agent to perform ping checks to specified targets. See ICMP Monitoring. |
|
Deprecated — legacy alias for |
|
Prometheus exporter — scrapes Prometheus-format metrics endpoints. |
|
Redis monitoring — collects Redis server metrics. |
|
Raspberry Pi — reads GPIO, temperature, and voltage metrics from Raspberry Pi. See Hardware Monitoring. |
|
SMS sending — sends SMS messages through a serial GSM modem. |
|
SSH monitoring — executes commands on remote hosts via SSH. See SSH Monitoring. |
|
Oracle Tuxedo — monitors Oracle Tuxedo middleware. |
|
UPS monitoring — collects data from UPS devices via USB or serial connections. See UPS Monitoring. |
|
Virtual Machine Manager — monitors hypervisors (VMware, Xen, KVM). See Hypervisor Monitoring. |
|
Windows Event Log synchronization — forwards Windows Event Log entries to the server (Windows only). See Windows Event Log. |
|
Windows performance counters — provides access to all Windows performance counter objects (Windows only). |
|
WMI queries — executes WMI queries on Windows systems (Windows only). |
|
Xen hypervisor — monitors Xen virtualization hosts. |
Java Subagent
The Java subagent (java.nsm) provides a framework for loading Java-based monitoring plugins within the agent process.
It starts a JVM inside the agent and loads plugin JAR files.
Java Subagent Configuration
SubAgent = java.nsm
[JAVA]
JVM = /usr/lib/jvm/java-17/lib/server/libjvm.so
JVMOptions = -Xmx256m
ClassPath = /opt/netxms/java/plugins/*
Plugin = jmx.jar
Plugin = docker.jar
| Parameter | Default | Description |
|---|---|---|
|
|
Full path to the JVM shared library. The default is the bare library name ( |
|
(none) |
JVM command-line options (e.g., |
|
(none) |
Additional entries for the Java classpath. Can be specified multiple times. Supports wildcards. |
|
(none) |
Java plugin JAR file to load. Can be specified multiple times. |
Available Java Plugins
| Plugin | Description |
|---|---|
|
Docker container monitoring — collects container metrics and status. |
|
JMX monitoring — connects to Java applications via JMX and collects MBean attributes. See JVM Monitoring. |
|
OPC UA client — reads data from OPC UA servers (industrial automation). |
|
Ubiquiti LiteWave — monitors Ubiquiti LiteWave devices. |
The ExternalSubagent configuration parameter is not related to Java plugins.
It registers a standalone external subagent connection by name, optionally restricted to an OS user: ExternalSubagent = name[:allowed OS user].
|
Subagent Configuration
Some subagents require additional configuration sections in the agent configuration file.
A section header is written either as *SECTION or [SECTION]:
SubAgent = dbquery.nsm
[DBQUERY]
Database = id=mydb;driver=pgsql;server=db.example.com;dbname=appdb;login=monitor;password=secret
Query = AppUsers:mydb:SELECT count(*) FROM active_users
Each subagent documents its configuration options. Refer to the specific monitoring module documentation for configuration details.
Listing Available Metrics
To see all metrics provided by loaded subagents, query the agent remotely using nxget:
nxget -I <agent_address>
This lists all metrics, lists, and tables registered by the agent core and all loaded subagents.
From the management client, available metrics can also be browsed in the metric selection dialog when creating or editing a DCI — the list shows all metrics reported by the agent, including those from subagents.
Writing Custom Subagents
Custom subagents can be written in C/C++ using the NetXMS subagent SDK. A subagent implements the standard subagent interface and registers its metrics with the agent framework.
The subagent API provides functions for:
-
Registering metrics (single value metrics)
-
Registering lists (multi-value metrics)
-
Registering tables (tabular data)
-
Registering actions (executable commands)
-
Accessing agent configuration
-
Sending events to the server
For external scripts and tools, consider using external metrics and actions in the agent configuration instead of writing a native subagent. See Agent Configuration for details on external metrics.
Development Resources
The NetXMS source code includes example subagents and the full SDK headers. The recommended approach for developing custom subagents:
-
Clone the NetXMS source repository
-
Study the existing subagent implementations under
src/agent/subagents/for patterns and best practices -
Use the subagent header files in
include/for the API definitions -
Build using the NetXMS build system
For most monitoring extensions, external metrics (ExternalMetric, ExternalList, ExternalTable) or NXSL scripts provide a simpler alternative to writing native subagents.
Troubleshooting Subagents
Subagent Fails to Load
Check the agent log for error messages:
[ERROR] Cannot load subagent "mysubagent.nsm": libmylib.so: cannot open shared object file
Common causes:
-
Missing shared library dependencies — install required libraries
-
Wrong architecture — the subagent must match the agent’s architecture (32-bit vs 64-bit)
-
Incorrect file path — verify the module exists in the agent’s library directory
Subagent Metrics Not Available
-
Verify the subagent is loaded: query remotely with
nxget -I <agent_address>to check if expected metrics are available -
Check if the subagent requires a configuration section (e.g.,
[DBQUERY]) -
Restart the agent after configuration changes
-
Check agent log for subagent initialization errors