exec
Reference for the `exec` collector.
exec· collector · runnanook doc execfor the same content in your terminal.
Runs a shell command and captures its first line of output as a metric.
Options
| Option | Type | Default | Description |
|---|---|---|---|
cmd | string | required | shell command to execute |
metric | string | exec | base metric name |
Metrics
| Metric | Kind | Unit | Description |
|---|---|---|---|
exec.val | numeric | — | first line of output parsed as f64 |
Examples
Disk usage as a number
[[]]
= "disk-pct"
= "exec"
= 30
[]
= "df / --output=pcent | tail -1 | tr -d ' %'"
Custom backlog probe
[[]]
= "queue-depth"
= "exec"
= 15
[]
= "redis-cli LLEN jobs"
Alert on backlog growth
[[]]
= "queue-depth::exec.val > 1000"
= 3
= "ops"
= "jobs queue at {{ value }}"