1
0
forked from k-space/kube

prometheus-operator: Fix Alertmanager integration

This commit is contained in:
Lauri Võsandi 2022-09-20 12:22:49 +03:00
parent 9a672d7ef3
commit 790ffa175b
2 changed files with 35 additions and 5 deletions

View File

@ -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 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 \ kubectl create -n prometheus-operator secret generic mikrotik-exporter \

View File

@ -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 apiVersion: monitoring.coreos.com/v1
kind: PodMonitor kind: PodMonitor
metadata: metadata:
@ -15,6 +33,11 @@ kind: Alertmanager
metadata: metadata:
name: alertmanager name: alertmanager
spec: spec:
alertmanagerConfigSelector:
matchLabels:
app.kubernetes.io/name: alertmanager
secrets:
- slack-secrets
nodeSelector: nodeSelector:
dedicated: monitoring dedicated: monitoring
tolerations: tolerations:
@ -52,10 +75,8 @@ spec:
alerting: alerting:
alertmanagers: alertmanagers:
- namespace: prometheus-operator - namespace: prometheus-operator
name: alertmanager name: alertmanager-operated
port: http port: web
pathPrefix: "/"
apiVersion: v2
externalUrl: "http://prom.k-space.ee/" externalUrl: "http://prom.k-space.ee/"
replicas: 2 replicas: 2
shards: 1 shards: 1