[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 job: prometheus
targets: targets:
- localhost:9090 - localhost:9090
prometheus_snmp_targets: prometheus_ups_snmp_targets:
- targets: - targets:
- pulsar.adm.crans.org - pulsar.adm.crans.org
# Debian non-free mirror # Debian non-free mirror

View File

@ -23,13 +23,13 @@
notify: Restart Prometheus notify: Restart Prometheus
# Doesn't work on Debian Stretch # 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: when:
- ansible_lsb.codename == 'buster' - ansible_lsb.codename == 'buster'
lineinfile: lineinfile:
path: /etc/default/prometheus-snmp-exporter path: /etc/default/prometheus-snmp-exporter
regexp: '^ARGS=' 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 notify: Restart prometheus-snmp-exporter
# We don't need to restart Prometheus when updating nodes # We don't need to restart Prometheus when updating nodes
@ -39,10 +39,10 @@
dest: /etc/prometheus/targets.json dest: /etc/prometheus/targets.json
# We don't need to restart Prometheus when updating nodes # We don't need to restart Prometheus when updating nodes
- name: Configure Prometheus SNMP devices - name: Configure Prometheus UPS SNMP devices
copy: copy:
content: "{{ prometheus_snmp_targets | to_nice_json }}" content: "{{ prometheus_ups_snmp_targets | to_nice_json }}"
dest: /etc/prometheus/targets_snmp.json dest: /etc/prometheus/targets_ups_snmp.json
- name: Activate prometheus service - name: Activate prometheus service
systemd: systemd:

View File

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