From b80d566927e5d4d11afb38483f94355b0de5ffb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20V=C3=B5sandi?= Date: Fri, 18 Aug 2023 08:37:58 +0300 Subject: [PATCH] asterisk: Add pod monitor and alerting rules --- asterisk/application.yml | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/asterisk/application.yml b/asterisk/application.yml index 2c41b4b..f6a4594 100644 --- a/asterisk/application.yml +++ b/asterisk/application.yml @@ -48,3 +48,44 @@ spec: - name: config secret: secretName: asterisk-secrets +--- +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + name: asterisk +spec: + selector: + matchLabels: + app: asterisk + podMetricsEndpoints: + - port: metrics +--- +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + name: asterisk +spec: + groups: + - name: asterisk + rules: + - alert: AsteriskPhoneNotRegistered + expr: asterisk_endpoints_state{resource=~"1.*"} < 2 + for: 5m + labels: + severity: critical + annotations: + summary: "{{ $labels.resource }} is not registered." + - alert: AsteriskOutboundNumberNotRegistered + expr: asterisk_pjsip_outbound_registration_status == 0 + for: 5m + labels: + severity: critical + annotations: + summary: "{{ $labels.username }} is not registered with provider." + - alert: AsteriskCallsPerMinuteLimitExceed + expr: asterisk_channels_duration_seconds > 10*60 + for: 20m + labels: + severity: warning + annotations: + summary: "Call at channel {{ $labels.name }} is taking longer than 10m."