AIX DB2
AIX DB2 input collects instance, database, tablespace, HADR, and custom metrics through DB2 CLP commands.
Configuration¶
[inputs]
# Global switch for middleware inputs.
enabled = true
[[inputs.db2]]
# Instance name, reported as the `instance` tag.
name = "db2inst1"
# Whether to enable this DB2 instance collection.
enabled = true
# Collection interval.
interval = "60s"
# Optional file loaded before collection to set instance environment variables.
env_file = ""
# Whether to collect advanced metrics such as HADR.
collect_advanced = false
# Optional custom metric command. Each output line should be `key=value`.
deep_metrics_command = ""
# DB2 command paths.
db2_command = "db2"
db2pd_command = "db2pd"
# DB2 instance user.
instance_user = "db2inst1"
# List of databases to collect.
db_names = ["SAMPLE"]
Command Dependencies¶
| Command | Description |
|---|---|
db2 get snapshot for dbm |
Collect DB2 instance agent metrics. |
db2 get snapshot for database on <db> |
Collect database connection, lock, log, and buffer pool overview metrics. |
db2 list tablespaces show detail |
Collect tablespace capacity. |
db2 get db cfg for <db> |
Collect HADR and archive log related configuration. |
db2pd -db <db> -hadr |
collect_advanced = true collect HADR runtime status. |
deep_metrics_command |
Custom command that outputs key=value lines for custom metrics. |
Metrics¶
All metrics append host, input=db2, and instance=<name> tags.
db2_instance¶
| Tags & Fields | Description |
|---|---|
| host ( tag) |
Hostname. |
| input ( tag) |
Fixed to db2. |
| instance ( tag) |
Input instance name. |
| up | Whether the instance command succeeded. Type: int | (gauge) |
| agents | Number of DB2 agents. Type: int | (gauge) Unit: count |
| agents_registered | Number of registered agents. Type: int | (gauge) Unit: count |
| agents_waiting | Number of agents waiting for tokens. Type: int | (gauge) Unit: count |
db2_database¶
| Tags & Fields | Description |
|---|---|
| db_name ( tag) |
Database name. |
| status ( tag) |
Database status. |
| connected | Whether the database is active. Type: int | (gauge) |
| connections | Current connection count. Type: int | (gauge) Unit: count |
| locks_held | Current number of held locks. Type: int | (gauge) Unit: count |
| lock_waits | Lock wait count. Type: int | (count) Unit: count |
| deadlocks | Deadlock count. Type: int | (count) Unit: count |
| bufferpool_hit_pct | buffer pool hit percentage. Type: float | (gauge) Unit: percent |
| log_available_bytes | Available log space. Type: int | (gauge) Unit: byte |
| log_used_bytes | Used log space. Type: int | (gauge) Unit: byte |
db2_tablespace¶
| Tags & Fields | Description |
|---|---|
| db_name ( tag) |
Database name. |
| tablespace ( tag) |
Tablespace name. |
| total_pages | Total pages. Type: int | (gauge) Unit: count |
| used_pages | Used pages. Type: int | (gauge) Unit: count |
| free_pages | Free pages. Type: int | (gauge) Unit: count |
| page_size_bytes | Page size. Type: int | (gauge) Unit: byte |
| used_pct | Usage percentage. Type: float | (gauge) Unit: percent |
db2_database_config¶
| Tags & Fields | Description |
|---|---|
| db_name ( tag) |
Database name. |
| parameter ( tag) |
configuration parameter name. |
| value | Numeric configuration value. Type: int | (gauge) |
db2_hadr¶
| Tags & Fields | Description |
|---|---|
| db_name ( tag) |
Database name. |
| member ( tag) |
HADR member. |
| hadr_role ( tag) |
HADR role. |
| hadr_state ( tag) |
HADR state. |
| hadr_connect_status ( tag) |
HADR connection status. |
| connected | Whether HADR is connected. Type: int | (gauge) |
| primary | Whether the HADR role is PRIMARY. Type: int | (gauge) |
| hadr_log_gap | HADR log gap. Type: int | (gauge) Unit: count |
| standby_replay_log_gap | standby replay log gap. Type: int | (gauge) Unit: count |
Custom Metrics¶
Custom metric fields are determined by deep_metrics_command output. Fields listed in the table are used as tags; numeric values in other key=value pairs are reported as int/float | (gauge) fields, and non-numeric values are reported as tags. If no numeric field exists, count=1 is added with unit count.
| Measurement | Tags | Description |
|---|---|---|
db2_table_metric |
table, db_name, schema |
Custom table-level metrics. |
db2_index_metric |
index, db_name, schema, table |
Custom index metrics. |
db2_long_transaction |
application, db_name, auth_id |
Custom long transaction metrics. |
db2_purescale_member |
member, db_name, status |
Custom pureScale member metrics. |
db2_deep_metric |
metric, db_name, unit |
Generic DB2 custom metrics. |