Database Monitoring
NetXMS provides two approaches to database monitoring:
-
Custom SQL queries via the Database Query subagent (
dbquery.nsm) — execute arbitrary SQL and collect results as metrics -
Dedicated database subagents — pre-built metrics for Oracle, MySQL, PostgreSQL, MongoDB, Informix, and Microsoft SQL Server
Database Query Subagent
The dbquery.nsm subagent runs on the NetXMS agent and executes SQL queries against configured databases.
Database Connection Configuration
Configure database connections using [DBQUERY/Databases/id] sections in the agent configuration file, where id is the unique connection identifier used in query definitions:
*[DBQUERY/Databases/mydb]
Driver = pgsql
Server = db.example.com
Name = appdb
Login = monitor
Password = your_password
*[DBQUERY/Databases/oracle1]
Driver = oracle
Server = ora.example.com/ORCL
Login = monitor
Password = your_password
Connection section parameters:
| Parameter | Description |
|---|---|
|
Database driver (see Supported Database Drivers) |
|
Database server address (hostname:port or connection string) |
|
Database name |
|
Database user name |
|
Database password (supports passwords obfuscated with |
|
Additional driver-specific parameters |
The legacy semicolon-delimited Database = id=…;driver=…;server=… format in [DBQUERY] section is deprecated. Use [DBQUERY/Databases/id] sections instead.
|
Supported Database Drivers
| Driver | Database | Notes |
|---|---|---|
|
PostgreSQL |
Native driver, recommended |
|
MySQL |
Native driver |
|
MariaDB |
Native driver |
|
Oracle |
Requires Oracle client libraries |
|
Microsoft SQL Server |
ODBC-based; Windows only |
|
IBM Informix |
Requires Informix client libraries (CSDK) |
|
SQLite |
Local file-based databases |
|
Any ODBC source |
Requires ODBC driver manager and appropriate driver |
Query Configuration
Background-Polled Queries
Define queries that are executed periodically in the background:
*[DBQUERY]
Query = ActiveUsers:appdb:60:SELECT count(*) FROM sessions WHERE active = true
Query = OrdersToday:appdb:300:SELECT count(*) FROM orders WHERE created_at >= CURRENT_DATE
Query = AvgResponseTime:appdb:30:SELECT avg(response_ms) FROM api_calls WHERE ts > now() - interval '5 minutes'
Query format: Name:DatabaseID:Interval:SQL
-
Name— query name used to retrieve results via metrics -
DatabaseID— connection ID defined in[DBQUERY/Databases/id]section -
Interval— polling interval in seconds (1—86400) -
SQL— SQL query to execute (must return a single value — first column of the first row)
By default, a query returning an empty result set is treated as success; set AllowEmptyResultSet = false in the [DBQUERY] section to treat empty results as an error.
Agent Metrics for Polled Queries
Each polled query provides several metrics:
| Metric | Description |
|---|---|
|
Last query result value |
|
Last execution status (native SQL error code) |
|
Last execution status as text |
|
Last execution duration in milliseconds |
|
Re-executes the query synchronously and returns the fresh result; unlike |
Example DCI configuration:
-
Origin: Agent
-
Metric:
DB.QueryResult(ActiveUsers) -
Data type: Integer
Configurable Queries
Configurable queries are executed on demand (synchronously) and can accept parameters:
*[DBQUERY]
ConfigurableQuery = TableSpaces:appdb:Tablespace information:SELECT tablespace_name, size_mb, used_mb, free_mb FROM dba_tablespace_usage
ConfigurableQuery = TableSize:appdb:Table size in bytes:SELECT pg_total_relation_size(?)
ConfigurableQuery format: Name:DatabaseID:Description:SQL
-
Name— query name used as the metric name -
DatabaseID— connection ID defined in[DBQUERY/Databases/id]section -
Description— description shown in agent metric listing -
SQL— SQL query to execute (use?as bind variable placeholders)
Configurable queries are registered as Name(*), so they are always invoked with parentheses (empty if the query takes no bind variables):
TableSpaces() TableSize(orders)
Table Queries
Both polled and configurable queries that return multiple rows can be accessed as table DCIs. Direct table queries are also supported:
| Table Metric | Description |
|---|---|
|
Direct table query (on demand) |
|
Result table from a polled query |
|
Result table from a polled query (re-executes the query synchronously) |
|
Result table from a configurable query |
Table queries with column metadata (data types, instance columns) can also be defined in [DBQUERY/Tables/<name>] sections.
Database-Specific Query Examples
PostgreSQL
-- Active connections
SELECT count(*) FROM pg_stat_activity WHERE state = 'active';
-- Database size in MB
SELECT pg_database_size(current_database()) / 1048576;
-- Replication lag in seconds
SELECT EXTRACT(EPOCH FROM replay_lag) FROM pg_stat_replication;
-- Cache hit ratio
SELECT round(100.0 * sum(blks_hit) / sum(blks_hit + blks_read), 2) FROM pg_stat_database;
MySQL / MariaDB
-- Active connections
SELECT count(*) FROM information_schema.processlist;
-- Slow queries
SELECT variable_value FROM performance_schema.global_status WHERE variable_name = 'Slow_queries';
-- Replication lag requires SHOW REPLICA STATUS (MySQL 8.0.22+) or SHOW SLAVE STATUS;
-- these cannot be used as subqueries, so use an ExternalParameter wrapper script instead
Microsoft SQL Server
-- Active connections
SELECT count(*) FROM sys.dm_exec_sessions WHERE is_user_process = 1;
-- Database size in MB
SELECT SUM(size * 8 / 1024) FROM sys.master_files WHERE database_id = DB_ID();
-- Buffer cache hit ratio
SELECT CAST(a.cntr_value AS FLOAT) / CAST(b.cntr_value AS FLOAT) * 100
FROM sys.dm_os_performance_counters a
JOIN sys.dm_os_performance_counters b ON a.object_name = b.object_name
WHERE a.counter_name = 'Buffer cache hit ratio'
AND b.counter_name = 'Buffer cache hit ratio base';
Oracle Subagent
The Oracle subagent (oracle.nsm) provides pre-built metrics for monitoring Oracle Database instances including tablespace usage, session counts, performance ratios, ASM disk groups, and critical statistics.
Prerequisites
-
Oracle client libraries installed on the agent host
-
Oracle user with
select_catalog_rolegranted:GRANT select_catalog_role TO netxms_monitor;
Configuration
Each monitored database is defined in its own [oracle/connections/<id>] section.
The last part of the section name becomes the connection identifier used in metric arguments.
Any number of connections can be configured:
[oracle/connections/proddb]
Endpoint = ORCL
Login = netxms_monitor
Password = your_password
[oracle/connections/reports]
Endpoint = REPDB
Login = netxms_monitor
Password = your_password
A single connection can also be configured in the plain [ORACLE] section using the same keys.
Configuration Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
|
String |
Last part of the section name |
Connection identifier used in metric arguments (in the |
|
String |
(required) |
Oracle TNS name or connection string |
|
String |
(required) |
Database user name |
|
String |
(none) |
Database password (can be obfuscated with |
|
String |
(none) |
Database password obfuscated with |
|
Integer |
3600 |
Connection lifetime in seconds; connection is closed and reopened after this period |
|
String |
(none) |
Additional options passed to the Oracle database driver (set in the |
If the password contains a # character, enclose it in quotes.
|
Legacy configuration forms — numbered database sections (limited to 64 instances) and the Name, TnsName, and UserName key aliases — still work but are deprecated (usage is reported in the agent log at debug level 3).
|
Metrics
All metrics are collected once per minute. Recommended DCI poll interval: 60 seconds or more.
Database Information
| Parameter | Type | Description |
|---|---|---|
|
String |
Database is reachable (YES/NO) |
|
String |
Database name |
|
String |
Database creation date |
|
String |
Log mode (ARCHIVELOG/NOARCHIVELOG) |
|
String |
Database open mode |
|
String |
Database version |
Instance Information
| Parameter | Type | Description |
|---|---|---|
|
String |
DBMS version |
|
String |
Instance status |
|
String |
Archiver status |
|
String |
Shutdown pending (YES/NO) |
Critical Statistics
| Parameter | Type | Description |
|---|---|---|
|
String |
Auto archiving off (YES/NO) |
|
Int64 |
Datafiles needing media recovery |
|
Int64 |
Cumulative deadlocks |
|
Integer |
Offline datafiles |
|
Int64 |
Failed jobs |
|
Int64 |
Segments that cannot extend |
|
Int64 |
Rollback segments not online |
|
Integer |
Offline tablespaces |
Performance Metrics
| Parameter | Type | Description |
|---|---|---|
|
String |
Data buffer cache hit ratio (%) |
|
String |
Dictionary cache hit ratio (%) |
|
String |
Library cache hit ratio (%) |
|
String |
PGA memory sort ratio (%) |
|
String |
Dispatcher workload (%) |
|
String |
Rollback segment wait ratio (%) |
|
Int64 |
Free space in shared pool (bytes) |
|
Int64 |
Number of locks |
|
Int64 |
Logical reads |
|
Int64 |
Physical reads |
|
Int64 |
Physical writes |
Session Metrics
| Parameter | Type | Description |
|---|---|---|
|
Integer |
Total open sessions |
|
Integer |
Sessions by Oracle user |
|
Integer |
Sessions by schema |
|
Integer |
Sessions by program |
Cursor Metrics
| Parameter | Type | Description |
|---|---|---|
|
Integer |
Open cursors system-wide |
|
Integer |
Maximum cursors per session |
Tablespace Metrics
Requires Oracle 10.0+.
| Parameter | Type | Description |
|---|---|---|
|
String |
Tablespace status |
|
String |
Tablespace type |
|
String |
Logging mode |
|
Integer |
Block size |
|
Integer |
Number of data files |
|
Int64 |
Total size (bytes) |
|
Int64 |
Used space (bytes) |
|
Integer |
Used space (%) |
|
Int64 |
Free space (bytes) |
|
Integer |
Free space (%) |
Data File Metrics
Requires Oracle 10.2+.
| Parameter | Type | Description |
|---|---|---|
|
String |
Data file status |
|
String |
Full path |
|
String |
Tablespace name |
|
Int64 |
Size in bytes |
|
Int64 |
Size in blocks |
|
Integer |
Block size |
|
Int64 |
Physical reads |
|
Int64 |
Physical writes |
|
Int64 |
Total read time (ms) |
|
Int64 |
Total write time (ms) |
|
Integer |
Average I/O time (ms) |
|
Integer |
Minimum I/O time (ms) |
|
Integer |
Maximum read time (ms) |
|
Integer |
Maximum write time (ms) |
ASM Disk Group Metrics
Requires Oracle 11.1+.
| Parameter | Type | Description |
|---|---|---|
|
String |
Disk group state |
|
String |
Disk group type |
|
String |
Total space |
|
String |
Free space |
|
String |
Free space (%) |
|
String |
Used space |
|
String |
Used space (%) |
|
String |
Offline disks |
Lists
| List | Description |
|---|---|
|
Configured connection identifiers |
|
All tablespaces |
|
All data files |
|
All ASM disk groups |
|
All data collection tags available on the connection |
Tables
| Table | Columns |
|---|---|
|
SID, User, Schema, OS User, Machine, Status, Process, Program, Type, State, Service |
|
Name, ID, Full name, Tablespace, Status, Bytes, Blocks, Block size, Physical Reads, Physical Writes, Read Time, Write Time, Avg I/O Time, Min I/O Time, Max Read Time, Max Write Time |
|
Name, Status, Type, Block size, Logging, Total, Used, Used %, Free, Free %, Data Files |
MySQL Subagent
The MySQL subagent (mysql.nsm) provides pre-built metrics for monitoring MySQL and MariaDB instances including connection statistics, InnoDB buffer pool, query performance, and thread usage.
Prerequisites
-
MySQL client driver available on the agent host
-
MySQL user with SELECT privileges on
information_schemaandperformance_schema
Configuration
Each monitored server is defined in its own [mysql/connections/<id>] section.
The last part of the section name becomes the connection identifier used in metric arguments:
[mysql/connections/production]
Endpoint = db1.example.com
Login = netxms
Password = your_password
[mysql/connections/staging]
Endpoint = db-2.example.com
Login = netxms
Password = your_password
A single connection can also be configured in the plain [MYSQL] section using the same keys.
The plain section is only processed if at least one of Id, Database, Endpoint, Server, Login, or Password is set.
Configuration Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
|
String |
Last part of the section name |
Connection identifier used in metric arguments ( |
|
String |
|
MySQL server address ( |
|
String |
|
Database name (DSN) |
|
String |
|
Database user name |
|
String |
(none) |
Database password (can be obfuscated with |
|
String |
(none) |
Database password obfuscated with |
|
Integer |
3600 |
Connection lifetime in seconds |
|
String |
|
Database driver to use; set to |
Legacy [MYSQL/Databases/<id>] sections still work but are deprecated (usage is reported in the agent log at debug level 3).
|
Metrics
All metrics are collected once per minute. Recommended DCI poll interval: 60 seconds or more.
Server-level metrics take one argument (connection ID).
Per-database metrics take two arguments (connection ID, database name) or use the database@connectionId syntax.
Connection Metrics
| Parameter | Type | Description |
|---|---|---|
|
UInt64 |
Active connections |
|
Float |
Connection pool usage (%) |
|
UInt64 |
Cumulative connections |
|
UInt64 |
Peak concurrent connections |
|
Float |
Peak pool usage (%) |
|
UInt64 |
max_connections setting |
|
UInt64 |
Aborted client connections |
|
UInt64 |
Failed connection attempts |
|
UInt64 |
Bytes received from clients |
|
UInt64 |
Bytes sent to clients |
InnoDB Buffer Pool
| Parameter | Type | Description |
|---|---|---|
|
UInt64 |
Buffer pool size (bytes) |
|
UInt64 |
Used buffer pool (bytes) |
|
Float |
Used buffer pool (%) |
|
UInt64 |
Free buffer pool (bytes) |
|
Float |
Free buffer pool (%) |
|
UInt64 |
Dirty pages (bytes) |
|
Float |
Dirty pages (%) |
|
UInt64 |
InnoDB disk reads |
|
UInt64 |
InnoDB read requests |
|
Float |
Read cache hit ratio (%) |
|
UInt64 |
InnoDB write requests |
MyISAM Key Cache
| Parameter | Type | Description |
|---|---|---|
|
UInt64 |
Key cache size |
|
UInt64 |
Key cache used |
|
Float |
Key cache used (%) |
|
UInt64 |
Key cache free |
|
Float |
Key cache free (%) |
|
UInt64 |
Key cache disk reads |
|
UInt64 |
Key cache disk writes |
|
UInt64 |
Key cache read requests |
|
UInt64 |
Key read hit ratio (%) |
|
UInt64 |
Key cache write requests |
|
UInt64 |
Key write hit ratio (%) |
Query Metrics
| Parameter | Type | Description |
|---|---|---|
|
UInt64 |
Total queries executed |
|
UInt64 |
Client-executed queries |
|
UInt64 |
SELECT queries |
|
UInt64 |
INSERT queries |
|
UInt64 |
UPDATE queries |
|
UInt64 |
Multi-table UPDATE queries |
|
UInt64 |
DELETE queries |
|
UInt64 |
Multi-table DELETE queries |
|
UInt64 |
Slow queries |
|
Float |
Slow queries (%) |
Query Cache
| Parameter | Type | Description |
|---|---|---|
|
UInt64 |
Query cache size |
|
UInt64 |
Query cache hits |
|
Float |
Query cache hit ratio (%) |
Table Metrics
| Parameter | Type | Description |
|---|---|---|
|
UInt64 |
Currently open tables |
|
UInt64 |
Tables opened since start |
|
UInt64 |
table_open_cache setting |
|
Float |
Table cache usage (%) |
|
UInt64 |
Fragmented tables |
Temporary Tables
| Parameter | Type | Description |
|---|---|---|
|
UInt64 |
Temp tables created |
|
UInt64 |
Temp tables created on disk |
|
Float |
Temp tables on disk (%) |
Sort Metrics
| Parameter | Type | Description |
|---|---|---|
|
UInt64 |
Sorts using ranges |
|
UInt64 |
Sorts using table scans |
|
UInt64 |
Sort merge passes |
|
Float |
Sort merge ratio (%) |
Thread Metrics
| Parameter | Type | Description |
|---|---|---|
|
UInt64 |
Running threads |
|
UInt64 |
Total threads created |
|
UInt64 |
Thread cache size |
|
Float |
Thread cache hit ratio (%) |
Open Files
| Parameter | Type | Description |
|---|---|---|
|
UInt64 |
Currently open files |
|
UInt64 |
Open file limit |
|
Float |
Open file usage (%) |
Per-Database Metrics
These metrics take two arguments (connection ID, database name) or use the database@connectionId syntax.
| Parameter | Type | Description |
|---|---|---|
|
UInt64 |
Data size (bytes) |
|
UInt32 |
Fragmented tables |
|
UInt64 |
Reclaimable free space (bytes) |
|
UInt64 |
Index size (bytes) |
|
UInt64 |
Table I/O wait time (ms) |
|
UInt64 |
Estimated number of rows |
|
UInt64 |
Deleted rows |
|
UInt64 |
Fetched rows |
|
UInt64 |
Inserted rows |
|
UInt64 |
Read rows |
|
UInt64 |
Updated rows |
|
UInt32 |
Number of tables |
|
UInt64 |
Total size, data + indexes (bytes) |
PostgreSQL Subagent
The PostgreSQL subagent (pgsql.nsm) provides pre-built metrics for monitoring PostgreSQL instances including connection statistics, database statistics, replication status, locks, WAL archiver, and background writer performance.
Prerequisites
-
PostgreSQL client library (
libpq) on the agent host -
PostgreSQL user with read access to system catalog views
-
For PostgreSQL 10+, the
pg_monitorrole is recommended:CREATE USER netxms WITH PASSWORD 'your_password'; GRANT pg_monitor TO netxms;
Configuration
Each monitored server is defined in its own [pgsql/connections/<id>] section.
The last part of the section name becomes the connection identifier used in metric arguments:
[pgsql/connections/primary]
Endpoint = db1.example.com
Login = netxms
Password = your_password
[pgsql/connections/replica]
Endpoint = db-2.example.com
Login = netxms
Password = your_password
A single connection can also be configured in the plain [PGSQL] section using the same keys.
The plain section is only processed if at least one of Id, Database, Endpoint, Server, Login, or Password is set.
Configuration Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
|
String |
Last part of the section name |
Connection identifier used in metric arguments ( |
|
String |
|
PostgreSQL server address ( |
|
String |
|
Maintenance database name |
|
String |
|
Database user name |
|
String |
(none) |
Database password (can be obfuscated with |
|
Integer |
3600 |
Connection lifetime in seconds |
Legacy [PGSQL/Servers/<name>] sections still work but are deprecated (usage is reported in the agent log at debug level 3).
|
Metrics
All metrics are collected once per minute. Recommended DCI poll interval: 60 seconds or more.
Server-level metrics take one argument (connection ID).
Database-level metrics take two arguments (connection ID, database name) or use the database@connectionId syntax.
If the database argument is empty, the connection’s maintenance database is used.
Connectivity
| Parameter | Type | Description |
|---|---|---|
|
String |
Server reachable (YES/NO) |
|
String |
PostgreSQL version |
Global Connections (server-level)
| Parameter | Type | Description |
|---|---|---|
|
Integer |
Total active backends |
|
Integer |
max_connections setting |
|
Float |
Used connections (%) |
|
Integer |
autovacuum_max_workers setting |
Database Connections (per-database)
| Parameter | Type | Description |
|---|---|---|
|
Integer |
Total connections |
|
Integer |
Active connections |
|
Integer |
Idle connections |
|
Integer |
Idle in transaction |
|
Integer |
Idle in aborted transaction |
|
Integer |
Autovacuum workers |
|
Integer |
Fastpath function calls |
|
Integer |
Waiting backends |
|
Integer |
Age of oldest transaction XID |
Database Statistics (per-database)
| Parameter | Type | Description |
|---|---|---|
|
Int64 |
Database size (bytes) |
|
Integer |
Number of backends |
|
Int64 |
Total deadlocks |
|
Float |
Buffer cache hit ratio (%) |
|
Int64 |
Disk blocks read |
|
Int64 |
Blocks in cache |
|
Float |
Block read time (ms) |
|
Float |
Block write time (ms) |
|
Int64 |
Committed transactions |
|
Int64 |
Rolled-back transactions |
|
Int64 |
Rows inserted |
|
Int64 |
Rows updated |
|
Int64 |
Rows deleted |
|
Int64 |
Rows fetched |
|
Int64 |
Rows returned |
|
Int64 |
Serialization conflicts |
|
Int64 |
Temporary files created |
|
Int64 |
Temporary data written (bytes) |
|
Int64 |
Page checksum failures (v12+) |
Background Writer (server-level)
| Parameter | Type | Description |
|---|---|---|
|
Int64 |
Scheduled checkpoints |
|
Int64 |
Requested checkpoints |
|
Float |
Checkpoint write time (ms) |
|
Float |
Checkpoint sync time (ms) |
|
Int64 |
Buffers written at checkpoints |
|
Int64 |
Buffers cleaned by bgwriter |
|
Int64 |
Times bgwriter stopped cleaning |
|
Int64 |
Buffers written by backends |
|
Int64 |
Backend fsync calls |
|
Int64 |
Buffers allocated |
Locks (per-database)
| Parameter | Type | Description |
|---|---|---|
|
Int64 |
Total locks |
|
Int64 |
AccessShare locks |
|
Int64 |
AccessExclusive locks |
|
Int64 |
Exclusive locks |
|
Int64 |
RowExclusive locks |
|
Int64 |
RowShare locks |
|
Int64 |
Share locks |
|
Int64 |
ShareRowExclusive locks |
|
Int64 |
ShareUpdateExclusive locks |
Replication (server-level)
| Parameter | Type | Description |
|---|---|---|
|
String |
In recovery mode (YES/NO, v9.6+) |
|
String |
WAL receiver active (YES/NO, v9.6+) |
|
Integer |
Active WAL senders |
|
Integer |
Replication lag (seconds, v10+) |
|
Int64 |
Replication lag (bytes, v10+) |
|
Int64 |
Total WAL size (bytes, v10+) |
|
Integer |
WAL file count (v10+) |
WAL Archiver (server-level)
| Parameter | Type | Description |
|---|---|---|
|
Int64 |
WAL files archived |
|
Int64 |
Archive failures |
|
String |
Last archived WAL file |
|
Integer |
Seconds since last archive |
|
String |
Last failed WAL file |
|
Integer |
Seconds since last failure |
|
String |
Archiving active (YES/NO) |
Lists
| List | Description |
|---|---|
|
Configured connection identifiers |
|
Databases on the given connection |
|
All databases on all connections (rows: |
|
All data collection tags available on the connection |
PostgreSQL.DBServers is a deprecated alias for PostgreSQL.Connections.
|
Tables
| Table | Key Columns |
|---|---|
|
PID, Database, User, Application, Client, Backend start, State, Wait event (v9.6+), Blocking PIDs (v9.6+), Backend type (v10+), Query start, Last state change, SQL |
|
PID, Database, Lock type, Target relation, Page, Tuple, vXID (target), XID (target), Class, Object ID, vXID (owner), Mode, Granted?, Fastpath? |
|
GID, Name, Owner, XID, Prepared At |
On PostgreSQL versions older than 9.6, the Backends table has a Waiting? column instead of Wait event and Blocking PIDs.
MongoDB Subagent
The MongoDB subagent (mongodb.nsm) provides metrics for monitoring MongoDB instances including database statistics and dynamic server status metrics.
Prerequisites
-
MongoDB C driver on the agent host
-
MongoDB user with read access to the monitored databases (or no authentication if not configured)
-
Server status metrics are read via the
serverStatuscommand against theadmindatabase, so the monitoring user needsclusterMonitor-level rights there
Configuration
Each monitored server is defined in its own [mongodb/connections/<id>] section.
The last part of the section name becomes the connection identifier used in metric arguments:
[mongodb/connections/db1]
Endpoint = hostname:27017
Login = username
Password = your_password
[mongodb/connections/mongo2]
Endpoint = hostname2:27017
Login = user2
Password = your_password
A single connection can also be configured in the plain [mongodb] section using the same keys.
The plain section is only processed if at least one of Id, Endpoint, Server, or Login is set.
Configuration Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
|
String |
Last part of the section name |
Connection identifier used in metric arguments ( |
|
String |
(required; |
Server address as |
|
String |
(none) |
Username for authentication |
|
String |
(none) |
Password (can be obfuscated with |
|
String |
(none) |
Password obfuscated with |
|
Integer |
3600 |
Connection lifetime in seconds |
Legacy Database value lines in the [MongoDB] section still work but are deprecated (usage is reported in the agent log at debug level 3).
|
Metrics
All metrics are collected once per minute. Recommended DCI poll interval: 60 seconds or more.
Database Statistics
These metrics require both the connection ID and database name as arguments.
| Parameter | Type | Description |
|---|---|---|
|
String |
Number of collections |
|
String |
Number of documents |
|
String |
Average document size (bytes) |
|
String |
Total data size (bytes) |
|
String |
Allocated storage (bytes) |
|
String |
Number of extents |
|
String |
Number of indexes |
|
String |
Total index size (bytes) |
|
String |
Data file size (bytes) |
|
String |
Namespace file size (MB) |
Dynamic Server Status Metrics
All fields from the MongoDB serverStatus command are available as metrics.
Nested fields use dot notation.
Examples:
| Parameter | Description |
|---|---|
|
Server uptime in seconds |
|
Resident memory (MB) |
|
Virtual memory (MB) |
|
Current connections |
|
Available connections |
|
Insert operations |
|
Query operations |
|
Update operations |
|
Delete operations |
|
Bytes received |
|
Bytes sent |
Available fields depend on the MongoDB version.
Use db.serverStatus() in the MongoDB shell to see all available fields.
|
Informix Subagent
The Informix subagent (informix.nsm) provides metrics for monitoring IBM Informix Dynamic Server instances including session counts, database status, and dbspace page usage.
Prerequisites
-
Informix client libraries (CSDK) on the agent host
-
Database user with access to system catalog tables (
syssessions,sysdatabases,sysdbspaces,syschunks)
Configuration
Each monitored database is defined in its own [informix/connections/<id>] section.
The last part of the section name becomes the connection identifier used in metric arguments:
[informix/connections/db1]
Endpoint = ol_informix1210
Database = stores_demo
Login = informix
Password = your_password
A single connection can also be configured in the plain [INFORMIX] section using the same keys.
Configuration Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
|
String |
Last part of the section name |
Connection identifier used in metric arguments (in the |
|
String |
(required) |
Informix server name |
|
String |
(required) |
Informix database name |
|
String |
(required) |
Database user name |
|
String |
(none) |
Database password (can be obfuscated with |
|
String |
(none) |
Database password obfuscated with |
|
Integer |
3600 |
Connection lifetime in seconds |
Legacy numbered database sections and the DBName, DBServer, DBLogin, DBPassword, and DBPasswordEncrypted key aliases still work but are deprecated (usage is reported in the agent log at debug level 3).
|
Metrics
All metrics are collected once per minute. Recommended DCI poll interval: 60 seconds or more.
Session Metrics
| Parameter | Type | Description |
|---|---|---|
|
Integer |
Number of open sessions |
Database Information
These metrics take two arguments (connection ID, database name).
| Parameter | Type | Description |
|---|---|---|
|
String |
Database owner |
|
String |
Database creation date |
|
Integer |
1 if logging enabled, 0 otherwise |
Dbspace Page Metrics
These metrics take two arguments (connection ID, dbspace name).
| Parameter | Type | Description |
|---|---|---|
|
Integer |
Total dbspace chunk size (pages) |
|
Integer |
Pages used |
|
Integer |
Free pages |
|
Integer |
Free space (%) |
Microsoft SQL Server Subagent
The Microsoft SQL Server subagent (mssql.nsm) provides pre-built metrics for monitoring SQL Server instances including database size and backup age, memory usage, server-wide performance counters, wait statistics, and resource governor pool usage.
Prerequisites
-
The subagent connects through the ODBC-based
mssql.ddrdatabase driver (available on Windows) and requires a Microsoft ODBC driver for SQL Server on the agent host (SQL Server Native Client or ODBC Driver 13/17/18 for SQL Server). The newest installed driver is selected automatically. -
SQL Server login with permission to read the dynamic management views (
VIEW SERVER STATE); backup age metrics additionally readmsdb.dbo.backupset
Configuration
Each monitored server is defined in its own [mssql/connections/<id>] section.
The last part of the section name becomes the connection identifier used in metric arguments:
[mssql/connections/production]
Server = db1.example.com
Login = netxms
Password = your_password
[mssql/connections/staging]
Server = db-2.example.com
Login = netxms
Password = your_password
A single connection can also be configured in the plain [MSSQL] section using the same keys.
The plain section is only processed if at least one of Id, Server, Login, or Password is set.
Configuration Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
|
String |
Last part of the section name |
Connection identifier used in metric arguments (in the |
|
String |
|
SQL Server address |
|
String |
|
Database name |
|
String |
(none) |
Database user name; set to |
|
String |
(none) |
Database password (can be obfuscated with |
|
String |
(none) |
Database password obfuscated with |
|
Integer |
3600 |
Connection lifetime in seconds |
|
String |
|
Database driver to use (set in the |
|
String |
(none) |
Additional driver options: |
Metrics
All metrics are collected once per minute. Recommended DCI poll interval: 60 seconds or more.
Server-level metrics take one argument (connection ID). Per-database, per-pool, and per-wait-type metrics take two arguments: connection ID plus database name, resource pool name, or wait type.
Metrics described as "total" are cumulative counters; configure delta calculation on the DCI to obtain rates.
Connectivity and Server Information
| Parameter | Type | Description |
|---|---|---|
|
String |
Server reachable (YES/NO) |
|
String |
Product version |
|
String |
Edition |
|
String |
Product level |
|
Int64 |
Uptime in seconds |
Session and Connection Metrics
| Parameter | Type | Description |
|---|---|---|
|
Integer |
Number of connections |
|
Integer |
Number of user connections |
|
Integer |
Number of user sessions |
|
Integer |
Number of active user sessions |
|
Counter64 |
Total logins |
|
Counter64 |
Total logouts |
Memory Metrics
| Parameter | Type | Description |
|---|---|---|
|
Int64 |
Available physical memory (bytes) |
|
Float |
Buffer cache hit ratio (%) |
|
Integer |
Outstanding memory grants |
|
Integer |
Pending memory grants |
|
Integer |
Memory utilization (%) |
|
Int64 |
Page life expectancy (seconds) |
|
Int64 |
Physical memory in use (bytes) |
|
Int64 |
Plan cache pages |
|
Int64 |
Target server memory (bytes) |
|
Int64 |
Total server memory (bytes) |
Performance Metrics
| Parameter | Type | Description |
|---|---|---|
|
Counter64 |
Total batch requests |
|
Counter64 |
Total SQL compilations |
|
Counter64 |
Total SQL re-compilations |
|
Counter64 |
Total SQL errors |
|
Counter64 |
Total user errors |
|
Counter64 |
Total full scans |
|
Counter64 |
Total forwarded records |
|
Counter64 |
Total page lookups |
|
Counter64 |
Total page reads |
|
Counter64 |
Total page writes |
|
Counter64 |
Total page splits |
|
Counter64 |
Total checkpoint pages |
|
Counter64 |
Total free list stalls |
|
Counter64 |
Total workfiles created |
|
Counter64 |
Total worktables created |
|
Int64 |
Free space in tempdb (bytes) |
|
Int64 |
Version store size in tempdb (bytes) |
Transaction and Lock Metrics
| Parameter | Type | Description |
|---|---|---|
|
Counter64 |
Total transactions |
|
Integer |
Total active transactions |
|
Counter64 |
Total number of deadlocks |
|
Integer |
Number of blocked processes |
|
Integer |
Number of lock waits |
|
Counter64 |
Total lock waits |
|
Counter64 |
Total lock timeouts |
|
Float |
Average lock wait time (ms) |
|
Counter64 |
Total transaction log flushes |
|
Counter64 |
Total log bytes flushed |
Wait Time by Category
| Parameter | Type | Description |
|---|---|---|
|
Counter64 |
Cumulative page I/O latch wait time (ms) |
|
Counter64 |
Cumulative page latch wait time (ms) |
|
Counter64 |
Cumulative log write wait time (ms) |
|
Counter64 |
Cumulative log buffer wait time (ms) |
|
Counter64 |
Cumulative memory grant queue wait time (ms) |
|
Counter64 |
Cumulative network I/O wait time (ms) |
Per-Database Metrics
These metrics take two arguments (connection ID, database name).
| Parameter | Type | Description |
|---|---|---|
|
String |
Database status |
|
String |
Recovery model |
|
String |
User access mode |
|
String |
Collation |
|
Integer |
Compatibility level |
|
Integer |
1 if encrypted, 0 otherwise |
|
Integer |
1 if read only, 0 otherwise |
|
Int64 |
Data file size (bytes) |
|
Int64 |
Transaction log file size (bytes) |
|
Int64 |
Total file size (bytes) |
|
Int64 |
Used transaction log size (bytes) |
|
Integer |
Transaction log used (%) |
|
Counter64 |
Transaction log growths |
|
Counter64 |
Total transaction log flushes |
|
Float |
Log cache hit ratio (%) |
|
String |
Log reuse wait reason |
|
Counter64 |
Total transactions |
|
Counter64 |
Total write transactions |
|
Integer |
Active transactions |
|
Int64 |
Time since last full backup (seconds) |
|
Int64 |
Time since last differential backup (seconds) |
|
Int64 |
Time since last transaction log backup (seconds) |
Resource Pool Metrics
These metrics take two arguments (connection ID, resource governor pool name).
| Parameter | Type | Description |
|---|---|---|
|
Float |
CPU usage (%) |
Wait Statistics
These metrics take two arguments (connection ID, wait type).
| Parameter | Type | Description |
|---|---|---|
|
Counter64 |
Wait time (ms) |
|
Counter64 |
Waiting tasks count |
|
Counter64 |
Signal wait time (ms) |
Lists
| List | Description |
|---|---|
|
Configured connection identifiers |
|
Databases on the given connection |
|
All databases on all connections (rows: |
|
Resource governor pools on the given connection |
|
Active wait types on the given connection |
|
All data collection tags available on the connection |
Tables
| Table | Columns |
|---|---|
|
Name, State, Recovery model, User access, Compatibility level, Log reuse wait, Data size, Log size |
|
Session ID, Login, Database, Host, Program, Status, CPU time, Memory usage, Last request |
|
Wait type, Waiting tasks, Wait time, Max wait time, Signal wait time |
Security Considerations
-
Use a dedicated database user with minimal privileges (SELECT only on required tables/views)
-
Obfuscate passwords using the
nxencpasswdtool rather than storing them in plain text -
Restrict network access to the monitoring user from the agent host only
-
Be cautious with custom queries that could impact database performance
| Poorly written custom queries can affect database performance. Always test queries manually and verify their execution plan before adding them to monitoring. |
Troubleshooting
Connection Failures
-
Verify network connectivity from the agent host to the database server
-
Check credentials and permissions
-
Verify the database driver/client libraries are installed on the agent host
-
Check agent log for database connection error messages