monitoring: nice labels for openwrt switches

* keep instance label
* add site and location labels
This commit is contained in:
Gregor Michels 2023-03-07 23:44:19 +01:00
parent 8fa87485ff
commit 72df3338d3
1 changed files with 9 additions and 2 deletions

View File

@ -38,9 +38,16 @@ scrape_configs:
- job_name: 'snmp'
static_configs:
- targets:
{% for host in groups['switches_stock'] %}
- {{ hostvars[host]['ip'] }}
- targets: ["{{ hostvars[host]['ip'] }}"]
labels:
instance: "{{ host }}"
{% if hostvars[host]['site'] is defined %}
site: "{{ hostvars[host]['site'] }}"
{% endif %}
{% if hostvars[host]['location'] is defined %}
location: "{{ hostvars[host]['location'] }}"
{% endif %}
{% endfor %}
metrics_path: /snmp
params: