diff --git a/prometheus-operator/README.md b/prometheus-operator/README.md index 18bdd1a..3ee9518 100644 --- a/prometheus-operator/README.md +++ b/prometheus-operator/README.md @@ -9,7 +9,16 @@ kubectl create -n prometheus-operator configmap snmp-exporter --from-file=snmp.y kubectl apply -n prometheus-operator -f application.yml -f node-exporter.yml -f blackbox-exporter.yml -f snmp-exporter.yml -f mikrotik-exporter.yml ``` -# Mikrotik expoeter + +# Slack + +``` + kubectl create -n prometheus-operator secret generic slack-secrets \ + --from-literal=webhook-url=https://hooks.slack.com/services/... +``` + + +# Mikrotik exporter ``` kubectl create -n prometheus-operator secret generic mikrotik-exporter \ diff --git a/prometheus-operator/application.yml b/prometheus-operator/application.yml index 0fe2131..56cae76 100644 --- a/prometheus-operator/application.yml +++ b/prometheus-operator/application.yml @@ -1,4 +1,22 @@ --- +apiVersion: monitoring.coreos.com/v1alpha1 +kind: AlertmanagerConfig +metadata: + name: alertmanager + labels: + app.kubernetes.io/name: alertmanager +spec: + route: + receiver: 'slack-notifications' + receivers: + - name: 'slack-notifications' + slackConfigs: + - channel: '#kube-prod' + sendResolved: true + apiURL: + name: slack-secrets + key: webhook-url +--- apiVersion: monitoring.coreos.com/v1 kind: PodMonitor metadata: @@ -15,6 +33,11 @@ kind: Alertmanager metadata: name: alertmanager spec: + alertmanagerConfigSelector: + matchLabels: + app.kubernetes.io/name: alertmanager + secrets: + - slack-secrets nodeSelector: dedicated: monitoring tolerations: @@ -52,10 +75,8 @@ spec: alerting: alertmanagers: - namespace: prometheus-operator - name: alertmanager - port: http - pathPrefix: "/" - apiVersion: v2 + name: alertmanager-operated + port: web externalUrl: "http://prom.k-space.ee/" replicas: 2 shards: 1