User Tools

Site Tools


strutture:lnf:dr:calcolo:sistemi:ceph:alertmanager

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

strutture:lnf:dr:calcolo:sistemi:ceph:alertmanager [2023/11/22 14:44] – created rorru@infn.itstrutture:lnf:dr:calcolo:sistemi:ceph:alertmanager [2023/11/22 14:44] (current) rorru@infn.it
Line 1: Line 1:
 +===== Alertmanager =====
 +Ad ogni installazione di CEPH eseguita con ''cephamd'', viene installato automticamente anche lo stack di monitoring basato su Prometheus, Alertmanager e Grafana. Quindi le funzionalità sono integrate nella dashboard e posso essere configurate ulteriormente.  
  
 +==== Configurazione custom ====
 + 
 +Per modificare la configurazione di default di Alertmanager è necessario ridefinire il template con il quale la configurazione e per Alertmanager viene generata e utilizzata nei container che ospitano Alertmanager. 
 +
 +Immaginando quindi di voler abilitare l'invio di una email per ogni gruppo di alert (di default inviato sulla dashboard) dobbiamo partire dal template installato di default:
 +
 +1. Ottenere il template attuale:
 +<code>
 +# ceph config-key get mgr/cephadm/services/alertmanager/alertmanager.yml
 +
 +# {{ cephadm_managed }}
 +# See https://prometheus.io/docs/alerting/configuration/ for documentation.
 +
 +global:
 +  resolve_timeout: 5m
 +{% if not secure %}
 +  http_config:
 +    tls_config:
 +      insecure_skip_verify: true
 +{% endif %}
 +
 +route:
 +  receiver: 'default'
 +  routes:
 +    - group_by: ['alertname']
 +      group_wait: 10s
 +      group_interval: 10s
 +      repeat_interval: 1h
 +      receiver: 'ceph-dashboard'
 +{% if snmp_gateway_urls %}
 +      continue: true
 +    - receiver: 'snmp-gateway'
 +      repeat_interval: 1h
 +      group_interval: 10s
 +      group_by: ['alertname']
 +      match_re:
 +        oid: "(1.3.6.1.4.1.50495.).*"
 +{% endif %}
 +
 +receivers:
 +- name: 'default'
 +  webhook_configs:
 +{% for url in default_webhook_urls %}
 +  - url: '{{ url }}'
 +{% endfor %}
 +- name: 'ceph-dashboard'
 +  webhook_configs:
 +{% for url in dashboard_urls %}
 +  - url: '{{ url }}/api/prometheus_receiver'
 +{% endfor %}
 +{% if snmp_gateway_urls %}
 +- name: 'snmp-gateway'
 +  webhook_configs:
 +{% for url in snmp_gateway_urls %}
 +  - url: '{{ url }}'
 +{% endfor %}
 +{% endif %}
 +</code>
 +
 +E inserire quanto ottenuto in un file dal nome ''alertmanager.yml.j2''
 +
 +2. Aggiungere al contenuto le definizioni globali (valori esempio):
 +<code>
 +  smtp_smarthost: smtp.example.it:25
 +  smtp_from: 'ceph@example.it'
 +  smtp_require_tls: true
 +  smtp_auth_username: ''
 +  smtp_auth_password: ''
 +</code>
 +
 +3. Aggiungere al contenuto i destinatari nella lista ''email_configs'' per il receiver ''ceph-dashboard'' (valori esempio):
 +<code>
 +  email_configs:
 +  - to: 'support@example.it'
 +</code>
 +
 +Il contenuto del file dovrebbe essere a questo punto simile a:
 +<code>
 +# {{ cephadm_managed }}
 +# See https://prometheus.io/docs/alerting/configuration/ for documentation.
 +
 +global:
 +  resolve_timeout: 5m
 +{% if not secure %}
 +  http_config:
 +    tls_config:
 +      insecure_skip_verify: true
 +{% endif %}
 +  smtp_smarthost: smtp.example.it:25
 +  smtp_from: 'ceph@example.it'
 +  smtp_require_tls: true
 +  smtp_auth_username: ''
 +  smtp_auth_password: ''
 +
 +
 +route:
 +  receiver: 'default'
 +  routes:
 +    - group_by: ['alertname']
 +      group_wait: 10s
 +      group_interval: 10s
 +      repeat_interval: 1h
 +      receiver: 'ceph-dashboard'
 +{% if snmp_gateway_urls %}
 +      continue: true
 +    - receiver: 'snmp-gateway'
 +      repeat_interval: 1h
 +      group_interval: 10s
 +      group_by: ['alertname']
 +      match_re:
 +        oid: "(1.3.6.1.4.1.50495.).*"
 +{% endif %}
 +
 +receivers:
 +- name: 'default'
 +  webhook_configs:
 +{% for url in default_webhook_urls %}
 +  - url: '{{ url }}'
 +{% endfor %}
 +- name: 'ceph-dashboard'
 +  webhook_configs:
 +{% for url in dashboard_urls %}
 +  - url: '{{ url }}/api/prometheus_receiver'
 +{% endfor %}
 +  email_configs:
 +  - to: 'support@example.it'
 +{% if snmp_gateway_urls %}
 +- name: 'snmp-gateway'
 +  webhook_configs:
 +{% for url in snmp_gateway_urls %}
 +  - url: '{{ url }}'
 +{% endfor %}
 +{% endif %}
 +</code>
 +
 +4. Sostituire il template nella configurazione per cephadm:
 +  ceph config-key set mgr/cephadm/services/alertmanager/alertmanager.yml -i /<path>/alertmanager.yml.j2
 +  
 +5. Avviare a riconfigurazione dei servizio esistente:
 +   ceph orch reconfig alertmanager
 +   
 +6. Verificare con ''ceph orch ls'' e ''ceph orch ps'' il refresh dei container

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki