This commit is contained in:
Nico Schottelius 2022-10-18 16:57:09 +02:00
parent 1d45335bf0
commit f7084c6c6e
3 changed files with 65 additions and 3 deletions

View File

@ -0,0 +1,32 @@
apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
name: config-example
labels:
alertmanagerConfig: example
spec:
route:
groupBy: ['alertname', 'job']
groupWait: 30s
groupInterval: 1m
repeatInterval: 3h
receiver: 'slack-monitoring'
receivers:
- name: 'slack-monitoring'
slackConfigs:
- channel: '#devops-monitoring'
title: "K8S {{ range .Alerts }}{{ .Annotations.summary }}\n{{ end }}"
text: "K8S {{ range .Alerts }}{{ .Annotations.description }}\n{{ end }}"
sendResolved: true
apiURL:
name: 'slackapisecret'
key: 'url'
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: slackapisecret
stringData:
url: 'https://hooks.slack.com/services/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'

View File

@ -0,0 +1,30 @@
apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
name: config-example
labels:
alertmanagerConfig: example
spec:
route:
groupBy: ['job']
groupWait: 30s
groupInterval: 5m
repeatInterval: 12h
receiver: 'wechat-example'
receivers:
- name: 'wechat-example'
wechatConfigs:
- apiURL: 'http://wechatserver:8080/'
corpID: 'wechat-corpid'
apiSecret:
name: 'wechat-config'
key: 'apiSecret'
---
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: wechat-config
data:
apiSecret: d2VjaGF0LXNlY3JldAo=

View File

@ -11,10 +11,10 @@ spec:
- name: ./example.rules
rules:
- alert: RAMUsage
expr: (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes) < 0.25
expr: (node_memory_MemAvailable_bytes / node_memory_MemTotal_bytes) < 0.95
for: 5m
labels:
severity: info
annotations:
summary: "Server {{ $labels.instance }} has a less than 25% RAM available"
description: "Server {{ $labels.instance }} has only {{ $value }}% of its total amount of RAM available!"
summary: "K8SServerTest {{ $labels.instance }} has a less than 95% RAM available"
description: "K8SServerTest {{ $labels.instance }} has only {{ $value }}% of its total amount of RAM available!"