From cc2ba9ff7b92031777ec9910b6e53954f22e792c Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Fri, 31 Dec 2021 14:43:47 +0100 Subject: [PATCH 1/8] prometheus: deploy targets_ipmi.json --- playbooks/prometheus.yml | 18 ++++++++++++++++++ roles/prometheus/tasks/main.yml | 7 +++++++ 2 files changed, 25 insertions(+) diff --git a/playbooks/prometheus.yml b/playbooks/prometheus.yml index 9be7fb6..fe4be29 100755 --- a/playbooks/prometheus.yml +++ b/playbooks/prometheus.yml @@ -14,6 +14,9 @@ {{ groups['fleming_pve'] + groups['fleming_vm'] | list | sort }} prometheus_unifi_snmp_targets: - targets: "{{ groups['fleming_unifi'] | list | sort }}" + prometheus_ipmi_targets: + - targets: | + {{ groups['fleming_pve'] + groups['fleming_server'] | list | sort }} update_motd: prometheus: >- Prometheus (en configuration fleming) est déployé (/etc/prometheus). @@ -38,6 +41,9 @@ prometheus_ups_snmp_targets: - ups-pn-1.ups.auro.re - ups-ps-1.ups.auro.re + prometheus_ipmi_targets: + - targets: | + {{ groups['pacaterie_pve'] | list | sort }} update_motd: prometheus: >- Prometheus (en configuration pacaterie) est déployé (/etc/prometheus). @@ -64,6 +70,9 @@ {{ groups['edc_pve'] + groups['edc_vm'] + groups['edc_server'] | list | sort }} prometheus_unifi_snmp_targets: - targets: "{{ groups['edc_unifi'] | list | sort }}" + prometheus_ipmi_targets: + - targets: | + {{ groups['edc_pve'] + groups['edc_server'] | list | sort }} update_motd: prometheus: >- Prometheus (en configuration edc) est déployé (/etc/prometheus). @@ -89,6 +98,9 @@ - ups-gk-1.ups.auro.re prometheus_pdu_snmp_targets: - pdu-ga-1.ups.auro.re + prometheus_ipmi_targets: + - targets: | + {{ groups['gs_pve'] | list | sort }} update_motd: prometheus: >- Prometheus (en configuration gs) est déployé (/etc/prometheus). @@ -114,6 +126,9 @@ {{ groups['rives_pve'] + groups['rives_vm'] | list | sort }} prometheus_unifi_snmp_targets: - targets: "{{ groups['rives_unifi'] | list | sort }}" + prometheus_ipmi_targets: + - targets: | + {{ groups['rives_pve'] | list | sort }} update_motd: prometheus: >- Prometheus (en configuration rives) est déployé (/etc/prometheus). @@ -152,6 +167,9 @@ - sw-ec-core.switch.auro.re - sw-gk-core.switch.auro.re - sw-r3-core.switch.auro.re + prometheus_ipmi_targets: + - targets: | + {{ groups['aurore_pve'] | list | sort }} update_motd: prometheus: >- Prometheus (en configuration aurore) est déployé (/etc/prometheus). diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml index e7dd24d..284fa8b 100644 --- a/roles/prometheus/tasks/main.yml +++ b/roles/prometheus/tasks/main.yml @@ -113,6 +113,13 @@ mode: 0644 when: prometheus_pdu_snmp_targets is defined +- name: Configure Prometheus ipmi targets monitoring + copy: + content: "{{ prometheus_ipmi_targets | to_nice_json }}\n" + dest: /etc/prometheus/targets_ipmi.json + mode: 0644 + when: prometheus_ipmi_targets is defined + - name: Activate prometheus service systemd: name: prometheus -- 2.43.4 From bc4dc03029d62b818cea0c180c759392c4685d42 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Fri, 31 Dec 2021 14:44:19 +0100 Subject: [PATCH 2/8] prometheus: add newline at the end of targets JSON --- roles/prometheus/tasks/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml index 284fa8b..5d4e7ca 100644 --- a/roles/prometheus/tasks/main.yml +++ b/roles/prometheus/tasks/main.yml @@ -66,21 +66,21 @@ # We don't need to restart Prometheus when updating nodes - name: Configure Prometheus nodes copy: - content: "{{ prometheus_targets | to_nice_json }}" + content: "{{ prometheus_targets | to_nice_json }}\n" dest: /etc/prometheus/targets.json mode: 0644 # We don't need to restart Prometheus when updating nodes - name: Configure Prometheus Ubiquity Unifi SNMP devices copy: - content: "{{ prometheus_unifi_snmp_targets | to_nice_json }}" + content: "{{ prometheus_unifi_snmp_targets | to_nice_json }}\n" dest: /etc/prometheus/targets_unifi_snmp.json mode: 0644 when: prometheus_unifi_snmp_targets is defined - name: Configure Prometheus Switchs copy: - content: "{{ prometheus_switch_snmp_targets | to_nice_json }}" + content: "{{ prometheus_switch_snmp_targets | to_nice_json }}\n" dest: /etc/prometheus/targets_switch_snmp.json mode: 0644 when: prometheus_switch_snmp_targets is defined -- 2.43.4 From f50778ca96e622c349533a455fc596b6eb13cfe8 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Fri, 31 Dec 2021 14:44:50 +0100 Subject: [PATCH 3/8] prometheus: commit production alert configuration --- roles/prometheus/templates/postgres.rules.yml.j2 | 2 +- roles/prometheus/templates/server.rules.yml.j2 | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/roles/prometheus/templates/postgres.rules.yml.j2 b/roles/prometheus/templates/postgres.rules.yml.j2 index 0ec4952..aa24537 100644 --- a/roles/prometheus/templates/postgres.rules.yml.j2 +++ b/roles/prometheus/templates/postgres.rules.yml.j2 @@ -112,7 +112,7 @@ groups: rate(pg_stat_database_xact_rollback{datname!~"template.*"}[3m]) / rate(pg_stat_database_xact_commit{datname!~"template.*"}[3m]) ) * 100 - > 7 + > 20 for: 0m labels: severity: warning diff --git a/roles/prometheus/templates/server.rules.yml.j2 b/roles/prometheus/templates/server.rules.yml.j2 index 5277fdf..457e5e8 100644 --- a/roles/prometheus/templates/server.rules.yml.j2 +++ b/roles/prometheus/templates/server.rules.yml.j2 @@ -10,23 +10,17 @@ groups: - name: server.rules rules: - - alert: InstanceDown + - alert: MachineDown expr: up{instance!~".*.borne.auro.re$"} == 0 for: 3m labels: severity: critical - annotations: - summary: >- - Invisible depuis plus de 3 minutes - alert: AccessPointDown expr: up{instance=~".*.borne.auro.re$"} == 0 for: 3m labels: severity: warning - annotations: - summary: >- - Invisible depuis plus de 3 minutes - alert: OutOfMemory expr: >- @@ -50,7 +44,7 @@ groups: node_memory_SwapFree_bytes / node_memory_SwapTotal_bytes ) - ) * 100 >= 20 + ) * 100 >= 50 for: 3m labels: severity: warning -- 2.43.4 From 944e2003945a9676a99e16fec052a873116b96f7 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Fri, 31 Dec 2021 14:45:05 +0100 Subject: [PATCH 4/8] prometheus: add ipmi job --- roles/prometheus/templates/prometheus.yml.j2 | 17 +++++++++++++++++ .../templates/prometheus.yml.j2 | 1 + 2 files changed, 18 insertions(+) diff --git a/roles/prometheus/templates/prometheus.yml.j2 b/roles/prometheus/templates/prometheus.yml.j2 index 4400de3..05564af 100644 --- a/roles/prometheus/templates/prometheus.yml.j2 +++ b/roles/prometheus/templates/prometheus.yml.j2 @@ -140,4 +140,21 @@ scrape_configs: - target_label: __address__ replacement: 127.0.0.1:9116 + - job_name: ipmi + file_sd_configs: + - files: + - '/etc/prometheus/targets_ipmi.json' + metrics_path: /metrics + params: + module: [default] + relabel_configs: + # Do not put :9290 in instance name, rather here + - source_labels: [__address__] + target_label: __param_target + - source_labels: [__param_target] + target_label: instance + - source_labels: [__param_target] + target_label: __address__ + replacement: '$1:9290' + ... diff --git a/roles/prometheus_federate/templates/prometheus.yml.j2 b/roles/prometheus_federate/templates/prometheus.yml.j2 index 4757b98..fc848db 100644 --- a/roles/prometheus_federate/templates/prometheus.yml.j2 +++ b/roles/prometheus_federate/templates/prometheus.yml.j2 @@ -39,4 +39,5 @@ scrape_configs: - '{job="apc_pdu_snmp"}' - '{job="docker"}' - '{job="switch_snmp"}' + - '{job="ipmi"}' ... -- 2.43.4 From 265bd5fbb7cc31dcb265c691b182c6676d5f8355 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Fri, 31 Dec 2021 15:08:44 +0100 Subject: [PATCH 5/8] prometheus: use static targets --- playbooks/prometheus.yml | 142 ++++++++----------- roles/prometheus/tasks/main.yml | 69 ++------- roles/prometheus/templates/prometheus.yml.j2 | 63 ++++---- 3 files changed, 107 insertions(+), 167 deletions(-) diff --git a/playbooks/prometheus.yml b/playbooks/prometheus.yml index fe4be29..553f960 100755 --- a/playbooks/prometheus.yml +++ b/playbooks/prometheus.yml @@ -8,15 +8,13 @@ snmp_pdu_user: "{{ vault_snmp_pdu_user }}" snmp_pdu_password: "{{ vault_snmp_pdu_password }}" - # Prometheus targets.json - prometheus_targets: - - targets: | - {{ groups['fleming_pve'] + groups['fleming_vm'] | list | sort }} - prometheus_unifi_snmp_targets: - - targets: "{{ groups['fleming_unifi'] | list | sort }}" - prometheus_ipmi_targets: - - targets: | - {{ groups['fleming_pve'] + groups['fleming_server'] | list | sort }} + prometheus_servers_targets: | + {{ groups['fleming_pve'] + groups['fleming_vm'] | list | sort }} + prometheus_unifi_snmp_targets: | + {{ groups['fleming_unifi'] | list | sort }} + prometheus_ipmi_targets: | + {{ groups['fleming_pve'] + groups['fleming_server'] | list | sort }} + update_motd: prometheus: >- Prometheus (en configuration fleming) est déployé (/etc/prometheus). @@ -32,18 +30,16 @@ snmp_pdu_user: "{{ vault_snmp_pdu_user }}" snmp_pdu_password: "{{ vault_snmp_pdu_password }}" - # Prometheus targets.json - prometheus_targets: - - targets: | - {{ groups['pacaterie_pve'] + groups['pacaterie_vm'] | list | sort }} - prometheus_unifi_snmp_targets: - - targets: "{{ groups['pacaterie_unifi'] | list | sort }}" + prometheus_servers_targets: | + {{ groups['pacaterie_pve'] + groups['pacaterie_vm'] | list | sort }} + prometheus_unifi_snmp_targets: | + {{ groups['pacaterie_unifi'] | list | sort }} prometheus_ups_snmp_targets: - ups-pn-1.ups.auro.re - ups-ps-1.ups.auro.re - prometheus_ipmi_targets: - - targets: | - {{ groups['pacaterie_pve'] | list | sort }} + prometheus_ipmi_targets: | + {{ groups['pacaterie_pve'] | list | sort }} + update_motd: prometheus: >- Prometheus (en configuration pacaterie) est déployé (/etc/prometheus). @@ -59,20 +55,17 @@ snmp_pdu_user: "{{ vault_snmp_pdu_user }}" snmp_pdu_password: "{{ vault_snmp_pdu_password }}" - # Prometheus targets.json prometheus_ups_snmp_targets: - ups-ec-1.ups.auro.re - ups-ec-2.ups.auro.re - ups-ec-3.ups.auro.re + prometheus_servers_targets: | + {{ groups['edc_pve'] + groups['edc_vm'] + groups['edc_server'] | list | sort }} + prometheus_unifi_snmp_targets: | + {{ groups['edc_unifi'] | list | sort }} + prometheus_ipmi_targets: | + {{ groups['edc_pve'] + groups['edc_server'] | list | sort }} - prometheus_targets: - - targets: | - {{ groups['edc_pve'] + groups['edc_vm'] + groups['edc_server'] | list | sort }} - prometheus_unifi_snmp_targets: - - targets: "{{ groups['edc_unifi'] | list | sort }}" - prometheus_ipmi_targets: - - targets: | - {{ groups['edc_pve'] + groups['edc_server'] | list | sort }} update_motd: prometheus: >- Prometheus (en configuration edc) est déployé (/etc/prometheus). @@ -88,19 +81,17 @@ snmp_pdu_user: "{{ vault_snmp_pdu_user }}" snmp_pdu_password: "{{ vault_snmp_pdu_password }}" - # Prometheus targets.json - prometheus_targets: - - targets: | - {{ groups['gs_pve'] + groups['gs_vm'] | list | sort }} - prometheus_unifi_snmp_targets: - - targets: "{{ groups['gs_unifi'] | list | sort }}" + prometheus_servers_targets: | + {{ groups['gs_pve'] + groups['gs_vm'] | list | sort }} + prometheus_unifi_snmp_targets: | + {{ groups['gs_unifi'] | list | sort }} prometheus_ups_snmp_targets: - ups-gk-1.ups.auro.re - prometheus_pdu_snmp_targets: + prometheus_apc_pdu_snmp_targets: - pdu-ga-1.ups.auro.re - prometheus_ipmi_targets: - - targets: | - {{ groups['gs_pve'] | list | sort }} + prometheus_ipmi_targets: | + {{ groups['gs_pve'] | list | sort }} + update_motd: prometheus: >- Prometheus (en configuration gs) est déployé (/etc/prometheus). @@ -116,19 +107,16 @@ snmp_pdu_user: "{{ vault_snmp_pdu_user }}" snmp_pdu_password: "{{ vault_snmp_pdu_password }}" - # Prometheus targets.json prometheus_ups_snmp_targets: - ups-r3-1.ups.auro.re - ups-r1-1.ups.auro.re + prometheus_servers_targets: | + {{ groups['rives_pve'] + groups['rives_vm'] | list | sort }} + prometheus_unifi_snmp_targets: | + {{ groups['rives_unifi'] | list | sort }} + prometheus_ipmi_targets: | + {{ groups['rives_pve'] | list | sort }} - prometheus_targets: - - targets: | - {{ groups['rives_pve'] + groups['rives_vm'] | list | sort }} - prometheus_unifi_snmp_targets: - - targets: "{{ groups['rives_unifi'] | list | sort }}" - prometheus_ipmi_targets: - - targets: | - {{ groups['rives_pve'] | list | sort }} update_motd: prometheus: >- Prometheus (en configuration rives) est déployé (/etc/prometheus). @@ -144,32 +132,28 @@ snmp_pdu_user: "{{ vault_snmp_pdu_user }}" snmp_pdu_password: "{{ vault_snmp_pdu_password }}" - # Prometheus targets.json - prometheus_targets: - - targets: | - {{ groups['aurore_pve'] + groups['aurore_vm'] | list | sort }} - prometheus_postgres_targets: - - targets: | - {{ groups['bdd'] + groups['radius'] | list | sort }} + prometheus_servers_targets: | + {{ groups['aurore_pve'] + groups['aurore_vm'] | list | sort }} + prometheus_postgresql_targets: | + {{ groups['bdd'] + groups['radius'] | list | sort }} prometheus_switch_snmp_targets: - - targets: - - yggdrasil.switch.auro.re - - sw-pn-serveurs.switch.auro.re - - sw-ec-serveurs.switch.auro.re - - sw-gk-serveurs.switch.auro.re - - sw-fl-serveurs.switch.auro.re - - sw-ff-uplink.switch.auro.re - - sw-fl-core.switch.auro.re - - sw-fd-vcore.switch.auro.re - - sw-fl-vcore.switch.auro.re - - sw-ff-vcore.switch.auro.re - - sw-pn-core.switch.auro.re - - sw-ec-core.switch.auro.re - - sw-gk-core.switch.auro.re - - sw-r3-core.switch.auro.re - prometheus_ipmi_targets: - - targets: | - {{ groups['aurore_pve'] | list | sort }} + - yggdrasil.switch.auro.re + - sw-pn-serveurs.switch.auro.re + - sw-ec-serveurs.switch.auro.re + - sw-gk-serveurs.switch.auro.re + - sw-fl-serveurs.switch.auro.re + - sw-ff-uplink.switch.auro.re + - sw-fl-core.switch.auro.re + - sw-fd-vcore.switch.auro.re + - sw-fl-vcore.switch.auro.re + - sw-ff-vcore.switch.auro.re + - sw-pn-core.switch.auro.re + - sw-ec-core.switch.auro.re + - sw-gk-core.switch.auro.re + - sw-r3-core.switch.auro.re + prometheus_ipmi_targets: | + {{ groups['aurore_pve'] | list | sort }} + update_motd: prometheus: >- Prometheus (en configuration aurore) est déployé (/etc/prometheus). @@ -185,15 +169,13 @@ snmp_pdu_user: "{{ vault_snmp_pdu_user }}" snmp_pdu_password: "{{ vault_snmp_pdu_password }}" - # Prometheus targets.json - prometheus_targets: - - targets: | - {{ groups['ovh_pve'] + groups['ovh_vm'] | list | sort }} - prometheus_postgres_targets: - - targets: - - bdd-ovh.adm.auro.re + prometheus_servers_targets: | + {{ groups['ovh_pve'] + groups['ovh_vm'] | list | sort }} + prometheus_postgresql_targets: + - bdd-ovh.adm.auro.re prometheus_docker_targets: - docker-ovh.adm.auro.re + update_motd: prometheus: >- Prometheus (en configuration ovh) est déployé (/etc/prometheus). @@ -208,8 +190,7 @@ snmp_pdu_user: "{{ vault_snmp_pdu_user }}" snmp_pdu_password: "{{ vault_snmp_pdu_password }}" - # Prometheus targets.json - prometheus_targets: + prometheus_servers_targets: - prometheus-edc.adm.auro.re - prometheus-gs.adm.auro.re - prometheus-fleming.adm.auro.re @@ -217,6 +198,7 @@ - prometheus-rives.adm.auro.re - prometheus-aurore.adm.auro.re - prometheus-ovh.adm.auro.re + update_motd: prometheus_federate: >- Prometheus (en configuration fédération) est déployé (/etc/prometheus). diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml index 5d4e7ca..98d0c52 100644 --- a/roles/prometheus/tasks/main.yml +++ b/roles/prometheus/tasks/main.yml @@ -63,62 +63,19 @@ - snmp.yml notify: Restart prometheus-snmp-exporter -# We don't need to restart Prometheus when updating nodes -- name: Configure Prometheus nodes - copy: - content: "{{ prometheus_targets | to_nice_json }}\n" - dest: /etc/prometheus/targets.json - mode: 0644 - -# We don't need to restart Prometheus when updating nodes -- name: Configure Prometheus Ubiquity Unifi SNMP devices - copy: - content: "{{ prometheus_unifi_snmp_targets | to_nice_json }}\n" - dest: /etc/prometheus/targets_unifi_snmp.json - mode: 0644 - when: prometheus_unifi_snmp_targets is defined - -- name: Configure Prometheus Switchs - copy: - content: "{{ prometheus_switch_snmp_targets | to_nice_json }}\n" - dest: /etc/prometheus/targets_switch_snmp.json - mode: 0644 - when: prometheus_switch_snmp_targets is defined - -- name: Configure Prometheus UPS SNMP devices - copy: - content: "{{ [{'targets': prometheus_ups_snmp_targets }] | to_nice_json }}\n" - dest: /etc/prometheus/targets_ups_snmp.json - mode: 0644 - when: prometheus_ups_snmp_targets is defined - -- name: Configure Prometheus docker monitoring - copy: - content: "{{ [{'targets': prometheus_docker_targets }] | to_nice_json }}\n" - dest: /etc/prometheus/targets_docker.json - mode: 0644 - when: prometheus_docker_targets is defined - -- name: Configure Prometheus postgres monitoring - copy: - content: "{{ prometheus_postgres_targets | to_nice_json }}\n" - dest: /etc/prometheus/targets_postgres.json - mode: 0644 - when: prometheus_postgres_targets is defined - -- name: Configure Prometheus apc_pdu monitoring - copy: - content: "{{ [{'targets': prometheus_pdu_snmp_targets }] | to_nice_json }}\n" - dest: /etc/prometheus/targets_apc_pdu_snmp.json - mode: 0644 - when: prometheus_pdu_snmp_targets is defined - -- name: Configure Prometheus ipmi targets monitoring - copy: - content: "{{ prometheus_ipmi_targets | to_nice_json }}\n" - dest: /etc/prometheus/targets_ipmi.json - mode: 0644 - when: prometheus_ipmi_targets is defined +- name: Remove old targets + file: + path: "{{ item }}" + state: absent + loop: + - /etc/prometheus/targets.json + - /etc/prometheus/targets_unifi_snmp.json + - /etc/prometheus/targets_switch_snmp.json + - /etc/prometheus/targets_ups_snmp.json + - /etc/prometheus/targets_docker.json + - /etc/prometheus/targets_postgres.json + - /etc/prometheus/targets_apc_pdu_snmp.json + - /etc/prometheus/targets_ipmi.json - name: Activate prometheus service systemd: diff --git a/roles/prometheus/templates/prometheus.yml.j2 b/roles/prometheus/templates/prometheus.yml.j2 index 05564af..15f12e9 100644 --- a/roles/prometheus/templates/prometheus.yml.j2 +++ b/roles/prometheus/templates/prometheus.yml.j2 @@ -25,17 +25,15 @@ rule_files: # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape_configs: - # The .json in file_sd_configs is dynamically reloaded - - job_name: prometheus static_configs: - targets: - localhost:9090 +{% if prometheus_servers_targets is defined %} - job_name: servers - file_sd_configs: - - files: - - '/etc/prometheus/targets.json' + static_configs: + - targets: {{ prometheus_servers_targets | to_json }} relabel_configs: # Do not put :9100 in instance name, rather here - source_labels: [__address__] @@ -45,11 +43,12 @@ scrape_configs: - source_labels: [__param_target] target_label: __address__ replacement: '$1:9100' +{% endif %} +{% if prometheus_unifi_snmp_targets is defined %} - job_name: unifi_snmp - file_sd_configs: - - files: - - '/etc/prometheus/targets_unifi_snmp.json' + static_configs: + - targets: {{ prometheus_unifi_snmp_targets | to_json }} metrics_path: /snmp params: module: [ubiquiti_unifi] @@ -60,16 +59,12 @@ scrape_configs: target_label: instance - target_label: __address__ replacement: 127.0.0.1:9116 +{% endif %} - - job_name: django - scheme: https - static_configs: - - targets: [] - +{% if prometheus_ups_snmp_targets is defined %} - job_name: ups_snmp - file_sd_configs: - - files: - - '/etc/prometheus/targets_ups_snmp.json' + static_configs: + - targets: {{ prometheus_ups_snmp_targets | to_json }} metrics_path: /snmp params: module: [eatonups] @@ -80,11 +75,12 @@ scrape_configs: target_label: instance - target_label: __address__ replacement: 127.0.0.1:9116 +{% endif %} +{% if prometheus_switch_snmp_targets is defined %} - job_name: switch_snmp - file_sd_configs: - - files: - - "/etc/prometheus/targets_switch_snmp.json" + static_configs: + - targets: {{ prometheus_switch_snmp_targets | to_json }} metrics_path: /snmp params: module: [procurve_switch] @@ -95,11 +91,12 @@ scrape_configs: target_label: instance - target_label: __address__ replacement: 127.0.0.1:9116 +{% endif %} +{% if prometheus_docker_targets is defined %} - job_name: docker - file_sd_configs: - - files: - - '/etc/prometheus/targets_docker.json' + static_configs: + - targets: {{ prometheus_docker_targets | to_json }} relabel_configs: # Do not put :8087 in instance name, rather here - source_labels: [__address__] @@ -109,11 +106,12 @@ scrape_configs: - source_labels: [__param_target] target_label: __address__ replacement: '$1:8087' +{% endif %} +{% if prometheus_postgresql_targets is defined %} - job_name: postgresql - file_sd_configs: - - files: - - '/etc/prometheus/targets_postgres.json' + static_configs: + - targets: {{ prometheus_postgresql_targets | to_json }} relabel_configs: # Do not put :9187 in instance name, rather here - source_labels: [__address__] @@ -123,11 +121,12 @@ scrape_configs: - source_labels: [__param_target] target_label: __address__ replacement: '$1:9187' +{% endif %} +{% if prometheus_apc_pdu_snmp_targets is defined %} - job_name: apc_pdu_snmp - file_sd_configs: - - files: - - '/etc/prometheus/targets_apc_pdu_snmp.json' + static_configs: + - targets: {{ prometheus_apc_pdu_snmp_targets | to_json }} metrics_path: /snmp params: module: @@ -139,11 +138,12 @@ scrape_configs: target_label: instance - target_label: __address__ replacement: 127.0.0.1:9116 +{% endif %} +{% if prometheus_ipmi_targets is defined %} - job_name: ipmi - file_sd_configs: - - files: - - '/etc/prometheus/targets_ipmi.json' + static_configs: + - targets: {{ prometheus_ipmi_targets | to_json }} metrics_path: /metrics params: module: [default] @@ -156,5 +156,6 @@ scrape_configs: - source_labels: [__param_target] target_label: __address__ replacement: '$1:9290' +{% endif %} ... -- 2.43.4 From 50d928231672246f295e3e70c5d403491dffdc5c Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Fri, 31 Dec 2021 15:21:46 +0100 Subject: [PATCH 6/8] prometheus: show failing job when machine is down --- roles/prometheus/templates/server.rules.yml.j2 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/prometheus/templates/server.rules.yml.j2 b/roles/prometheus/templates/server.rules.yml.j2 index 457e5e8..c4138fe 100644 --- a/roles/prometheus/templates/server.rules.yml.j2 +++ b/roles/prometheus/templates/server.rules.yml.j2 @@ -15,6 +15,9 @@ groups: for: 3m labels: severity: critical + annotations: + summary: >- + Le collecteur {{ raw('$labels.job') }} ne marche plus - alert: AccessPointDown expr: up{instance=~".*.borne.auro.re$"} == 0 -- 2.43.4 From 67064484d5a75d085c485c923e3c75b81471a13c Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Fri, 31 Dec 2021 17:27:36 +0100 Subject: [PATCH 7/8] prometheus: add iLO SNMP auth information --- group_vars/all/vault.yml | 463 ++++++++++++++++++++------------------- playbooks/prometheus.yml | 3 + 2 files changed, 237 insertions(+), 229 deletions(-) diff --git a/group_vars/all/vault.yml b/group_vars/all/vault.yml index cddfdc8..1b76c9c 100644 --- a/group_vars/all/vault.yml +++ b/group_vars/all/vault.yml @@ -1,230 +1,235 @@ $ANSIBLE_VAULT;1.1;AES256 -32393435383435383935643532623462383339343036366539303836376132663135346236396537 -6234643336306331396335613163653562656264626531300a393439666330656164396536386530 -37373639366337363036646231333737623033396666643462383761376336316361366231386465 -3664366432396362300a613538663566366333313065643630386439393761303865386633623263 -39316362653330383332633737663864303665336136623834613665643365323764346439363462 -36646335326562666165336164366135366131396561646163643166613064623664626162396363 -37316537613731306336366439353834383039626539633663346637623264366561353830393463 -34383736376339623335646139643734653232363261313065326435646236623861363134616564 -38646137306133323761633136323136653065353135643166653036363739306139633238336133 -38646532343439313539353764303435636539633662643634353061326430323066623131353636 -38333338653461653434306166333936653766656132353938303039633266386364353337653130 -66353431366636323637653731643066396162636266383437633364613532653066636463333838 -62663765313064356566666437313933303533333530313536653864623065393232396131323438 -31636466326439646634366134346236396330653235633061336630393466353261666565636663 -38636635363239366438303539663838373835316562663730643863363131363362376631316139 -65303639653564356466346566313462643531383036613532393266343437326635666363316436 -61383735343139396165343336346234653334323238306131363031353034663230323733643031 -64343331613536663536653636323264663938653136653962663465353462633135653231316462 -64393933373134363338623630313763653531356133383133343935633964386532306532636565 -66336333323939383936383637656330353339366536336665333335323331316332346531356463 -35613138663964303234613936313436656330303930316537326633393764663736643238623636 -32336166396466396662323636653266623662626263616662613065303661623738633335646237 -65373963666265353034396438383164373533333137653966386536643462336662346234613234 -66363734386264666637396463626337643464343634346531326562623761383530313333653533 -39333731623662633231366134343437346332366331343638313837353433666238393037613338 -31386131316661636232633138613364326430316462653266306331653764323264373236643939 -38386465616631346639346336613538636431653466353862383932656633613639393132363862 -35643965346237656438653730613335373563313465653262663161636137386133636531636233 -38343462343338623339653065353466326130363439356537633138386135326533633732363933 -66633636393561323939653862323664653962383036396165366331393431393364303864313861 -61333433366534313938353063653332646138643534333165323538363131373831663461323865 -32666133326233623531373365386566323136326537373563303835373439376138626637383862 -34383565646663343065653064323234356337663838316563313736653635616364653835316332 -37353539313765663766396630333338333737353136626534376438636261653635653061366431 -33343563623936653366376534363236313538623534353338623231666264393433356465343565 -38353664323834366164363437353835633864616237376239623563313637663266353433663766 -64623830393661303436376463393731363361616362666263653334623830333139326339333238 -62616661656166326464313566306162326131343431336537313836653336666633663837316230 -36396335663033336161373763393964393065363834353764343138656264653336616631333865 -30303364616563323237646463306566376332316261383635373033623165653639626336336535 -63333931653538353836613930376633333362643230653731646634343431346262303933316330 -31613836326662366332616433643933306633343765616635306637613530663938613362353532 -39383762386234376631666565313334336231616130663333636464613231336266303363663238 -34316562353361323934643132653637643161386637643039616236383161626561373036303136 -39656463356363633361653465396333326431386232653239326638323964393962396137613363 -39643261353337613438316438386330333965383730343033343735396561326666623334316533 -61613530656266376635636562626236336165323035353132633535666566363230646135343164 -38643963373932346564383531633462376265313337636161643461353165616331313237343139 -34373837306264366632636363383562396135633366343431323164316164396435346164333261 -63333837366232653738643061363236653264373164366635643731343966623832643134653738 -35333836333461386530353530353931373937346237313261396263326339303561313230343963 -37303466633336636439376637336430646562663539646562646465626531303534376564303135 -66393935376136663237343333366166646464376138656163653764646666316264373835353737 -61623736376665363266393238373932346638633462653838626265303166366434326336633039 -66326435626637656462626335643437633866323465633130653761663435326263366139613961 -66306331343439346262363030396363626133376530356334653162343631326338303635343161 -32386161633939333833613836616439396365303837656434306239363230363062623163353738 -32386262633064356332663062643664333031653438336632663662343634663230346464353231 -30663962323836633932323934333137346134333463626364643463323233363235346332343430 -63623962663830643036353830383738303133323565303266303261373639333635353539636435 -66386432663338356530303039373230643733613136386666363532326232323136396339653632 -61663765393139646565666630396535623731653764663131656563396535326433613162363631 -35333266663836303635666437666562663139623462616436393261383464326138356336316364 -32616565343365323365623763303136613961346532363161396638393432616530396266353338 -32373131653963303563633961633463396231656539636564343331646639666233633831383762 -39306263353935373337613638363132353533383363613438366133643665353030646565313735 -63643431323930646237383033663361336339613837346439323033653466633064643331353463 -65353266636433646631376236373737613863383331643361353731383739613537393264383336 -66663262666165353435613062306264663162336635623064333935356433343531326232383363 -61626437356261653965626162616438626664393535386365346266383061356632656135656333 -65373564643564376433623238643336323631623161336134383134656639616465666633323635 -64336563333031386536656162613934363233333566303832623634363530363165366137646464 -39303832653737666430363337653964373565313534313762663433323333643665623033313032 -36633331626333343264306333303730613039656135323161653262653862343561303638366138 -37653030646435653664646333663333313239336666346230333832323637333064393730666439 -37616465333262666166616361613930653563613836393661313562626164633464353237386663 -61373661393066646537376664353664316361336537373338396366383562663237373631356561 -32653266353064643837626631333662326133663165663366653433653635656235366530613834 -64626239373639313965323663373864366535653931313937396365666433353963623264623236 -39356539363139333866373537323033306464613462306330303431346165633733626532656634 -39636230366333636130626438326334363430396130343662393839373731383030393039396165 -32303736653730393766326438333764616562396631306534653664633936663137643435353835 -32623563613564643634323864633161613663643335613265326534613861353361333464356332 -37646234353161363733613835306262323061393166623963323737353431623862333039366230 -62653763366265333731653433346263333037376365396661336465333062666139396364393764 -32313832376437623630366132336136626638613735363635306164313239646435303537336530 -37646163323534633738393462303932613165383034386239363533643432616166313430306630 -66666161373832363265333965363338313234646266333435666639313265636630623936363533 -63316662316137316336383263326364643631373738356530386333313435363531303332336332 -39376565343530636530373764323164623963386130306332386166303464333861633732356137 -63643435346138663935373930343737323836656535383861313262326563636366336538386139 -64323832306333623032333538356264333533353662333530313361653832626564363134613931 -32323761653537336564343931356532323662643334646565366436333566373130613336313831 -31353164393036666330643839633337616562323166646661636664346534633435616466316330 -63323938393539623233363464623033626263666262643761346539303964336236666364373433 -34303534386236623736336631613665333166633537376164396337633561656366316437373035 -62613738323534343063363138643135633832346437626134373934663431616335373132626163 -65643539633032626533346433353462333639653739626136393733353164376230346438666534 -62363230383732373831353133396530353464613237306562646662633831643735663965613863 -30653662656661626338623336313164356636396462666631333530653530366435376563323534 -37323162633364623537323565313838353132356631373238633835333238326236373639393731 -36653666303232383932376538666536363833643432663862393139353261343064306663613263 -31393065313131333735323931383062616261353937613034323939356361616338643230653733 -65346439343832396465653364636561386537343361396636396331393232306136393632656336 -65383239653564373631636463623834393933616234656439623165626531666332356531376366 -62396164633061376431353133613238383439633561366434316565646666336662613035366635 -39633832666536636265356534353435333637323135666163323535393537663739613662613135 -32656634653039613436303637303661303537633262316366316462343739656661303261336336 -65666237323436616335303130373666386665363335316661323464636336623162643464333032 -32323835346363326234663337356431353532653963623235316639623332656366306663356435 -37666133326431613664616331323439646237376330373432653761323064363035646632393638 -34333936363830353337316137636131633163643437366438343165396364336436613763326639 -63376235643738656632663738323431313332316361356132646461363630663739373861373966 -66653131363438646665623265623366623138313661326235376463646661326136373563306634 -38646532653463393736333135383530626265653630303137616339343366643539376132313265 -32336239396532633538613138636636363864353837626165383030366563636366306465653931 -38663866343763653763616264346330616562663463383334313231333332323464383763666130 -61656530623339613634376437636535613530313839303937383066353739303632393536386335 -37343161633263653435316663353531613835626663343430326263313661643833643634393836 -32393239323731366230663661343439306437666366393636653932626638333565356435336434 -34363064663136326330373466636363386439376166646537313637343936356539386337353135 -34373161356335636631653864303432643032343337636166636330336339613962336163643336 -31323763636462343735653661663135363636333233636664306437343438633233383634376133 -30623133333865353936323832326436323061303462353337383132316438333638393035316136 -66346162393634623333653039653236313539646237363639646462303837613436336265653935 -31363238323436336263653638316666663835636264646565653464393066623439643431643733 -38383465386261633137383739393533383164626135313365623235373133366461626539306139 -35383433393364613037336437666638653031373834363130623438373563636266643364646130 -66643535356234383861303865393238343737353666393865306566393465363366386337666664 -64376232313035663435343666366561363637643466363033316537626133653739613131626339 -39633266356439666265343063336431343639666563333432396135653733343966616362383062 -61393732373337383633306239656461323164623261343636373031626537613938333739373939 -62616665623466366230626165613737323534383231366430396361376236366530323764636130 -36396334353064393464333334333863346535373231386439623832393231663738303931333033 -61653332613637333266353531346562643532643038366161376530643961653063383436623864 -30353038383764373064663763636334313461633533383265666237333364633264363434353734 -62336235393263333363396336356636366164666661303434393739346230386365613966313536 -37326635633836386565653137366461386264353039326461356531313335623266326638613865 -34666137323537326262393131316636343937613838356638333338303631383635653337613664 -39616161613537653562313636646338373539376265663664353764616530633162656165646530 -38376134343761326637653965326435616265336630313430663665316236333462356132636164 -33623561376333326231616164383836376230643630663031393535626663366565373432613161 -33333736306361616534646637366536663166373639303131323133663037393935656137303261 -32653032653666626338303361613766333564396262343135376261363164326435366139613363 -66653039353033356136623234656333346263623032613634396338636333326234666264636137 -62366433626664353730383836336230306164306434313636363066626538316133393230363636 -36646137376534636633303239336438643266306666366162653965323531343662633563643462 -65326538613666336262393836316563363666343537353936356638623331396236646531396635 -61646366363339383834383331326664666666363364383938313838613565323433316466646439 -38343534383936633031326435653261616135356361383566646435393637343236343435313838 -36346339346364646364646262613531316333616539363664623838393132353064613831663032 -39623662313430643165623264363562323962346339626634383436663436363766376635373935 -35663734353037643931333432663633376164316435346131663634653030313831306439646163 -31393632386565646135303563666264356661323862363034643933666139663832643534356336 -39323565653835343832653439383333323463663262663737303331666535326334306165333035 -64363636336335333265353465356439666133383537653338616165366237616135363764336138 -61323830623130306663643534326562363264366362396237326265393735333138653837643936 -62383831313832326166616361323165363163336133653666316633656430633565306164636130 -66613839393336626361616231386132343932656539353761383230316266656165373036643565 -35356366653961613433313366376663303837663734626332333936663265383061366532313863 -33623037613839636261653333633832343739303636316131323064323331643932386363306535 -35343564316430616337366133363062343663666138643562363637663430323835643333643434 -34653633633262316435643531316632323432346237303264623230346665633732336562633761 -32393330613465663532356664333735333663656665666236323333363132613434366234636536 -31303934373530383236323561303635393439653933616531636534336663613133623232303961 -32333639353239663865646430613736613435333236346565376563663533363637356531656561 -33656664616163383936383230363836356563376236663130636539396139643937343237663537 -35323736363331346666333030393830613766316635343865353834323265303736633039646431 -36363634383930383333613361316235616139316133623235366330666536663165373030653562 -32666236306336336365663637336261663437376262616534353862363365363233383864643934 -37663765633935326539626666636165663339366538303534346232653733323063646530386263 -32636533363362303234316430323062633134386636636538633533666162663339366633303466 -38376131653862386431326462633037633364356435636637646436386132643461643562366561 -34303663663066633731393336633238336330343466326235613530643264333266363262366539 -36626234333935633638323361633638363764633636623561386437356635653665666264663839 -34396130653133363539323566343262656564386365613239353434373431613438346630633466 -36336235623333336263353334393636396139623965663730373833333630643536656531366634 -64653364656537626635646639346661326530386533653263306536623830323763663661313832 -38393964313161663363656339356562366237333763653434623630333033656130356331666133 -65313631633262363663613332353863366539636630356536346233393033373535626333386162 -34326266323336366461316665623165386664363838663038653138303231373531366463306262 -37333037613462383430396565646136396132656462646634323434623937383631373032373931 -38306165663462396634623430383237303039653732303464616132616437333637633231316237 -34343465363634656162613836373737626563636662333937623839323737666439616638363866 -33626230336432636639313635646132623837313066353535383637656538633732336531653530 -36616435623961636364656631623665653236613934306631303939666437393363663765653464 -35313036366662646138663830626139336666396330313735646166323634633735383865396561 -30646566366561396165376538366633613163623232323264363762653537623431643537653066 -39346236306365666232663737303038633937333235633538306130626263356431333837343763 -64356131393861383964373863333033393731353564623435323963303662636166306131373164 -33326337383536326464336165343963613964643735613965316466666436653435343661663638 -66363537383561643264663264313437386435363934663765353335623837643665313732353939 -65613564393133353838386539393232646238373834613139326434313732613932613533396635 -37333632663863643263323730626535373334303031376434663330653461323336313061343965 -33653962303437316433616631376334383464373038306336346266643765363336613961366165 -32383963393439383034323138636662623830376538373733366464663431616230343536646436 -35666539343238633033346364323930666339326566346532363665363238383839656339326161 -30306234363637373837363063376262373365356131356563313631663633643037393763333730 -30353965633336356165616531303637646337323038663238616432636339643866353661393833 -35656664663361613536646431653731306636363736333032323632636431346232336238623336 -30366531643536303465656235373838373465643765396462643962343235303731356635326330 -65326133333163393231313236396534393235323135363565663862396465663536363366653438 -62656462336136663232653731663566393761636334306539333439393030366364343433396363 -32396563363331396334643965663337396565373931363163323638613338656337303238383261 -35663066623162656233643265333835623735383338346239323837316635626233653136623932 -61343732316133653064626562353833303734333037653635383634623830383864613536306539 -39356338383439366530353135323139616162636633376461306134343633663239336536373061 -66376462376338653936336335643762616265376337663235383165356539303466306438353765 -63303036313133343265376532653262333666633233316663623336666362646335623562323930 -65626336633161333739353562626233623733636533333636383638666536383436333932636439 -63386630336164646531333330656331333830366431383938636366353264303035343736666637 -35613733643634333730643434626439616232393834646235336462656635303561333938643138 -65636436346532343337386666666631313230623261383766666138306134653362656237643836 -36643265386438633238323435353237653935393837363534333135663533373365336230653337 -35323634376635326464303631356634353232653566663430653030383562313039326137343466 -64363036643166333431656532616537336362623939313135343764353331383764633333613366 -37356438633333666531363138346436666232623237356663613631626338616461623161373264 -37343461393135656339613033663031636466363863386534383431316433633732323434616264 -39343362343264343636336230356330353331373834343262333537346239643535393839663131 -65316465666235356664386563666234363766373632303230393835383337303731373765323230 -63366633613234313462393063316638376264616361313265663638353463333531303064623839 -33316464303663346439336431633264653637326130613064333861626465303164303639653232 -62663263623937346638643435346562623130303938343430383738373763663962646238373136 -64323039343562343133316265323030613131303634623531663636643865626463633933643930 -36623238646633646431656534333864623966393737373464333236336666356364353430623764 -62383039336562643762316464313034373161663462643233336136363132303361663734653530 -35646164373863306565376139643932616465663964303032626461653637303939333930646565 -32633333633365393937393439323935626339313263663862323032346430653439623339646236 -36383363353633653766316562353136643235616132316366663139633466393337 +63383865663866376238613638306139363461386331363764306166386664653238353761383565 +6336653265613463646139666236646362303463373731610a333537313431363366616665643462 +66303839346238306234643139313835643339633963626338316163336365306462353830343536 +3231373236633066330a303236653238356330636332633139623134663039303935666566336531 +36303937303231663232653534666639656232303231313836303834306436323463653635303830 +38393533363762663863326434633266613265663930363432623234376235326637346338333761 +35363165643464623131313031383938353664373133616365613237383937376332353239636233 +36393063333164346262356364626332303531373935613633326366383165336637323933656263 +63376363623132393837363837656538323135316636333235656561383234393763303862626361 +63613130326336626630393338373630653437333039376633663963373666383137303038376364 +39313466353565316633356362623264356231613933656336323933373635636664383164323964 +31633130353330376532313131373933393366313637356236623634653630393130363561656562 +33333732343131656133353065313864653064633261643262633538643162383863323336316330 +39333035643738313939353262353632303636386533623164623538323466653237373531376562 +61363732366463393364383761663137343836383636366132663063383833396231326366346465 +35323766663666383832663935633062633864646534363763643534363831336361306633636632 +66313561613330363064393430643436363738623436353734353733613462326561326462363031 +37666665383539626166373865323439356533323333343035636665323738633038386337343036 +38653732663062333165616632316361363666393036643564356131383261646630393131613964 +37376532636237373666396162666237663861356263633331326461386265316666383037613235 +64303237363436383138303431613236633562303062393737623131343133383666373033333663 +37646137303036303361386663653738666334616534623232346666653165636232326530633635 +31333738366635623862353834366266643732386535356361323839623630663139373963656636 +37393965356638656637366261303536306466373938313462383639366233386230393762646238 +36633066623737633463643963383131393765303838373439393432633833366263643462333533 +30626334663432636264326338643063313431306631376439303562363733313366396331636262 +31313836613737366330393137656332333437633639383066363534363363386364323936623931 +39666338393236346634613239383964353262633239633232326433343436623038323131303436 +62373536633233383937343266613164333561623031383432323662396336646534383430393730 +30636662623734616139353433336336323361393061363339333165616630336333663561353632 +62626533653734323662653434353562346162613837373465646239376437663337353030303866 +61323836643463343236633438366236613630363038323230353263373563643535313765303738 +62373230643762386165363833336238313234343530333165313762383663343236383063303762 +33653761613837396434353230356166326339646136353830343365623863336230373564643862 +38653063363832323266346466356132396265323463626435363839383061363964323736393635 +37633136663166653238313061386464353239346630323062633531393061373136326238323632 +30323366373433623861306138306265393934613039313936613639626636343434653932373363 +37343931623862386434623335666139666462353165643237396432376532373034333434346132 +37643439656332643961393661656365346339626163343638616438643461333535623231333764 +37346663626537643366633461373764313331383264373237653834313030616533353736326334 +36316139613061633331343736643961303164376366383362623538616432373062303762323138 +36303566393135383339356433653164663664393533333565343766363362623838333566373735 +64643235323633343938636238373930316562336363313733373530303834623564376239303362 +61313566613763613433333132333965363335346463383735393061376139386231386338313735 +63643566336531623566626239613437346162663334636630333139393063636133333064656437 +66663938656532663031663636643937633638386332303733316161663464613933366231613831 +37333565336535326464393561386135386638613565663733323266303736333561316663613432 +66373661623964343937343162646530346439343665396139616135663536653837363838343235 +66636337376138666463336430363234323334313663663735383363623934346665313236303731 +32316532626666633462393233643733303737343265366637346261643366303232316664323561 +31363038306233373339353131343038643130313330373161373665636163333130613435303236 +61383932313734363638303761366263313036663939663735313931363139376231366639653133 +36306264623533393334303138656238656363363033353531663262336432613839363763633238 +63306238366332363137653066353231323533653231626561333766373636393164623362346139 +64653862363530373766333432383630313935313966353463346333623365643133376635316662 +61356261303633656432333535656266663038393034313439363464633934316238343332343361 +64323539396262623338373435656363363732643337623762623762326261303132643336323537 +65663664663035613738346639393739396433623763643532393461663833323634376634633032 +37313935633737363061653831646632326635633362326533316530363833376436663030663239 +37356539663038386334353834663839613934653638376538623330366634363765656266643833 +31303530363434363765313339363639626466323837366262373935343537363565616134353465 +38316432653166366431363064656437313830393936663431313934643133373539366531373865 +34353334396139666130633562663031336232653335326437356262663231373536613937343334 +37646339663033616361303563356666383431303339643930383734303863333032396637663162 +64386338323633326262316337353736623431346232353732613764323463333366376161636437 +35343432616362643665356463616636353031636135666664356139383138636135356639353839 +36356366393932303433373534306239653531346264386663333434616464316362643534653734 +63303331663131633838646465313935636162343431663539643461326135653931633332643830 +35346435646561616436356537643065396230623634316431306461353230356639396134303935 +37356236373366396132313236366366353164643432643539333734616230633637633536623630 +35303634386139333835326236383162643639626435386130663937323033663837366363336461 +64643762393265626536663566643465643762393438343638363863346134633439306231306132 +38333463646639373264653133653436303738336639373261396261323332656639323763386463 +61313165336230306437353661306166303837336330336162633662373834396261373230316164 +39346664643230616434653339333061323661616238373038663266643664383135326561306339 +35373964343334323633333537386264663066633362373934386163626431393138663265343538 +61303334646363316332636639626662386339363737393263646161333038363739373536383264 +35623461313435353832396239626636396461336133323366306233633861366538303062663238 +31393663346633386665303731653162373136653235626435306136333562353733303462623665 +63653762353736313763353631313265393761366638613532623566336230626332616665336137 +39633461646266376530656666366636623763643863646461323131333361376631383461326137 +38666433323665626662333434623136346337633137303331333235336462636237643165653236 +62316661356334653739633430303766646537316634386365623635383938303166666234303037 +62323432633937616532336165366564393532346361323936623762386466393638323935323039 +34646661653661626433373332363530653532343836333135396332386435373163373463626532 +38343731633564656337626136376365613135326265633066356262323334386265386436616463 +64303961663533666531303930326462353638356364343330393031656234333833613530633866 +63303939396464643533373966353464616364326166363738646539343137363861616337363631 +37306161316461613238333531346432366631666335623163323764383238643665356561366435 +36323662326531313862633730663162313932623033303637653461366639636538306433633266 +36323234313937313838643063323165333765663962303736333939333763326135623230613332 +65343934633532623730336230616565313733363836373233313534313165373639656435636433 +66356663633931366135303962666531383639376335396534386438663536623066363862646365 +30653735383131336637383261316238393838353335306366343761386361623631396465656635 +36646661373933663530653363613634373966613131353437346533613062356434353033333431 +36393337353431353165613538646631393366366335316533626265313438643338323434393866 +64373263316564393966343865383764343564356666346637303165326538643532643737343130 +64393137636261363161396232653463646263346663323162386466653066633332646137343035 +36326336626462363931626464653035343933336634323762653130623266666533656635633533 +35643133316135303835356539393532326564653761326230306137326132333932646666373361 +38353531393835653536356663373433333766323534653139666365636336386138366231643437 +65343635616465383666303063656235613234323132653264656463613065346139313661663234 +61373933656362306563396131363739666536353564393230343735626465623265323464333065 +36333863613436653531353334316162396632363038323734313961636436343830343761636430 +63353661653737346563646439613039353465303862383264656535646335393139623931616533 +39636235366636313136366166356265326136393439313334633939343561323465366139393539 +33616363646237353632366231336431393236336330306562343761646339396430373937633831 +31323565343932333234613566313933636130336335343331383166616463663138383231393463 +62663231656461626264393762376234643763646263313334303065323766353863366531633138 +65373236316461303865613064626231636261626237633936386238353633633139646162323265 +62613162646239386366316161323538323437346433336661383938383332616562616234653331 +66306634613162633234363838313264663337653737656337613030343564353939366536376339 +62666166343034323534646463643933663333653032323130366435356238353966363961616664 +65336237376566393330643432363466653538623330366533616632396334356535336633306266 +33373139343333353838633436356237613632323233353861383438386466326139306337363632 +31613738333766663139353836356531376332656365633665346632666533643162363639343830 +36336137313863613835393166623235366563373431386562363064393938313033323633633263 +61373937653931623962633266633233343563623064386636353231363337636437396438356333 +35343137333332646462663462396437323433373339393439633363376535393230656561353461 +65373565396530333164396666333561633835376232643262653630643666653534316565393562 +30633933333635346337376365386332613032393764656661663562316561373536306237626138 +36316561336235343434643962623138343032663864323862326164326164613830633439313065 +35303738633731613234653066353035363239383936303662633563326563386334353766386137 +34643663373032336135386561663963343161613938343762363162313932363538616361613330 +63653638626636646362393938333965616162396430346463376332363066373831643633383139 +39613936303033353536326133396331303435313432326366316337653935396662393463663739 +30326565616666363534306238613138303031383562356633316434363666626632616233653533 +31333665313930366463636630373363333565613835353935333936303961333764396361626530 +64386534626166356130333161643339383064633965323463313861303364633937646264373565 +61326330343833333761656537643565663536616133363465643131396338653764653165336539 +63396536383330336531656434303862333639363031633436366665646565613934663838363832 +63663761303837306234623632613834613464326663313133626166613334336539333662383934 +30316134643661326463376434313137333133353934353363663433373066663366633066663139 +30303163313532623664393939663730373230663338343030336232333163336365393138343532 +31313732306430626537363866653065383561316262353434346137616362626638363136346639 +66623231393835623063343637613531626161346638326637663237383562663231306464306463 +35613763346135343839383234646134313939346139653031666463613032663036663662663361 +39636461663864623432386330623939323361653934303266626466333365336533353566633036 +30393836333061633939613865373166306263643461663336353335646632616232663135356362 +63346664666639353166316661336563383835616364366131356264353362323137623536356138 +64353135346333343234396433353234303365633535333731393264656434336232373934323731 +65653435663931363333623432316136386665646334346636373335613833353034376335393131 +62636634626666313431323064636262623061343539353431396262643036666132333338626637 +37393538343361613832306163373065663661393439386163326238656461383237313331383163 +62336634333139303165613964306663373931613364613263356634633134626632643564653937 +32303139623164313731303830656333383731623634313566656362666236326634616466313762 +61376238326561333562373430323364613332306265643262653332353362636563303835356434 +39653237363339643830373732663339616236646135353865333465623066336261666433666433 +30333435353436613935343266623863623262623737666233363464653364316634373563353138 +66616162663436393636376434306366376638366561323761666533373239353630623863646439 +30393838383432396636356330666636643638616262386661363766313434303230376135396132 +61363061656538373336383463616665626565343630613235303932316165343930633163303039 +32306663353337623335326265316463646439343063366338666237323130343665633434343130 +65323739313336656266646163356331643238336339303133353430393164316135616238333463 +37633736303039653132623961386339636530343130663333663639343764343233313362313366 +63656363346363633564313764383938373861336435646265613065616639333630333532303761 +37373466346235356166623432333333653236383531623036626363346263613439636131646664 +66353165613466616664653534313235633765323566313865383532303062623335353462393364 +64376466356362306565663535363162663339643662323837626135313161346363313862353366 +38666635373131653263643964326265626431663539653731376363323064616363643036386565 +61383263616664353535643862646366613561653731316239643935653462356363383162623463 +37623562616563653931663762376235333939356336633739323334336637633231323631643366 +61613537633135366164636666613263613731316539666365303035626166623133373865303939 +61353632623465386536616364303863386166623162303830646632613362663832353365643366 +61346161363732646135623235316365313161323531343435323865303733343736313030323530 +39646239626234656334626331393532656436346130643135656462353966393733363132666638 +61346261323264363262316231303932393535306134323361633934353938333330666339376332 +36623838623933643839303039326136376634333936303066306231626337353637336165373136 +65336233393538663634653962323633626461306430393434393536333262666132333936313039 +30363737323965616463353534393930643330643730316262313264616431633339646333373765 +61623237623231313863353261633830363562633838663534343764663038666231313435663936 +66643532306231363766323538653534356135393631363031326462336337376138316366613565 +37353464383662383663306130336234323534346661633235643065313130303236313530323831 +35633761343161396361653430313266353264373433616435393065366232313865306131373433 +37633666396135656233343330666332666432333464346566646161373966623266363230633137 +36663366306334313762333661306462386333656335653161396266393238313366613339313861 +30663566663633323733343531346430313266336663356437383038623936316238343263316362 +62363336626564333138356463316336336139303131353835623238343836356436306461616463 +34353539626535663735663130643962323630386138383130313932303534346236643437336664 +65656232653065323462356631363363313530363164366630303031383231343438346264666161 +39633466353632666564623138353565356633396532373562393631343834346566386435343232 +30386336333064393739626332633135346266373630363834636466346338386531666439366130 +35623737353664666366373366333438613939353761386138636461313433663236663338346431 +34663938663233376631333432663335663238303762626463366430656635333332343230383965 +32326435346537343964643165383438323861386138633037333738393536633336393333626663 +61303932616531386233666365653736323934646633626431626630633262376333356530386331 +62366666353935313762346333663739373134373339383131653132656635346233343162366238 +65313034396532623439616665613737386461626131653437303837636166636130303234633131 +36333238393031646238396339346362333261393634626436343239633465623831323031613131 +39613336306337346337633835326433653433633439333635376231333562313462646166313237 +64336536363130346161373133326334363762303366383862373836613631663861393364316631 +64346134373132313861653833386230363333343333666663653964336362356235396637346535 +36316235663136303663663439623939383536306562346236623830363162336164333532313961 +31633761326562633538316337313464373763663464663063613035373063623031663865326662 +37353031336663393762313539626339663638666263336637653862303665656632646333363332 +31656161313739366638343332356463363031623564376265333036633662666531313164383963 +64353532373230333637383937626433623531353637323666626234636637373765623233376138 +37383632643134626437323337643639386465393634643434386233343062393862363231613934 +33366132383061333832346136626336366235613431373435306561356438616364373138633539 +36323033303736633562363137373164663032346430623561353761316637353463613832393333 +62306132356465366135373563373038306335646338346263653137306233353662313834626635 +35636433363036626539303463653762326139396533306236636636336535353061343235303962 +35363431666335393730663433316435666562663462356532376232376665363337303262303839 +32656238363264626464383261313534356233393939323865663561316138666639386237646165 +32666261653465333130333635336532366666623739666663303565353234663833386632653538 +66643338306662363634306331633737393834383264393361633139663163316262316534653861 +35376631396361333239633930616133656130326166643366636338306462303839376264376634 +37323263643137326535383565633930623464386131613236306363336662383731636465373463 +39376165323031633739313135656565313163656564376634666464353766373361316464376164 +62323066363566303338363739653862613337386663366462653365376235303437306264656363 +32343435613232613865663732613963303765633536373330366633393933643764636564316135 +32313230396430363739363735623264376363383565393863323766353937333661326264313665 +32343063353335613236393231333761653835343530333734373631343838386465393131656663 +35373631356666663032633734333562613862383864303262653063356436663261633964343931 +62366661656536626137396432343038343935363130623266383061363664383531613064613432 +39623738376634646636663332346364623834303736613231313863636537643063346332623864 +34303539633434643137326537623663353630396137326666616231323239323231343635656138 +37626230636337363564303666616233383936323335383234626134346339396562336561356530 +64373635326563366132376539646331383239626131366230373461626532353065386131343631 +31343733343863343339616361623636643936653131363762343966323233323430616633626133 +35313539653939363033313736316331336562373162333035313837643832393633333136343363 +32303731326335393833633063643533303161623262366433623938393165366265633034353337 +35383864396164623963626333396335356431383662356261303137343565633863376233616664 +36373432333432373265613837633831306266323330616532396236643463333231326165343035 +35363965306133636539626436343437366462626632633931666236373864303465663239396330 +63613434306362303338343937396566356163653338343463393435336165336137336665383461 +35393332613038336264663233383233333731633432386133326361303436663963383833306564 +32646635646535313366386534313461383037373761333030396166346330353134363330373364 +33666632323036363739313362333333363030336330306236383438636336663939353063643363 +31616566313934353133363234653563303036383863356665393338363361343532313738616333 +32643661316362326265343161623639626165313534346162306435303464363564323265323065 +61663632393839383464626135356331666664373563363434323437323564383830393034363639 +32343037653736636333336338636537363666323633333735383736633735306362633131343234 +6262643530656461613363616637623037393230303130316338 diff --git a/playbooks/prometheus.yml b/playbooks/prometheus.yml index 553f960..0b658d6 100755 --- a/playbooks/prometheus.yml +++ b/playbooks/prometheus.yml @@ -7,6 +7,9 @@ snmp_switch_community: "{{ vault_snmp_switch_community }}" snmp_pdu_user: "{{ vault_snmp_pdu_user }}" snmp_pdu_password: "{{ vault_snmp_pdu_password }}" + snmp_ilo_user: aurore + snmp_ilo_auth: "{{ vault_snmp_ilo_auth }}" + snmp_ilo_priv: "{{ vault_snmp_ilo_priv }}" prometheus_servers_targets: | {{ groups['fleming_pve'] + groups['fleming_vm'] | list | sort }} -- 2.43.4 From 8c7031d05994fd11e7b11d7489867376dfc13623 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Fri, 31 Dec 2021 18:31:58 +0100 Subject: [PATCH 8/8] prometheus: add iLO SNMP target --- hosts | 3 + playbooks/prometheus.yml | 2 + roles/prometheus/templates/prometheus.yml.j2 | 17 ++ roles/prometheus/templates/snmp.yml.j2 | 248 +++++++++++++++++++ 4 files changed, 270 insertions(+) diff --git a/hosts b/hosts index 2f397b4..29bc3b3 100644 --- a/hosts +++ b/hosts @@ -92,6 +92,9 @@ unifi-fleming.adm.auro.re routeur-fleming.adm.auro.re routeur-fleming-backup.adm.auro.re +[fleming_ilo] +marki-ilo.adm.auro.re + [fleming_unifi] fa-0-1.borne.auro.re fa-1-1.borne.auro.re diff --git a/playbooks/prometheus.yml b/playbooks/prometheus.yml index 0b658d6..8a27497 100755 --- a/playbooks/prometheus.yml +++ b/playbooks/prometheus.yml @@ -17,6 +17,8 @@ {{ groups['fleming_unifi'] | list | sort }} prometheus_ipmi_targets: | {{ groups['fleming_pve'] + groups['fleming_server'] | list | sort }} + prometheus_ilo_targets: | + {{ groups['fleming_ilo'] | list | sort }} update_motd: prometheus: >- diff --git a/roles/prometheus/templates/prometheus.yml.j2 b/roles/prometheus/templates/prometheus.yml.j2 index 15f12e9..e80e355 100644 --- a/roles/prometheus/templates/prometheus.yml.j2 +++ b/roles/prometheus/templates/prometheus.yml.j2 @@ -158,4 +158,21 @@ scrape_configs: replacement: '$1:9290' {% endif %} +{% if prometheus_ilo_targets is defined %} + - job_name: ilo + static_configs: + - targets: {{ prometheus_ilo_targets | to_json }} + metrics_path: /snmp + params: + module: + - ilo + relabel_configs: + - source_labels: [__address__] + target_label: __param_target + - source_labels: [__param_target] + target_label: instance + - target_label: __address__ + replacement: 127.0.0.1:9116 +{% endif %} + ... diff --git a/roles/prometheus/templates/snmp.yml.j2 b/roles/prometheus/templates/snmp.yml.j2 index 5ed5fa1..d593a3d 100644 --- a/roles/prometheus/templates/snmp.yml.j2 +++ b/roles/prometheus/templates/snmp.yml.j2 @@ -482,4 +482,252 @@ apc_pdu: priv_protocol: AES priv_password: {{ snmp_pdu_password }} +ilo: + walk: + - 1.3.6.1.4.1.232.6.2.15 # Power meter + - 1.3.6.1.4.1.232.6.2.16 # POST tests + - 1.3.6.1.4.1.232.6.2.6.8.1 # Temperature sensors + - 1.3.6.1.4.1.232.6.2.6.7.1 # Fans + - 1.3.6.1.4.1.232.6.2.9.3.1 # Power supply + - 1.3.6.1.4.1.232.9.2.2 # iLO + metrics: + - name: cpqHePowerMeterCurrReading + oid: 1.3.6.1.4.1.232.6.2.15.3 + type: gauge + help: This is the current Power Meter reading in Watts - 1.3.6.1.4.1.232.6.2.15.3 + - name: cpqHeHWBiosCondition + oid: 1.3.6.1.4.1.232.6.2.16.1 + type: gauge + help: This value indicates an error has been detected during Pre-OS Test (POST) + or during initial hardware initialization - 1.3.6.1.4.1.232.6.2.16.1 + enum_values: + 1: other + 2: ok + 3: degraded + 4: failed + - name: cpqHeTemperatureChassis + oid: 1.3.6.1.4.1.232.6.2.6.8.1.1 + type: gauge + help: The System Chassis number. - 1.3.6.1.4.1.232.6.2.6.8.1.1 + indexes: + - labelname: cpqHeTemperatureChassis + type: gauge + - labelname: cpqHeTemperatureIndex + type: gauge + - name: cpqHeTemperatureIndex + oid: 1.3.6.1.4.1.232.6.2.6.8.1.2 + type: gauge + help: A number that uniquely specifies this temperature sensor description. - + 1.3.6.1.4.1.232.6.2.6.8.1.2 + indexes: + - labelname: cpqHeTemperatureChassis + type: gauge + - labelname: cpqHeTemperatureIndex + type: gauge + - name: cpqHeTemperatureLocale + oid: 1.3.6.1.4.1.232.6.2.6.8.1.3 + type: EnumAsInfo + help: This specifies the location of the temperature sensor present in the system. + - 1.3.6.1.4.1.232.6.2.6.8.1.3 + indexes: + - labelname: cpqHeTemperatureChassis + type: gauge + - labelname: cpqHeTemperatureIndex + type: gauge + enum_values: + 1: other + 2: unknown + 3: system + 4: systemBoard + 5: ioBoard + 6: cpu + 7: memory + 8: storage + 9: removableMedia + 10: powerSupply + 11: ambient + 12: chassis + 13: bridgeCard + - name: cpqHeTemperatureCelsius + oid: 1.3.6.1.4.1.232.6.2.6.8.1.4 + type: gauge + help: This is the current temperature sensor reading in degrees celsius - 1.3.6.1.4.1.232.6.2.6.8.1.4 + indexes: + - labelname: cpqHeTemperatureChassis + type: gauge + - labelname: cpqHeTemperatureIndex + type: gauge + - name: cpqHeTemperatureThreshold + oid: 1.3.6.1.4.1.232.6.2.6.8.1.5 + type: gauge + help: This is the shutdown threshold temperature sensor setting in degrees celsius + - 1.3.6.1.4.1.232.6.2.6.8.1.5 + indexes: + - labelname: cpqHeTemperatureChassis + type: gauge + - labelname: cpqHeTemperatureIndex + type: gauge + - name: cpqHeTemperatureCondition + oid: 1.3.6.1.4.1.232.6.2.6.8.1.6 + type: gauge + help: The Temperature sensor condition - 1.3.6.1.4.1.232.6.2.6.8.1.6 + indexes: + - labelname: cpqHeTemperatureChassis + type: gauge + - labelname: cpqHeTemperatureIndex + type: gauge + enum_values: + 1: other + 2: ok + 3: degraded + 4: failed + - name: cpqHeFltTolFanChassis + oid: 1.3.6.1.4.1.232.6.2.6.7.1.1 + type: gauge + help: The System Chassis number. - 1.3.6.1.4.1.232.6.2.6.7.1.1 + indexes: + - labelname: cpqHeFltTolFanChassis + type: gauge + - labelname: cpqHeFltTolFanIndex + type: gauge + - name: cpqHeFltTolFanIndex + oid: 1.3.6.1.4.1.232.6.2.6.7.1.2 + type: gauge + help: A number that uniquely specifies this fan description. - + 1.3.6.1.4.1.232.6.2.6.7.1.2 + indexes: + - labelname: cpqHeFltTolFanChassis + type: gauge + - labelname: cpqHeFltTolFanIndex + type: gauge + - name: cpqHeFltTolFanLocale + oid: 1.3.6.1.4.1.232.6.2.6.7.1.3 + type: EnumAsInfo + help: This specifies the location of the fan present in the system. + - 1.3.6.1.4.1.232.6.2.6.7.1.3 + indexes: + - labelname: cpqHeFltTolFanChassis + type: gauge + - labelname: cpqHeFltTolFanIndex + type: gauge + enum_values: + 1: other + 2: unknown + 3: system + 4: systemBoard + 5: ioBoard + 6: cpu + 7: memory + 8: storage + 9: removableMedia + 10: powerSupply + 11: ambient + 12: chassis + 13: bridgeCard + - name: cpqHeFltTolFanCondition + oid: 1.3.6.1.4.1.232.6.2.6.7.1.9 + type: gauge + help: The fan condition - 1.3.6.1.4.1.232.6.2.6.7.1.9 + indexes: + - labelname: cpqHeFltTolFanChassis + type: gauge + - labelname: cpqHeFltTolFanIndex + type: gauge + enum_values: + 1: other + 2: ok + 3: degraded + 4: failed + - name: cpqHeFltTolPowerSupplyChassis + oid: 1.3.6.1.4.1.232.6.2.9.3.1.1 + type: gauge + help: The system chassis number. - 1.3.6.1.4.1.232.6.2.9.3.1.1 + indexes: + - labelname: cpqHeFltTolPowerSupplyChassis + type: gauge + - labelname: cpqHeFltTolPowerSupplyBay + type: gauge + - name: cpqHeFltTolPowerSupplyBay + oid: 1.3.6.1.4.1.232.6.2.9.3.1.2 + type: gauge + help: The bay number to index within this chassis. - 1.3.6.1.4.1.232.6.2.9.3.1.2 + indexes: + - labelname: cpqHeFltTolPowerSupplyChassis + type: gauge + - labelname: cpqHeFltTolPowerSupplyBay + type: gauge + - name: cpqHeFltTolPowerSupplyStatus + oid: 1.3.6.1.4.1.232.6.2.9.3.1.5 + type: gauge + help: The status of the power supply. - 1.3.6.1.4.1.232.6.2.9.3.1.5 + indexes: + - labelname: cpqHeFltTolPowerSupplyChassis + type: gauge + - labelname: cpqHeFltTolPowerSupplyBay + type: gauge + enum_values: + 1: noError + 2: generalFailure + 3: bistFailure + 4: fanFailure + 5: tempFailure + 6: interlockOpen + 7: epromFailed + 8: vrefFailed + 9: dacFailed + 10: ramTestFailed + 11: voltageChannelFailed + 12: orringdiodeFailed + 13: brownOut + 14: giveupOnStartup + 15: nvramInvalid + 16: calibrationTableInvalid + 17: noPowerInput + - name: cpqSm2CntlrInterfaceStatus + oid: 1.3.6.1.4.1.232.9.2.2.17 + type: gauge + help: Remote Insight/ Integrated Lights-Out Interface Status - 1.3.6.1.4.1.232.9.2.2.17 + enum_values: + 1: other + 2: ok + 3: notResponding + - name: cpqSm2CntlriLOSecurityOverrideSwitchState + oid: 1.3.6.1.4.1.232.9.2.2.27 + type: gauge + help: Integrated Lights-Out Security Override Switch State - 1.3.6.1.4.1.232.9.2.2.27 + enum_values: + 1: notSupported + 2: set + 3: notSet + - name: cpqSm2CntlrLicenseActive + oid: 1.3.6.1.4.1.232.9.2.2.30 + type: gauge + help: Remote Insight License State - 1.3.6.1.4.1.232.9.2.2.30 + enum_values: + 1: none + 2: iloAdvanced + 3: iloLight + 4: iloAdvancedBlade + 5: iloStandard + 6: iloEssentials + 7: iloScaleOut + 8: iloAdvancedPremiumSecurity + - name: cpqSm2CntlrServerPowerState + oid: 1.3.6.1.4.1.232.9.2.2.32 + type: gauge + help: The current power state for the server - 1.3.6.1.4.1.232.9.2.2.32 + enum_values: + 1: unknown + 2: poweredOff + 3: poweredOn + 4: insufficientPowerOrPowerOnDenied + version: 3 + auth: + security_level: authPriv + username: {{ snmp_ilo_user }} + password: {{ snmp_ilo_auth }} + auth_protocol: SHA + priv_protocol: AES + priv_password: {{ snmp_ilo_priv }} + ... -- 2.43.4