Compare commits
2 Commits
4ea48f0f94
...
d95faaf2c1
| Author | SHA1 | Date | |
|---|---|---|---|
| d95faaf2c1 | |||
| af7e29c063 |
75
k8s/core/prom-stack/grafana-alerting-configmap.yaml
Normal file
75
k8s/core/prom-stack/grafana-alerting-configmap.yaml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: grafana-alerting
|
||||||
|
namespace: prometheus
|
||||||
|
data:
|
||||||
|
rules.yaml: |
|
||||||
|
apiVersion: 1
|
||||||
|
groups:
|
||||||
|
- orgId: 1
|
||||||
|
name: pasarguard_alerts
|
||||||
|
folder: Kubernetes
|
||||||
|
interval: 1m
|
||||||
|
rules:
|
||||||
|
- uid: pasarguard_cpu_throttling
|
||||||
|
title: VPN CPU Throttle
|
||||||
|
condition: A
|
||||||
|
data:
|
||||||
|
- refId: A
|
||||||
|
relativeTimeRange:
|
||||||
|
from: 600
|
||||||
|
to: 0
|
||||||
|
datasourceUid: prometheus
|
||||||
|
model:
|
||||||
|
expr: 'rate(container_cpu_cfs_throttled_periods_total{container="pasarguard-node"}[5m]) > 0.1'
|
||||||
|
refId: A
|
||||||
|
noDataState: NoData
|
||||||
|
execErrState: Alerting
|
||||||
|
for: 5m
|
||||||
|
annotations:
|
||||||
|
description: 'Throttling rate: {{ printf "%.2f" $values.A.Value }}'
|
||||||
|
summary: 'VPN node throttling CPU on {{ $labels.node }}'
|
||||||
|
labels:
|
||||||
|
severity: warning
|
||||||
|
|
||||||
|
contactpoints.yaml: |
|
||||||
|
apiVersion: 1
|
||||||
|
contactPoints:
|
||||||
|
- orgId: 1
|
||||||
|
name: telegram
|
||||||
|
receivers:
|
||||||
|
- uid: telegram_default
|
||||||
|
type: telegram
|
||||||
|
disableResolveMessage: false
|
||||||
|
settings:
|
||||||
|
bottoken: $TELEGRAM_BOT_TOKEN
|
||||||
|
chatid: $TELEGRAM_CHAT_ID
|
||||||
|
message: |
|
||||||
|
{{ if eq .Status "firing" }}🔥 FIRING{{ else }}✅ RESOLVED{{ end }}
|
||||||
|
|
||||||
|
{{ range .Alerts }}
|
||||||
|
📊 <b>{{ .Labels.alertname }}</b>
|
||||||
|
{{ if .Annotations.summary }}{{ .Annotations.summary }}{{ end }}
|
||||||
|
|
||||||
|
🎯 <b>Details:</b>
|
||||||
|
• Pod: <code>{{ .Labels.pod }}</code>
|
||||||
|
• Node: <code>{{ .Labels.node }}</code>
|
||||||
|
• Namespace: <code>{{ .Labels.namespace }}</code>
|
||||||
|
{{ if .Annotations.description }}• {{ .Annotations.description }}{{ end }}
|
||||||
|
|
||||||
|
🔗 <a href="{{ .GeneratorURL }}">View in Grafana</a>
|
||||||
|
{{ end }}
|
||||||
|
parse_mode: HTML
|
||||||
|
|
||||||
|
policies.yaml: |
|
||||||
|
apiVersion: 1
|
||||||
|
policies:
|
||||||
|
- orgId: 1
|
||||||
|
receiver: telegram
|
||||||
|
group_by:
|
||||||
|
- grafana_folder
|
||||||
|
- alertname
|
||||||
|
group_wait: 10s
|
||||||
|
group_interval: 5m
|
||||||
|
repeat_interval: 4h
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
rules.yaml: |
|
|
||||||
apiVersion: 1
|
|
||||||
groups:
|
|
||||||
- orgId: 1
|
|
||||||
name: pasarguard_alerts
|
|
||||||
folder: Kubernetes
|
|
||||||
interval: 1m
|
|
||||||
rules:
|
|
||||||
- uid: pasarguard_cpu_throttling
|
|
||||||
title: VPN CPU Throttle
|
|
||||||
condition: A
|
|
||||||
data:
|
|
||||||
- refId: A
|
|
||||||
relativeTimeRange:
|
|
||||||
from: 600
|
|
||||||
to: 0
|
|
||||||
datasourceUid: prometheus
|
|
||||||
model:
|
|
||||||
expr: 'rate(container_cpu_cfs_throttled_periods_total{container="pasarguard-node"}[5m]) > 0.1'
|
|
||||||
refId: A
|
|
||||||
noDataState: NoData
|
|
||||||
execErrState: Alerting
|
|
||||||
for: 5m
|
|
||||||
annotations:
|
|
||||||
description: 'Throttling rate: {{ printf "%.2f" $values.A.Value }}'
|
|
||||||
summary: 'VPN node throttling CPU on {{ $labels.node }}'
|
|
||||||
labels:
|
|
||||||
severity: warning
|
|
||||||
|
|
||||||
contactpoints.yaml: |
|
|
||||||
apiVersion: 1
|
|
||||||
contactPoints:
|
|
||||||
- orgId: 1
|
|
||||||
name: telegram
|
|
||||||
receivers:
|
|
||||||
- uid: telegram_default
|
|
||||||
type: telegram
|
|
||||||
settings:
|
|
||||||
bottoken: $TELEGRAM_BOT_TOKEN
|
|
||||||
chatid: $TELEGRAM_CHAT_ID
|
|
||||||
message: |
|
|
||||||
{{ if eq .Status "firing" }}🔥 FIRING{{ else }}✅ RESOLVED{{ end }}
|
|
||||||
|
|
||||||
{{ range .Alerts }}
|
|
||||||
📊 <b>{{ .Labels.alertname }}</b>
|
|
||||||
{{ if .Annotations.summary }}{{ .Annotations.summary }}{{ end }}
|
|
||||||
|
|
||||||
🎯 <b>Details:</b>
|
|
||||||
• Pod: <code>{{ .Labels.pod }}</code>
|
|
||||||
• Node: <code>{{ .Labels.node }}</code>
|
|
||||||
• Namespace: <code>{{ .Labels.namespace }}</code>
|
|
||||||
{{ if .Annotations.description }}• {{ .Annotations.description }}{{ end }}
|
|
||||||
|
|
||||||
🔗 <a href="{{ .GeneratorURL }}">View in Grafana</a>
|
|
||||||
{{ end }}
|
|
||||||
parse_mode: HTML
|
|
||||||
disableResolveMessage: false
|
|
||||||
|
|
||||||
policies.yaml: |
|
|
||||||
apiVersion: 1
|
|
||||||
policies:
|
|
||||||
- orgId: 1
|
|
||||||
receiver: telegram
|
|
||||||
group_by:
|
|
||||||
- grafana_folder
|
|
||||||
- alertname
|
|
||||||
group_wait: 10s
|
|
||||||
group_interval: 5m
|
|
||||||
repeat_interval: 4h
|
|
||||||
@@ -57,9 +57,20 @@ ingress:
|
|||||||
- '*.hexor.cy'
|
- '*.hexor.cy'
|
||||||
|
|
||||||
extraConfigmapMounts:
|
extraConfigmapMounts:
|
||||||
- name: grafana-alerting
|
- name: grafana-alerting-rules
|
||||||
mountPath: /etc/grafana/provisioning/alerting
|
mountPath: /etc/grafana/provisioning/alerting/rules.yaml
|
||||||
configMap: grafana-alerting
|
configMap: grafana-alerting
|
||||||
|
subPath: rules.yaml
|
||||||
|
readOnly: true
|
||||||
|
- name: grafana-alerting-contactpoints
|
||||||
|
mountPath: /etc/grafana/provisioning/alerting/contactpoints.yaml
|
||||||
|
configMap: grafana-alerting
|
||||||
|
subPath: contactpoints.yaml
|
||||||
|
readOnly: true
|
||||||
|
- name: grafana-alerting-policies
|
||||||
|
mountPath: /etc/grafana/provisioning/alerting/policies.yaml
|
||||||
|
configMap: grafana-alerting
|
||||||
|
subPath: policies.yaml
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
|
||||||
envValueFrom:
|
envValueFrom:
|
||||||
|
|||||||
@@ -5,12 +5,7 @@ resources:
|
|||||||
- app.yaml
|
- app.yaml
|
||||||
- persistentVolume.yaml
|
- persistentVolume.yaml
|
||||||
- external-secrets.yaml
|
- external-secrets.yaml
|
||||||
|
- grafana-alerting-configmap.yaml
|
||||||
configMapGenerator:
|
|
||||||
- name: grafana-alerting
|
|
||||||
namespace: prometheus
|
|
||||||
files:
|
|
||||||
- grafana-alerting.yaml
|
|
||||||
|
|
||||||
helmCharts:
|
helmCharts:
|
||||||
- name: kube-prometheus-stack
|
- name: kube-prometheus-stack
|
||||||
|
|||||||
Reference in New Issue
Block a user