Add collect[] parameter (#699)
* Add `collect[]` parameter * Add TODo comment about staticcheck ignored * Restore promhttp.HandlerOpts * Log a warning and return HTTP error instead of failing * Check collector existence and status, cleanups * Fix warnings and error messages * Don't panic, return error if collector registration failed * Update README
This commit is contained in:
parent
8f9edf87b5
commit
f3a7022602
4 changed files with 91 additions and 14 deletions
33
README.md
33
README.md
|
|
@ -107,6 +107,39 @@ echo 'role{role="application_server"} 1' > /path/to/directory/role.prom.$$
|
|||
mv /path/to/directory/role.prom.$$ /path/to/directory/role.prom
|
||||
```
|
||||
|
||||
### Filtering enabled collectors
|
||||
|
||||
The node_exporter will expose all metrics from enabled collectors by default, but it can be passed an optional list of collectors to filter metrics. The `collect[]` parameter accepts values matching enabled collector names.
|
||||
|
||||
This can be useful for specifying different scrape intervals for different collectors in Prometheus:
|
||||
|
||||
```yaml
|
||||
scrape_configs:
|
||||
- job_name: 'node resources'
|
||||
scrape_interval: 15s
|
||||
static_configs:
|
||||
- targets:
|
||||
- '192.168.1.2:9100'
|
||||
params:
|
||||
collect[]:
|
||||
- cpu
|
||||
- meminfo
|
||||
- diskstats
|
||||
- netdev
|
||||
- netstat
|
||||
|
||||
- job_name: 'node storage'
|
||||
scrape_interval: 1m
|
||||
static_configs:
|
||||
- targets:
|
||||
- '192.168.1.2:9100'
|
||||
params:
|
||||
collect[]:
|
||||
- filefd
|
||||
- filesystem
|
||||
- xfs
|
||||
```
|
||||
|
||||
## Building and running
|
||||
|
||||
Prerequisites:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue