Add collector role
Sets up prometheus to pull metrics, with telegraf to process SNMP data.
This commit is contained in:
parent
6600a6fa36
commit
da3db8cc02
11 changed files with 228 additions and 0 deletions
20
roles/collector/templates/prometheus-job.yml.j2
Normal file
20
roles/collector/templates/prometheus-job.yml.j2
Normal file
|
@ -0,0 +1,20 @@
|
|||
{% set devices = query("netbox.netbox.nb_lookup", "devices", api_filter="{{ item.nb_filter }}", raw_data=true)
|
||||
| selectattr("primary_ip")
|
||||
| map(attribute="name")
|
||||
| map("extract", hostvars) -%}
|
||||
|
||||
scrape_configs:
|
||||
- job_name: "{{ item.name }}"
|
||||
relabel_configs:
|
||||
- source_labels: [__address__]
|
||||
regex: '([^.]+).*'
|
||||
target_label: name
|
||||
replacement: ${1}
|
||||
static_configs:
|
||||
- targets:
|
||||
{% for address in devices
|
||||
| selectattr("dns_name", "defined")
|
||||
| map(attribute="dns_name")
|
||||
| reject("none") | sort | unique %}
|
||||
- "{{ address }}:9100"
|
||||
{% endfor %}
|
Loading…
Add table
Add a link
Reference in a new issue