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.

Loading the Subagent

SubAgent = dbquery.nsm

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

Driver

Database driver (see Supported Database Drivers)

Server

Database server address (hostname:port or connection string)

Name

Database name

Login

Database user name

Password

Database password (supports passwords obfuscated with nxencpasswd — automatically decoded)

DriverOptions

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

pgsql

PostgreSQL

Native driver, recommended

mysql

MySQL

Native driver

mariadb

MariaDB

Native driver

oracle

Oracle

Requires Oracle client libraries

mssql

Microsoft SQL Server

ODBC-based; Windows only

informix

IBM Informix

Requires Informix client libraries (CSDK)

sqlite

SQLite

Local file-based databases

odbc

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

DB.QueryResult(Name)

Last query result value

DB.QueryStatus(Name)

Last execution status (native SQL error code)

DB.QueryStatusText(Name)

Last execution status as text

DB.QueryExecutionTime(Name)

Last execution duration in milliseconds

Name

Re-executes the query synchronously and returns the fresh result; unlike DB.QueryResult(Name), it does not use the cached background-polled value

Example DCI configuration:

  • Origin: Agent

  • Metric: DB.QueryResult(ActiveUsers)

  • Data type: Integer

Direct Queries

Execute a query immediately (on demand) without background polling:

DB.Query(DatabaseID,SQL)

Example DCI metric: DB.Query(appdb,SELECT count(*) FROM sessions WHERE active = true)

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

DB.Query(DatabaseID,SQL)

Direct table query (on demand)

DB.QueryResult(Name)

Result table from a polled query

Name

Result table from a polled query (re-executes the query synchronously)

Name(params)

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_role granted:

    GRANT select_catalog_role TO netxms_monitor;

Loading

SubAgent = oracle.nsm

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

Id

String

Last part of the section name

Connection identifier used in metric arguments (in the [ORACLE] section defaults to the value of Endpoint)

Endpoint

String

(required)

Oracle TNS name or connection string

Login

String

(required)

Database user name

Password

String

(none)

Database password (can be obfuscated with nxencpasswd)

EncryptedPassword

String

(none)

Database password obfuscated with nxencpasswd

ConnectionTTL

Integer

3600

Connection lifetime in seconds; connection is closed and reopened after this period

DriverOptions

String

(none)

Additional options passed to the Oracle database driver (set in the [ORACLE] section; applies to all connections)

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

Oracle.DBInfo.IsReachable(dbid)

String

Database is reachable (YES/NO)

Oracle.DBInfo.Name(dbid)

String

Database name

Oracle.DBInfo.CreateDate(dbid)

String

Database creation date

Oracle.DBInfo.LogMode(dbid)

String

Log mode (ARCHIVELOG/NOARCHIVELOG)

Oracle.DBInfo.OpenMode(dbid)

String

Database open mode

Oracle.DBInfo.Version(dbid)

String

Database version

Instance Information

Parameter Type Description

Oracle.Instance.Version(dbid)

String

DBMS version

Oracle.Instance.Status(dbid)

String

Instance status

Oracle.Instance.ArchiverStatus(dbid)

String

Archiver status

Oracle.Instance.ShutdownPending(dbid)

String

Shutdown pending (YES/NO)

Critical Statistics

Parameter Type Description

Oracle.CriticalStats.AutoArchivingOff(dbid)

String

Auto archiving off (YES/NO)

Oracle.CriticalStats.DatafilesNeedMediaRecovery(dbid)

Int64

Datafiles needing media recovery

Oracle.CriticalStats.Deadlocks(dbid)

Int64

Cumulative deadlocks

Oracle.CriticalStats.DFOffCount(dbid)

Integer

Offline datafiles

Oracle.CriticalStats.FailedJobs(dbid)

Int64

Failed jobs

Oracle.CriticalStats.FullSegmentsCount(dbid)

Int64

Segments that cannot extend

Oracle.CriticalStats.RBSegsNotOnlineCount(dbid)

Int64

Rollback segments not online

Oracle.CriticalStats.TSOffCount(dbid)

Integer

Offline tablespaces

Performance Metrics

Parameter Type Description

Oracle.Performance.CacheHitRatio(dbid)

String

Data buffer cache hit ratio (%)

Oracle.Performance.DictCacheHitRatio(dbid)

String

Dictionary cache hit ratio (%)

Oracle.Performance.LibCacheHitRatio(dbid)

String

Library cache hit ratio (%)

Oracle.Performance.MemorySortRatio(dbid)

String

PGA memory sort ratio (%)

Oracle.Performance.DispatcherWorkload(dbid)

String

Dispatcher workload (%)

Oracle.Performance.RollbackWaitRatio(dbid)

String

Rollback segment wait ratio (%)

Oracle.Performance.FreeSharedPool(dbid)

Int64

Free space in shared pool (bytes)

Oracle.Performance.Locks(dbid)

Int64

Number of locks

Oracle.Performance.LogicalReads(dbid)

Int64

Logical reads

Oracle.Performance.PhysicalReads(dbid)

Int64

Physical reads

Oracle.Performance.PhysicalWrites(dbid)

Int64

Physical writes

Session Metrics

Parameter Type Description

Oracle.Sessions.Count(dbid)

Integer

Total open sessions

Oracle.Sessions.CountByUser(dbid,user)

Integer

Sessions by Oracle user

Oracle.Sessions.CountBySchema(dbid,schema)

Integer

Sessions by schema

Oracle.Sessions.CountByProgram(dbid,program)

Integer

Sessions by program

Cursor Metrics

Parameter Type Description

Oracle.Cursors.Count(dbid)

Integer

Open cursors system-wide

Oracle.Cursors.MaxPerSession(dbid)

Integer

Maximum cursors per session

Tablespace Metrics

Requires Oracle 10.0+.

Parameter Type Description

Oracle.TableSpace.Status(dbid,ts)

String

Tablespace status

Oracle.TableSpace.Type(dbid,ts)

String

Tablespace type

Oracle.TableSpace.Logging(dbid,ts)

String

Logging mode

Oracle.TableSpace.BlockSize(dbid,ts)

Integer

Block size

Oracle.TableSpace.DataFiles(dbid,ts)

Integer

Number of data files

Oracle.TableSpace.TotalBytes(dbid,ts)

Int64

Total size (bytes)

Oracle.TableSpace.UsedBytes(dbid,ts)

Int64

Used space (bytes)

Oracle.TableSpace.UsedPct(dbid,ts)

Integer

Used space (%)

Oracle.TableSpace.FreeBytes(dbid,ts)

Int64

Free space (bytes)

Oracle.TableSpace.FreePct(dbid,ts)

Integer

Free space (%)

Data File Metrics

Requires Oracle 10.2+.

Parameter Type Description

Oracle.DataFile.Status(dbid,file)

String

Data file status

Oracle.DataFile.FullName(dbid,file)

String

Full path

Oracle.DataFile.Tablespace(dbid,file)

String

Tablespace name

Oracle.DataFile.Bytes(dbid,file)

Int64

Size in bytes

Oracle.DataFile.Blocks(dbid,file)

Int64

Size in blocks

Oracle.DataFile.BlockSize(dbid,file)

Integer

Block size

Oracle.DataFile.PhysicalReads(dbid,file)

Int64

Physical reads

Oracle.DataFile.PhysicalWrites(dbid,file)

Int64

Physical writes

Oracle.DataFile.ReadTime(dbid,file)

Int64

Total read time (ms)

Oracle.DataFile.WriteTime(dbid,file)

Int64

Total write time (ms)

Oracle.DataFile.AvgIoTime(dbid,file)

Integer

Average I/O time (ms)

Oracle.DataFile.MinIoTime(dbid,file)

Integer

Minimum I/O time (ms)

Oracle.DataFile.MaxIoReadTime(dbid,file)

Integer

Maximum read time (ms)

Oracle.DataFile.MaxIoWriteTime(dbid,file)

Integer

Maximum write time (ms)

ASM Disk Group Metrics

Requires Oracle 11.1+.

Parameter Type Description

Oracle.ASM.DiskGroup.State(dbid,dg)

String

Disk group state

Oracle.ASM.DiskGroup.Type(dbid,dg)

String

Disk group type

Oracle.ASM.DiskGroup.Total(dbid,dg)

String

Total space

Oracle.ASM.DiskGroup.Free(dbid,dg)

String

Free space

Oracle.ASM.DiskGroup.FreePerc(dbid,dg)

String

Free space (%)

Oracle.ASM.DiskGroup.Used(dbid,dg)

String

Used space

Oracle.ASM.DiskGroup.UsedPerc(dbid,dg)

String

Used space (%)

Oracle.ASM.DiskGroup.OfflineDisks(dbid,dg)

String

Offline disks

Log Metrics

Parameter Type Description

Oracle.Logs.ArchivedSize(dbid)

Int64

Total archived log size (bytes)

Oracle.Logs.RedoSize(dbid)

Int64

Total redo log size (bytes)

Other Metrics

Parameter Type Description

Oracle.Objects.InvalidCount(dbid)

Int64

Invalid objects in database

Oracle.Dual.ExcessRows(dbid)

Int64

Excess rows in DUAL table

Lists

List Description

Oracle.Connections

Configured connection identifiers

Oracle.TableSpaces(dbid)

All tablespaces

Oracle.DataFiles(dbid)

All data files

Oracle.ASM.DiskGroups(dbid)

All ASM disk groups

Oracle.DataTags(dbid)

All data collection tags available on the connection

Tables

Table Columns

Oracle.Sessions(dbid)

SID, User, Schema, OS User, Machine, Status, Process, Program, Type, State, Service

Oracle.DataFiles(dbid)

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

Oracle.TableSpaces(dbid)

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_schema and performance_schema

Loading

SubAgent = mysql.nsm

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

Id

String

Last part of the section name

Connection identifier used in metric arguments (localdb in the [MYSQL] section)

Endpoint

String

127.0.0.1

MySQL server address (Server is accepted as an alias)

Database

String

information_schema

Database name (DSN)

Login

String

netxms

Database user name

Password

String

(none)

Database password (can be obfuscated with nxencpasswd)

EncryptedPassword

String

(none)

Database password obfuscated with nxencpasswd

ConnectionTTL

Integer

3600

Connection lifetime in seconds

Driver

String

mysql.ddr

Database driver to use; set to mariadb.ddr to connect using the MariaDB client library (set in the [MYSQL] section; applies to all connections)

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.

Connectivity

Parameter Type Description

MySQL.IsReachable(id)

String

Database reachable (YES/NO)

Connection Metrics

Parameter Type Description

MySQL.Connections.Current(id)

UInt64

Active connections

MySQL.Connections.CurrentPerc(id)

Float

Connection pool usage (%)

MySQL.Connections.Total(id)

UInt64

Cumulative connections

MySQL.Connections.Max(id)

UInt64

Peak concurrent connections

MySQL.Connections.MaxPerc(id)

Float

Peak pool usage (%)

MySQL.Connections.Limit(id)

UInt64

max_connections setting

MySQL.Connections.Aborted(id)

UInt64

Aborted client connections

MySQL.Connections.Failed(id)

UInt64

Failed connection attempts

MySQL.Connections.BytesReceived(id)

UInt64

Bytes received from clients

MySQL.Connections.BytesSent(id)

UInt64

Bytes sent to clients

InnoDB Buffer Pool

Parameter Type Description

MySQL.InnoDB.BufferPool.Size(id)

UInt64

Buffer pool size (bytes)

MySQL.InnoDB.BufferPool.Used(id)

UInt64

Used buffer pool (bytes)

MySQL.InnoDB.BufferPool.UsedPerc(id)

Float

Used buffer pool (%)

MySQL.InnoDB.BufferPool.Free(id)

UInt64

Free buffer pool (bytes)

MySQL.InnoDB.BufferPool.FreePerc(id)

Float

Free buffer pool (%)

MySQL.InnoDB.BufferPool.Dirty(id)

UInt64

Dirty pages (bytes)

MySQL.InnoDB.BufferPool.DirtyPerc(id)

Float

Dirty pages (%)

MySQL.InnoDB.DiskReads(id)

UInt64

InnoDB disk reads

MySQL.InnoDB.ReadRequest(id)

UInt64

InnoDB read requests

MySQL.InnoDB.ReadCacheHitRatio(id)

Float

Read cache hit ratio (%)

MySQL.InnoDB.WriteRequest(id)

UInt64

InnoDB write requests

MyISAM Key Cache

Parameter Type Description

MySQL.MyISAM.KeyCacheSize(id)

UInt64

Key cache size

MySQL.MyISAM.KeyCacheUsed(id)

UInt64

Key cache used

MySQL.MyISAM.KeyCacheUsedPerc(id)

Float

Key cache used (%)

MySQL.MyISAM.KeyCacheFree(id)

UInt64

Key cache free

MySQL.MyISAM.KeyCacheFreePerc(id)

Float

Key cache free (%)

MySQL.MyISAM.KeyDiskReads(id)

UInt64

Key cache disk reads

MySQL.MyISAM.KeyDiskWrites(id)

UInt64

Key cache disk writes

MySQL.MyISAM.KeyReadRequests(id)

UInt64

Key cache read requests

MySQL.MyISAM.KeyCacheReadHitRatio(id)

UInt64

Key read hit ratio (%)

MySQL.MyISAM.KeyWriteRequests(id)

UInt64

Key cache write requests

MySQL.MyISAM.KeyCacheWriteHitRatio(id)

UInt64

Key write hit ratio (%)

Query Metrics

Parameter Type Description

MySQL.Queries.Total(id)

UInt64

Total queries executed

MySQL.Queries.ClientsTotal(id)

UInt64

Client-executed queries

MySQL.Queries.Select(id)

UInt64

SELECT queries

MySQL.Queries.Insert(id)

UInt64

INSERT queries

MySQL.Queries.Update(id)

UInt64

UPDATE queries

MySQL.Queries.UpdateMultiTable(id)

UInt64

Multi-table UPDATE queries

MySQL.Queries.Delete(id)

UInt64

DELETE queries

MySQL.Queries.DeleteMultiTable(id)

UInt64

Multi-table DELETE queries

MySQL.Queries.Slow(id)

UInt64

Slow queries

MySQL.Queries.SlowPerc(id)

Float

Slow queries (%)

Query Cache

Parameter Type Description

MySQL.Queries.Cache.Size(id)

UInt64

Query cache size

MySQL.Queries.Cache.Hits(id)

UInt64

Query cache hits

MySQL.Queries.Cache.HitRatio(id)

Float

Query cache hit ratio (%)

Table Metrics

Parameter Type Description

MySQL.Tables.Open(id)

UInt64

Currently open tables

MySQL.Tables.Opened(id)

UInt64

Tables opened since start

MySQL.Tables.OpenLimit(id)

UInt64

table_open_cache setting

MySQL.Tables.OpenPerc(id)

Float

Table cache usage (%)

MySQL.Tables.Fragmented(id)

UInt64

Fragmented tables

Temporary Tables

Parameter Type Description

MySQL.TempTables.Created(id)

UInt64

Temp tables created

MySQL.TempTables.CreatedOnDisk(id)

UInt64

Temp tables created on disk

MySQL.TempTables.CreatedOnDiskPerc(id)

Float

Temp tables on disk (%)

Sort Metrics

Parameter Type Description

MySQL.Sort.Range(id)

UInt64

Sorts using ranges

MySQL.Sort.Scan(id)

UInt64

Sorts using table scans

MySQL.Sort.MergePasses(id)

UInt64

Sort merge passes

MySQL.Sort.MergeRatio(id)

Float

Sort merge ratio (%)

Thread Metrics

Parameter Type Description

MySQL.Threads.Running(id)

UInt64

Running threads

MySQL.Threads.Created(id)

UInt64

Total threads created

MySQL.Threads.CacheSize(id)

UInt64

Thread cache size

MySQL.Threads.CacheHitRatio(id)

Float

Thread cache hit ratio (%)

Open Files

Parameter Type Description

MySQL.OpenFiles.Current(id)

UInt64

Currently open files

MySQL.OpenFiles.Limit(id)

UInt64

Open file limit

MySQL.OpenFiles.CurrentPerc(id)

Float

Open file usage (%)

Server

Parameter Type Description

MySQL.Server.Uptime(id)

UInt64

Server uptime (seconds)

Per-Database Metrics

These metrics take two arguments (connection ID, database name) or use the database@connectionId syntax.

Parameter Type Description

MySQL.Database.DataSize(id,db)

UInt64

Data size (bytes)

MySQL.Database.FragmentedTables(id,db)

UInt32

Fragmented tables

MySQL.Database.FreeSpace(id,db)

UInt64

Reclaimable free space (bytes)

MySQL.Database.IndexSize(id,db)

UInt64

Index size (bytes)

MySQL.Database.IOWaitTime(id,db)

UInt64

Table I/O wait time (ms)

MySQL.Database.Rows(id,db)

UInt64

Estimated number of rows

MySQL.Database.RowsDeleted(id,db)

UInt64

Deleted rows

MySQL.Database.RowsFetched(id,db)

UInt64

Fetched rows

MySQL.Database.RowsInserted(id,db)

UInt64

Inserted rows

MySQL.Database.RowsRead(id,db)

UInt64

Read rows

MySQL.Database.RowsUpdated(id,db)

UInt64

Updated rows

MySQL.Database.TableCount(id,db)

UInt32

Number of tables

MySQL.Database.TotalSize(id,db)

UInt64

Total size, data + indexes (bytes)

Lists

List Description

MySQL.Connections

Configured connection identifiers

MySQL.Databases(id)

Databases on the given connection

MySQL.AllDatabases

All databases on all connections (rows: connectionId,databaseName)

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_monitor role is recommended:

    CREATE USER netxms WITH PASSWORD 'your_password';
    GRANT pg_monitor TO netxms;

Loading

SubAgent = pgsql.nsm

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

Id

String

Last part of the section name

Connection identifier used in metric arguments (localdb in the [PGSQL] section)

Endpoint

String

127.0.0.1

PostgreSQL server address (Server is accepted as an alias)

Database

String

postgres

Maintenance database name

Login

String

netxms

Database user name

Password

String

(none)

Database password (can be obfuscated with nxencpasswd)

ConnectionTTL

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

PostgreSQL.IsReachable(id)

String

Server reachable (YES/NO)

PostgreSQL.Version(id)

String

PostgreSQL version

Global Connections (server-level)

Parameter Type Description

PostgreSQL.GlobalConnections.Total(id)

Integer

Total active backends

PostgreSQL.GlobalConnections.TotalMax(id)

Integer

max_connections setting

PostgreSQL.GlobalConnections.TotalPct(id)

Float

Used connections (%)

PostgreSQL.GlobalConnections.AutovacuumMax(id)

Integer

autovacuum_max_workers setting

Database Connections (per-database)

Parameter Type Description

PostgreSQL.DBConnections.Total(id,db)

Integer

Total connections

PostgreSQL.DBConnections.Active(id,db)

Integer

Active connections

PostgreSQL.DBConnections.Idle(id,db)

Integer

Idle connections

PostgreSQL.DBConnections.IdleInTransaction(id,db)

Integer

Idle in transaction

PostgreSQL.DBConnections.IdleInTransactionAborted(id,db)

Integer

Idle in aborted transaction

PostgreSQL.DBConnections.Autovacuum(id,db)

Integer

Autovacuum workers

PostgreSQL.DBConnections.FastpathFunctionCall(id,db)

Integer

Fastpath function calls

PostgreSQL.DBConnections.Waiting(id,db)

Integer

Waiting backends

PostgreSQL.DBConnections.OldestXID(id,db)

Integer

Age of oldest transaction XID

Database Statistics (per-database)

Parameter Type Description

PostgreSQL.Stats.DatabaseSize(id,db)

Int64

Database size (bytes)

PostgreSQL.Stats.NumBackends(id,db)

Integer

Number of backends

PostgreSQL.Stats.Deadlocks(id,db)

Int64

Total deadlocks

PostgreSQL.Stats.CacheHitRatio(id,db)

Float

Buffer cache hit ratio (%)

PostgreSQL.Stats.BlocksRead(id,db)

Int64

Disk blocks read

PostgreSQL.Stats.BlocksHit(id,db)

Int64

Blocks in cache

PostgreSQL.Stats.BlockReadTime(id,db)

Float

Block read time (ms)

PostgreSQL.Stats.BlkWriteTime(id,db)

Float

Block write time (ms)

PostgreSQL.Stats.TransactionCommits(id,db)

Int64

Committed transactions

PostgreSQL.Stats.TransactionRollbacks(id,db)

Int64

Rolled-back transactions

PostgreSQL.Stats.RowsInserted(id,db)

Int64

Rows inserted

PostgreSQL.Stats.RowsUpdated(id,db)

Int64

Rows updated

PostgreSQL.Stats.RowsDeleted(id,db)

Int64

Rows deleted

PostgreSQL.Stats.RowsFetched(id,db)

Int64

Rows fetched

PostgreSQL.Stats.RowsReturned(id,db)

Int64

Rows returned

PostgreSQL.Stats.Conflicts(id,db)

Int64

Serialization conflicts

PostgreSQL.Stats.TempFiles(id,db)

Int64

Temporary files created

PostgreSQL.Stats.TempBytes(id,db)

Int64

Temporary data written (bytes)

PostgreSQL.Stats.ChecksumFailures(id,db)

Int64

Page checksum failures (v12+)

Background Writer (server-level)

Parameter Type Description

PostgreSQL.BGWriter.CheckpointsTimed(id)

Int64

Scheduled checkpoints

PostgreSQL.BGWriter.CheckpointsReq(id)

Int64

Requested checkpoints

PostgreSQL.BGWriter.CheckpointWriteTime(id)

Float

Checkpoint write time (ms)

PostgreSQL.BGWriter.CheckpointSyncTime(id)

Float

Checkpoint sync time (ms)

PostgreSQL.BGWriter.BuffersCheckpoint(id)

Int64

Buffers written at checkpoints

PostgreSQL.BGWriter.BuffersClean(id)

Int64

Buffers cleaned by bgwriter

PostgreSQL.BGWriter.MaxWrittenClean(id)

Int64

Times bgwriter stopped cleaning

PostgreSQL.BGWriter.BuffersBackend(id)

Int64

Buffers written by backends

PostgreSQL.BGWriter.BuffersBackendFsync(id)

Int64

Backend fsync calls

PostgreSQL.BGWriter.BuffersAlloc(id)

Int64

Buffers allocated

Locks (per-database)

Parameter Type Description

PostgreSQL.Locks.Total(id,db)

Int64

Total locks

PostgreSQL.Locks.AccessShare(id,db)

Int64

AccessShare locks

PostgreSQL.Locks.AccessExclusive(id,db)

Int64

AccessExclusive locks

PostgreSQL.Locks.Exclusive(id,db)

Int64

Exclusive locks

PostgreSQL.Locks.RowExclusive(id,db)

Int64

RowExclusive locks

PostgreSQL.Locks.RowShare(id,db)

Int64

RowShare locks

PostgreSQL.Locks.Share(id,db)

Int64

Share locks

PostgreSQL.Locks.ShareRowExclusive(id,db)

Int64

ShareRowExclusive locks

PostgreSQL.Locks.ShareUpdateExclusive(id,db)

Int64

ShareUpdateExclusive locks

Replication (server-level)

Parameter Type Description

PostgreSQL.Replication.InRecovery(id)

String

In recovery mode (YES/NO, v9.6+)

PostgreSQL.Replication.IsReceiver(id)

String

WAL receiver active (YES/NO, v9.6+)

PostgreSQL.Replication.WALSenders(id)

Integer

Active WAL senders

PostgreSQL.Replication.Lag(id)

Integer

Replication lag (seconds, v10+)

PostgreSQL.Replication.LagBytes(id)

Int64

Replication lag (bytes, v10+)

PostgreSQL.Replication.WALSize(id)

Int64

Total WAL size (bytes, v10+)

PostgreSQL.Replication.WALFiles(id)

Integer

WAL file count (v10+)

WAL Archiver (server-level)

Parameter Type Description

PostgreSQL.Archiver.ArchivedCount(id)

Int64

WAL files archived

PostgreSQL.Archiver.FailedCount(id)

Int64

Archive failures

PostgreSQL.Archiver.LastArchivedWAL(id)

String

Last archived WAL file

PostgreSQL.Archiver.LastArchivedAge(id)

Integer

Seconds since last archive

PostgreSQL.Archiver.LastFailedWAL(id)

String

Last failed WAL file

PostgreSQL.Archiver.LastFailedAge(id)

Integer

Seconds since last failure

PostgreSQL.Archiver.IsArchiving(id)

String

Archiving active (YES/NO)

Transactions (per-database)

Parameter Type Description

PostgreSQL.Transactions.Prepared(id,db)

Int64

Prepared (2-phase) transactions

Lists

List Description

PostgreSQL.Connections

Configured connection identifiers

PostgreSQL.Databases(id)

Databases on the given connection

PostgreSQL.AllDatabases

All databases on all connections (rows: connectionId,databaseName)

PostgreSQL.DataTags(id)

All data collection tags available on the connection

PostgreSQL.DBServers is a deprecated alias for PostgreSQL.Connections.

Tables

Table Key Columns

PostgreSQL.Backends(id)

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

PostgreSQL.Locks(id)

PID, Database, Lock type, Target relation, Page, Tuple, vXID (target), XID (target), Class, Object ID, vXID (owner), Mode, Granted?, Fastpath?

PostgreSQL.PreparedTransactions(id)

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 serverStatus command against the admin database, so the monitoring user needs clusterMonitor-level rights there

Loading

SubAgent = mongodb.nsm

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

Id

String

Last part of the section name

Connection identifier used in metric arguments (localdb in the [mongodb] section)

Endpoint

String

(required; 127.0.0.1 in the [mongodb] section)

Server address as host or host:port (Server is accepted as an alias). Do not include the mongodb:// scheme — the subagent adds it

Login

String

(none)

Username for authentication

Password

String

(none)

Password (can be obfuscated with nxencpasswd)

EncryptedPassword

String

(none)

Password obfuscated with nxencpasswd

ConnectionTTL

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

MongoDB.collectionsNum(id,db)

String

Number of collections

MongoDB.objectsNum(id,db)

String

Number of documents

MongoDB.avgObjSize(id,db)

String

Average document size (bytes)

MongoDB.dataSize(id,db)

String

Total data size (bytes)

MongoDB.storageSize(id,db)

String

Allocated storage (bytes)

MongoDB.numExtents(id,db)

String

Number of extents

MongoDB.indexesNum(id,db)

String

Number of indexes

MongoDB.indexSize(id,db)

String

Total index size (bytes)

MongoDB.fileSize(id,db)

String

Data file size (bytes)

MongoDB.nsSizeMB(id,db)

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

MongoDB.uptime(id)

Server uptime in seconds

MongoDB.mem.resident(id)

Resident memory (MB)

MongoDB.mem.virtual(id)

Virtual memory (MB)

MongoDB.connections.current(id)

Current connections

MongoDB.connections.available(id)

Available connections

MongoDB.opcounters.insert(id)

Insert operations

MongoDB.opcounters.query(id)

Query operations

MongoDB.opcounters.update(id)

Update operations

MongoDB.opcounters.delete(id)

Delete operations

MongoDB.network.bytesIn(id)

Bytes received

MongoDB.network.bytesOut(id)

Bytes sent

Available fields depend on the MongoDB version. Use db.serverStatus() in the MongoDB shell to see all available fields.

Lists

List Description

MongoDB.Connections

Configured connection identifiers

MongoDB.Databases(id)

Databases on the given connection

MongoDB.AllDatabases

All databases on all connections (rows: connectionId,databaseName)

MongoDB.ListDatabases(id) is a deprecated alias for MongoDB.Databases(id).

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)

Loading

SubAgent = informix.nsm

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

Id

String

Last part of the section name

Connection identifier used in metric arguments (in the [INFORMIX] section defaults to the database name)

Endpoint

String

(required)

Informix server name

Database

String

(required)

Informix database name

Login

String

(required)

Database user name

Password

String

(none)

Database password (can be obfuscated with nxencpasswd)

EncryptedPassword

String

(none)

Database password obfuscated with nxencpasswd

ConnectionTTL

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

Informix.Session.Count(id)

Integer

Number of open sessions

Database Information

These metrics take two arguments (connection ID, database name).

Parameter Type Description

Informix.Database.Owner(id,db)

String

Database owner

Informix.Database.Created(id,db)

String

Database creation date

Informix.Database.Logged(id,db)

Integer

1 if logging enabled, 0 otherwise

Dbspace Page Metrics

These metrics take two arguments (connection ID, dbspace name).

Parameter Type Description

Informix.Dbspace.Pages.PageSize(id,dbspace)

Integer

Total dbspace chunk size (pages)

Informix.Dbspace.Pages.Used(id,dbspace)

Integer

Pages used

Informix.Dbspace.Pages.Free(id,dbspace)

Integer

Free pages

Informix.Dbspace.Pages.FreePerc(id,dbspace)

Integer

Free space (%)

Lists

List Description

Informix.Connections

Configured connection identifiers

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.ddr database 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 read msdb.dbo.backupset

Loading

SubAgent = mssql.nsm

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

Id

String

Last part of the section name

Connection identifier used in metric arguments (in the [MSSQL] section defaults to the value of Server)

Server

String

127.0.0.1

SQL Server address

Database

String

master

Database name

Login

String

(none)

Database user name; set to * to use Windows integrated authentication

Password

String

(none)

Database password (can be obfuscated with nxencpasswd)

EncryptedPassword

String

(none)

Database password obfuscated with nxencpasswd

ConnectionTTL

Integer

3600

Connection lifetime in seconds

Driver

String

mssql.ddr

Database driver to use (set in the [MSSQL] section; applies to all connections)

DriverOptions

String

(none)

Additional driver options: driver=<name> forces a specific ODBC driver, trustServerCertificate=false disables server certificate trust (default true). Set in the [MSSQL] section; applies to all connections

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

MSSQL.IsReachable(id)

String

Server reachable (YES/NO)

MSSQL.Server.Version(id)

String

Product version

MSSQL.Server.Edition(id)

String

Edition

MSSQL.Server.ProductLevel(id)

String

Product level

MSSQL.Server.Uptime(id)

Int64

Uptime in seconds

Session and Connection Metrics

Parameter Type Description

MSSQL.Server.Connections(id)

Integer

Number of connections

MSSQL.Server.UserConnections(id)

Integer

Number of user connections

MSSQL.Server.UserSessions(id)

Integer

Number of user sessions

MSSQL.Server.ActiveSessions(id)

Integer

Number of active user sessions

MSSQL.Server.Logins(id)

Counter64

Total logins

MSSQL.Server.Logouts(id)

Counter64

Total logouts

Memory Metrics

Parameter Type Description

MSSQL.Memory.AvailablePhysicalMemory(id)

Int64

Available physical memory (bytes)

MSSQL.Memory.BufferCacheHitRatio(id)

Float

Buffer cache hit ratio (%)

MSSQL.Memory.MemoryGrantsOutstanding(id)

Integer

Outstanding memory grants

MSSQL.Memory.MemoryGrantsPending(id)

Integer

Pending memory grants

MSSQL.Memory.MemoryUtilization(id)

Integer

Memory utilization (%)

MSSQL.Memory.PageLifeExpectancy(id)

Int64

Page life expectancy (seconds)

MSSQL.Memory.PhysicalMemoryInUse(id)

Int64

Physical memory in use (bytes)

MSSQL.Memory.PlanCachePages(id)

Int64

Plan cache pages

MSSQL.Memory.TargetServerMemory(id)

Int64

Target server memory (bytes)

MSSQL.Memory.TotalServerMemory(id)

Int64

Total server memory (bytes)

Performance Metrics

Parameter Type Description

MSSQL.Server.BatchRequests(id)

Counter64

Total batch requests

MSSQL.Server.SQLCompilations(id)

Counter64

Total SQL compilations

MSSQL.Server.SQLRecompilations(id)

Counter64

Total SQL re-compilations

MSSQL.Server.SQLErrors(id)

Counter64

Total SQL errors

MSSQL.Server.UserErrors(id)

Counter64

Total user errors

MSSQL.Server.FullScans(id)

Counter64

Total full scans

MSSQL.Server.ForwardedRecords(id)

Counter64

Total forwarded records

MSSQL.Server.PageLookups(id)

Counter64

Total page lookups

MSSQL.Server.PageReads(id)

Counter64

Total page reads

MSSQL.Server.PageWrites(id)

Counter64

Total page writes

MSSQL.Server.PageSplits(id)

Counter64

Total page splits

MSSQL.Server.CheckpointPages(id)

Counter64

Total checkpoint pages

MSSQL.Server.FreeListStalls(id)

Counter64

Total free list stalls

MSSQL.Server.WorkfilesCreated(id)

Counter64

Total workfiles created

MSSQL.Server.WorktablesCreated(id)

Counter64

Total worktables created

MSSQL.Server.TempdbFreeSpace(id)

Int64

Free space in tempdb (bytes)

MSSQL.Server.VersionStoreSize(id)

Int64

Version store size in tempdb (bytes)

Transaction and Lock Metrics

Parameter Type Description

MSSQL.Server.Transactions(id)

Counter64

Total transactions

MSSQL.Server.ActiveTransactions(id)

Integer

Total active transactions

MSSQL.Server.Deadlocks(id)

Counter64

Total number of deadlocks

MSSQL.Server.BlockedProcesses(id)

Integer

Number of blocked processes

MSSQL.Server.LockWaits(id)

Integer

Number of lock waits

MSSQL.Server.LockWaitsPerSec(id)

Counter64

Total lock waits

MSSQL.Server.LockTimeouts(id)

Counter64

Total lock timeouts

MSSQL.Server.AverageLockWaitTime(id)

Float

Average lock wait time (ms)

MSSQL.Server.LogFlushes(id)

Counter64

Total transaction log flushes

MSSQL.Server.LogBytesFlushed(id)

Counter64

Total log bytes flushed

Wait Time by Category

Parameter Type Description

MSSQL.Server.PageIOLatchWaitTime(id)

Counter64

Cumulative page I/O latch wait time (ms)

MSSQL.Server.PageLatchWaitTime(id)

Counter64

Cumulative page latch wait time (ms)

MSSQL.Server.LogWriteWaitTime(id)

Counter64

Cumulative log write wait time (ms)

MSSQL.Server.LogBufferWaitTime(id)

Counter64

Cumulative log buffer wait time (ms)

MSSQL.Server.MemoryGrantQueueWaitTime(id)

Counter64

Cumulative memory grant queue wait time (ms)

MSSQL.Server.NetworkIOWaitTime(id)

Counter64

Cumulative network I/O wait time (ms)

Per-Database Metrics

These metrics take two arguments (connection ID, database name).

Parameter Type Description

MSSQL.Database.Status(id,db)

String

Database status

MSSQL.Database.RecoveryModel(id,db)

String

Recovery model

MSSQL.Database.UserAccess(id,db)

String

User access mode

MSSQL.Database.Collation(id,db)

String

Collation

MSSQL.Database.CompatibilityLevel(id,db)

Integer

Compatibility level

MSSQL.Database.IsEncrypted(id,db)

Integer

1 if encrypted, 0 otherwise

MSSQL.Database.IsReadOnly(id,db)

Integer

1 if read only, 0 otherwise

MSSQL.Database.DataSize(id,db)

Int64

Data file size (bytes)

MSSQL.Database.LogSize(id,db)

Int64

Transaction log file size (bytes)

MSSQL.Database.TotalSize(id,db)

Int64

Total file size (bytes)

MSSQL.Database.LogUsedSize(id,db)

Int64

Used transaction log size (bytes)

MSSQL.Database.PercentLogUsed(id,db)

Integer

Transaction log used (%)

MSSQL.Database.LogGrowths(id,db)

Counter64

Transaction log growths

MSSQL.Database.LogFlushes(id,db)

Counter64

Total transaction log flushes

MSSQL.Database.LogCacheHitRatio(id,db)

Float

Log cache hit ratio (%)

MSSQL.Database.LogReuseWait(id,db)

String

Log reuse wait reason

MSSQL.Database.Transactions(id,db)

Counter64

Total transactions

MSSQL.Database.WriteTransactions(id,db)

Counter64

Total write transactions

MSSQL.Database.ActiveTransactions(id,db)

Integer

Active transactions

MSSQL.Database.LastFullBackupAge(id,db)

Int64

Time since last full backup (seconds)

MSSQL.Database.LastDiffBackupAge(id,db)

Int64

Time since last differential backup (seconds)

MSSQL.Database.LastLogBackupAge(id,db)

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

MSSQL.ResourcePool.CPUUsage(id,pool)

Float

CPU usage (%)

Wait Statistics

These metrics take two arguments (connection ID, wait type).

Parameter Type Description

MSSQL.WaitStats.WaitTime(id,type)

Counter64

Wait time (ms)

MSSQL.WaitStats.WaitingTasks(id,type)

Counter64

Waiting tasks count

MSSQL.WaitStats.SignalWaitTime(id,type)

Counter64

Signal wait time (ms)

Lists

List Description

MSSQL.Connections

Configured connection identifiers

MSSQL.Databases(id)

Databases on the given connection

MSSQL.AllDatabases

All databases on all connections (rows: connectionId,databaseName)

MSSQL.ResourcePools(id)

Resource governor pools on the given connection

MSSQL.WaitTypes(id)

Active wait types on the given connection

MSSQL.DataTags(id)

All data collection tags available on the connection

Tables

Table Columns

MSSQL.Databases(id)

Name, State, Recovery model, User access, Compatibility level, Log reuse wait, Data size, Log size

MSSQL.Sessions(id)

Session ID, Login, Database, Host, Program, Status, CPU time, Memory usage, Last request

MSSQL.WaitStats(id)

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 nxencpasswd tool 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

  1. Verify network connectivity from the agent host to the database server

  2. Check credentials and permissions

  3. Verify the database driver/client libraries are installed on the agent host

  4. Check agent log for database connection error messages

Query Errors

  1. Test the query manually using a database client

  2. Verify the query returns exactly one value (for single-value queries)

  3. Check for SQL syntax compatibility with the target database

  4. Ensure the monitoring user has SELECT permission on the referenced tables

Subagent Not Loading

  1. Verify the subagent file exists in the agent modules directory

  2. Check that required client libraries are installed and in the library path

  3. Review the agent log for subagent loading errors