The Metrics plugin collects system metrics from all available sources with automatic detection. It discovers CPUs, disks, network interfaces, and GPUs without manual configuration.
- Binary:
logflux-metrics - Platform: Linux, macOS
- Entry type: Metric
- Service:
logflux-agent-metrics.service
Installation
The metrics plugin is included in the LogFlux Agent package and enabled by default. After installing the agent:
1
| sudo systemctl enable --now logflux-agent-metrics
|
Command-Line Flags
| Flag | Default | Description |
|---|
-config FILE | – | Path to YAML configuration file |
-interval D | 60s | Collection interval (minimum 15s) |
-batch-size N | 10 | Metrics per batch |
-no-batch | false | Disable batching |
-cpu | true | Collect CPU metrics |
-memory | true | Collect memory metrics |
-disk | true | Collect disk metrics |
-network | true | Collect network metrics |
-system | true | Collect system info |
-gpu | true | Collect GPU metrics (if available) |
-verbose | false | Enable verbose output |
-version | – | Show version and exit |
Configuration File
Default location: /etc/logflux-agent/plugins/metrics.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
| name: metrics
version: 1.0.0
source: metrics-plugin
agent:
socket_path: /var/run/logflux-agent/agent.sock
network: unix
connect_timeout: 10s
max_retries: 3
retry_delay: 1s
plugin:
interval: 60s # Collection frequency
collect_cpu: true
collect_memory: true
collect_disk: true
collect_network: true
collect_system: true
logging:
level: info
labels:
component: metrics
plugin: metrics
verbose: false
batch:
enabled: true
max_size: 10
flush_interval: 5s
auto_flush: true
|
Collected Metrics
CPU
- Per-core user, system, idle, iowait percentages
- Load averages (1, 5, 15 minutes)
- IRQ and steal time on supported systems
Memory
- Total and available physical memory
- Swap usage
- Cache and buffer sizes
- Memory pressure indicators
Disk
- Space usage per mounted filesystem
- I/O statistics per block device
- IOPS and throughput
- Virtual filesystems (procfs, sysfs) excluded automatically
Network
- Per-interface bytes sent/received
- TCP connection states
- Error and drop rates
- Physical vs virtual interface detection
GPU
Detected automatically when management tools are present:
- NVIDIA:
nvidia-smi (utilization, memory, temperature) - AMD:
rocm-smi - Intel:
intel_gpu_top
No configuration needed – if the GPU tools are installed, metrics are collected.
Metrics are sent as structured JSON:
1
2
3
4
5
6
7
8
9
10
11
12
| {
"metric_type": "cpu",
"timestamp": 1234567890,
"host": "server01",
"cpu0_user_percent": 25.5,
"cpu0_system_percent": 10.2,
"cpu0_idle_percent": 60.3,
"cpu0_iowait_percent": 4.0,
"load_avg_1": 1.24,
"load_avg_5": 1.15,
"load_avg_15": 1.08
}
|
Usage Examples
1
2
3
4
5
6
7
8
9
10
11
| # Default (all metrics, 60s interval)
logflux-metrics
# Faster collection
logflux-metrics -interval 30s
# CPU and memory only
logflux-metrics -disk=false -network=false -gpu=false
# Debugging
logflux-metrics -verbose -interval 5s
|
- CPU usage: < 0.5% on average
- Memory: ~10-20 MB resident
- Collection is non-blocking
- Batching reduces network overhead
| Platform | CPU | Memory | Disk | Network | GPU |
|---|
| Linux | Full | Full | Full | Full | NVIDIA, AMD, Intel |
| macOS | Full | Full | Full | Full | – |
Service Management
1
2
3
4
| sudo systemctl start logflux-agent-metrics
sudo systemctl stop logflux-agent-metrics
sudo systemctl status logflux-agent-metrics
sudo journalctl -u logflux-agent-metrics -f
|