System Metrics
The System Metrics plugin turns the InfluxDB 3 host into its own monitoring source, collecting CPU, memory, disk, and network metrics directly into InfluxDB. It gives teams built in visibility into system health, helping them spot performance issues faster and reduce tool sprawl across server and infrastructure monitoring.
Configuration
Plugin parameters may be specified as key-value pairs in the --trigger-arguments flag (CLI) or in the trigger_arguments field (API) when creating a trigger. Some plugins support TOML configuration files, which can be specified using the plugin’s config_file_path parameter.
If a plugin supports multiple trigger specifications, some parameters may depend on the trigger specification that you use.
Plugin metadata
This plugin includes a JSON metadata schema in its docstring that defines supported trigger types and configuration parameters. This metadata enables the InfluxDB 3 Explorer UI to display and configure the plugin.
Optional parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
hostname |
string | localhost |
Hostname to tag all metrics with for system identification |
include_cpu |
boolean | true |
Include comprehensive CPU metrics collection (overall and per-core statistics) |
include_memory |
boolean | true |
Include memory metrics collection (RAM usage, swap statistics, page faults) |
include_disk |
boolean | true |
Include disk metrics collection (partition usage, I/O statistics, performance) |
include_network |
boolean | true |
Include network metrics collection (interface statistics and error counts) |
max_retries |
integer | 3 |
Maximum retry attempts on failure with graceful error handling |
Note: This plugin has no required parameters. All parameters have sensible defaults.
TOML configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
config_file_path |
string | none | TOML config file path relative to PLUGIN_DIR (required for TOML configuration) |
To use a TOML configuration file, set the PLUGIN_DIR environment variable and specify the config_file_path in the trigger arguments. This is in addition to the --plugin-dir flag when starting InfluxDB 3.
Example TOML configuration
system_metrics_config_scheduler.toml
For more information on using TOML configuration files, see the Using TOML Configuration Files section in the influxdb3_plugins/README.md.
Examples
Monitor Web Server Performance
# Create trigger for web server monitoring every 15 seconds
influxdb3 create trigger \
--database web_monitoring \
--path "gh:influxdata/system_metrics/system_metrics.py" \
--trigger-spec "every:15s" \
--trigger-arguments hostname=web-server-01,include_network=true \
web_server_metrics
Database Server Monitoring
# Focus on CPU and disk metrics for database server
influxdb3 create trigger \
--database db_monitoring \
--path "gh:influxdata/system_metrics/system_metrics.py" \
--trigger-spec "every:30s" \
--trigger-arguments hostname=db-primary,include_disk=true,include_cpu=true,include_network=false \
database_metrics
High-Frequency System Monitoring
# Collect all metrics every 10 seconds with higher retry tolerance
influxdb3 create trigger \
--database system_monitoring \
--path "gh:influxdata/system_metrics/system_metrics.py" \
--trigger-spec "every:10s" \
--trigger-arguments hostname=critical-server,max_retries=10 \
high_freq_metrics
Query collected metrics
This plugin collects system metrics automatically. After the trigger runs, query to view the collected data:
influxdb3 query \
--database system_monitoring \
"SELECT * FROM system_cpu WHERE time >= now() - interval '5 minutes' LIMIT 5"
Expected output
+——+——–+——-+——–+——+——–+——-+——–+——-+——-+————+——————+ | host | cpu | user | system | idle | iowait | nice | irq | load1 | load5 | load15 | time | +——+——–+——-+——–+——+——–+——-+——–+——-+——-+————+——————+ | srv1 | total | 12.5 | 5.3 | 81.2 | 0.8 | 0.0 | 0.2 | 0.85 | 0.92 | 0.88 | 2024-01-15 10:00 | | srv1 | total | 13.1 | 5.5 | 80.4 | 0.7 | 0.0 | 0.3 | 0.87 | 0.93 | 0.88 | 2024-01-15 10:01 | | srv1 | total | 11.8 | 5.1 | 82.0 | 0.9 | 0.0 | 0.2 | 0.83 | 0.91 | 0.88 | 2024-01-15 10:02 | | srv1 | total | 14.2 | 5.8 | 79.0 | 0.8 | 0.0 | 0.2 | 0.89 | 0.92 | 0.88 | 2024-01-15 10:03 | | srv1 | total | 12.9 | 5.4 | 80.6 | 0.9 | 0.0 | 0.2 | 0.86 | 0.92 | 0.88 | 2024-01-15 10:04 | +——+——–+——-+——–+——+——–+——-+——–+——-+——-+————+——————+
Ready to get started?
Download InfluxDB 3 and have running in minutes.