52 lines
1.5 KiB
Bash
52 lines
1.5 KiB
Bash
kubectl create secret generic alertmanager-smtp -n monitoring --from-literal=password='pX8XpxrNT8'
|
|
|
|
|
|
cat > blackbox-email-alert.yaml <<'EOF'
|
|
apiVersion: monitoring.coreos.com/v1alpha1
|
|
kind: AlertmanagerConfig
|
|
metadata:
|
|
name: blackbox-email-routing
|
|
namespace: monitoring
|
|
labels:
|
|
release: kube-prometheus-stack
|
|
spec:
|
|
route:
|
|
groupBy: ["alertname", "instance"]
|
|
groupWait: 30s
|
|
groupInterval: 5m
|
|
repeatInterval: 1h
|
|
receiver: "email-default"
|
|
routes:
|
|
- matchers:
|
|
- name: alertname
|
|
value: BlackboxHttpProbeFailed
|
|
matchType: "="
|
|
- name: instance
|
|
value: "https://idcidp.pigreco66.it"
|
|
matchType: "="
|
|
receiver: "email-servizio-idcidp"
|
|
|
|
receivers:
|
|
- name: "email-default"
|
|
emailConfigs: []
|
|
|
|
- name: "email-servizio-idcidp"
|
|
emailConfigs:
|
|
- to: "alessandro.barucci66@gmail.com"
|
|
from: "alert@italiadatacenter.com"
|
|
smarthost: "mail.tophost.it:587"
|
|
authUsername: "italiadatacenter.com62374"
|
|
authPassword:
|
|
name: alertmanager-smtp
|
|
key: password
|
|
requireTLS: true
|
|
sendResolved: true
|
|
headers:
|
|
- key: subject
|
|
value: "[ALERT] Servizio IDCIDP non raggiungibile"
|
|
html: |
|
|
<p>Il servizio <b>{{ .CommonLabels.instance }}</b> non risponde.</p>
|
|
<p>{{ .CommonAnnotations.description }}</p>
|
|
EOF
|
|
|
|
kubectl apply -f blackbox-email-alert.yaml |