[prometheus] Monitor UPS

certbot_on_virtu
Alexandre Iooss 2019-05-14 09:10:48 +02:00
parent 1e922de8b0
commit b32859ecc8
No known key found for this signature in database
GPG Key ID: 6C79278F3FCDCC02
3 changed files with 9 additions and 9 deletions

View File

@ -27,7 +27,7 @@
job: prometheus
targets:
- localhost:9090
prometheus_snmp_targets:
prometheus_ups_snmp_targets:
- targets:
- pulsar.adm.crans.org
# Debian non-free mirror

View File

@ -23,13 +23,13 @@
notify: Restart Prometheus
# Doesn't work on Debian Stretch
- name: Make Prometheus snmp-exporter listen on adm only
- name: Make Prometheus snmp-exporter listen on localhost only
when:
- ansible_lsb.codename == 'buster'
lineinfile:
path: /etc/default/prometheus-snmp-exporter
regexp: '^ARGS='
line: "ARGS=\"--web.listen-address={{ ansible_fqdn }}:9116\""
line: "ARGS=\"--web.listen-address=127.0.0.1:9116\""
notify: Restart prometheus-snmp-exporter
# We don't need to restart Prometheus when updating nodes
@ -39,10 +39,10 @@
dest: /etc/prometheus/targets.json
# We don't need to restart Prometheus when updating nodes
- name: Configure Prometheus SNMP devices
- name: Configure Prometheus UPS SNMP devices
copy:
content: "{{ prometheus_snmp_targets | to_nice_json }}"
dest: /etc/prometheus/targets_snmp.json
content: "{{ prometheus_ups_snmp_targets | to_nice_json }}"
dest: /etc/prometheus/targets_ups_snmp.json
- name: Activate prometheus service
systemd:

View File

@ -29,13 +29,13 @@ scrape_configs:
file_sd_configs:
- files:
- '/etc/prometheus/targets.json'
- job_name: snmp
- job_name: ups_snmp
file_sd_configs:
- files:
- '/etc/prometheus/targets_snmp.json'
- '/etc/prometheus/targets_ups_snmp.json'
metrics_path: /snmp
params:
module: [if_mib]
module: [eatonups]
relabel_configs:
- source_labels: [__address__]
target_label: __param_target