Skip to content
This repository has been archived by the owner on Jan 17, 2025. It is now read-only.

Add instructions to set up alerting channels to Prometheus example #227

Merged
merged 2 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions prometheus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ The provided `values.yaml` covers the following adjustments:
- Client certificate injection to support scraping of workload secured with Istio strict mTLS
- Active scraping of workload annotated with prometheus.io/scrape

3. You can connect the Alertmanager to your notification channel (for instance, Slack or VictorOps) by providing an [Alertmanager configuration](https://prometheus.io/docs/alerting/latest/configuration/#configuration-file) to the `alertmanager.config` value.

The [alertmanager-values.yaml](./alertmanager-values.yaml) example provides a configuration that sends notifications for alerts with high severity to a Slack channel. To deploy it, download the file, adapt `<channel-name>`, `<api-url>` and `<cluster-domain>` to your environment, and run the Helm upgrade command to deploy the configuration:
```bash
helm upgrade --install -n ${KYMA_NS} ${HELM_RELEASE} prometheus-community/kube-prometheus-stack -f https://raw.githubusercontent.com/kyma-project/examples/main/prometheus/values.yaml -f ./alertmanager-values.yaml --set grafana.adminPassword=myPwd
```

### Activate scraping of Istio metrics & Grafana dashboards

1. To configure Prometheus for scraping of the Istio-specific metrics from any istio-proxy running in the cluster, deploy a PodMonitor, which scrapes any Pod that has a port with name `.*-envoy-prom` exposed.
Expand Down
52 changes: 52 additions & 0 deletions prometheus/alertmanager-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
alertmanager:
config:
global:
resolve_timeout: 5m
inhibit_rules:
- source_matchers:
- 'severity = critical'
target_matchers:
- 'severity =~ warning|info'
equal:
- 'namespace'
- 'alertname'
- source_matchers:
- 'severity = warning'
target_matchers:
- 'severity = info'
equal:
- 'namespace'
- 'alertname'
- source_matchers:
- 'alertname = InfoInhibitor'
target_matchers:
- 'severity = info'
equal:
- 'namespace'
route:
group_by: ['namespace']
group_wait: 30s
group_interval: 5m
repeat_interval: 12h
receiver: 'null'
routes:
- receiver: 'null'
matchers:
- alertname =~ "InfoInhibitor|Watchdog"
- continue: true
match_re:
severity: critical
receiver: "slack"
receivers:
- name: 'null'
- name: "slack"
slack_configs:
- channel: "<channel-name>"
send_resolved: true
api_url: "<api-url>"
icon_emoji: ":ghost:"
title: '{{ template "__subject" . }}'
title_link: 'https://grafana.<cluster-domain>'
text: '{{ range .Alerts }}`}}<!channel>{{`{{- "\n" -}}`}}{{`{{ .Annotations.description }}`}}{{`{{- "\n" -}}`}}{{`{{ end }}'
templates:
- '/etc/alertmanager/config/*.tmpl'