There is already a question regarding this. But it's not answered properly. I'm trying to understand how to use the Filtering enabled collectors in this link
params:
collect[]:
- foo
- bar
I tried
- params:
[ collect[]: ['diskstats', 'filefd', 'filesystem', 'loadavg', 'meminfo', 'netdev', 'netstat', 'stat', 'time', 'uname', 'vmstat'] ]
or
- params:
[ collect: ['diskstats', 'filefd', 'filesystem', 'loadavg', 'meminfo', 'netdev', 'netstat', 'stat', 'time', 'uname', 'vmstat'] ]
or
- params:
-collect: ['diskstats', 'filefd', 'filesystem', 'loadavg', 'meminfo', 'netdev', 'netstat', 'stat', 'time', 'uname', 'vmstat']
You need the the yaml
to the Prometheus configuration under scrape_config like below sample:
scrape_configs:
- job_name: prometheus
params:
collect[]:
- diskstats
- filefd
- filesystem
- loadavg
- meminfo
- netdev
- netstat
- stat
- time
- uname
- vmstat
file_sd_configs:
- files:
static_configs:
- targets: ['localhost:9090', 'localhost:9191']
labels:
my: label
your: label
relabel_configs:
- source_labels: [job, __meta_dns_name]
regex: (.*)some-[regex]
target_label: job
replacement: foo-${1}
# action defaults to 'replace'
- source_labels: [abc]
target_label: cde
- replacement: static
target_label: abc
- regex:
replacement: static
target_label: abc
References: