diff --git a/roles/prometheus/tasks/main.yml b/roles/prometheus/tasks/main.yml index 790c108..f9e48e8 100644 --- a/roles/prometheus/tasks/main.yml +++ b/roles/prometheus/tasks/main.yml @@ -41,6 +41,7 @@ - django.rules.yml - ups.rules.yml - postgres.rules.yml + - environmental.rules.yml notify: Restart Prometheus - name: Make Prometheus snmp-exporter listen on localhost only diff --git a/roles/prometheus/templates/environmental.rules.yml.j2 b/roles/prometheus/templates/environmental.rules.yml.j2 new file mode 100644 index 0000000..f371329 --- /dev/null +++ b/roles/prometheus/templates/environmental.rules.yml.j2 @@ -0,0 +1,52 @@ +--- +{{ ansible_managed | comment }} + +{% macro raw(string) -%} +{{ "{{" }} {{ string }} {{ "}}" }} +{%- endmacro %} + +groups: + + - name: environmental.rules + rules: + + - alert: EnvironmentalTemperature + expr: rPDU2SensorTempHumidityStatusTempC / 10 > 30 + for: 10m + labels: + severity: warning + annotations: + summary: >- + Température environnementale à {{ raw('$value') }}° + + - alert: EnvironmentalTemperature + expr: rPDU2SensorTempHumidityStatusTempC / 10 > 40 + for: 10m + labels: + severity: critical + annotations: + summary: >- + Température environnementale à {{ raw('$value') }}° + + + - alert: EnvironmentalTemperature + expr: xupsEnvRemoteTemp > 30 + for: 10m + labels: + severity: warning + annotations: + summary: >- + Température environnementale à {{ raw('$value') }}° + + - alert: EnvironmentalTemperature + expr: xupsEnvRemoteTemp > 40 + for: 10m + labels: + severity: critical + annotations: + summary: >- + Température environnementale à {{ raw('$value') }}° + + + +... diff --git a/roles/prometheus_federate/tasks/main.yml b/roles/prometheus_federate/tasks/main.yml index cc96e65..366f614 100644 --- a/roles/prometheus_federate/tasks/main.yml +++ b/roles/prometheus_federate/tasks/main.yml @@ -20,6 +20,13 @@ - alert.rules.yml notify: Restart Prometheus +- name: Define Prometheus retention time + lineinfile: + path: /etc/default/prometheus + regexp: '^ARGS=\"--log.level=debug\"' + line: "ARGS=\"--log.level=debug --storage.tsdb.retention.time=120d\"" + notify: Restart Prometheus + # We don't need to restart Prometheus when updating nodes - name: Configure Prometheus Federate devices copy: