Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for new alertmanager interfaces in grafana #365

Merged
merged 5 commits into from
Sep 20, 2023
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
3 changes: 3 additions & 0 deletions changelogs/fragments/250.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
major_changes:
- grafana - add alertmanager datasource to grafana to allow direct alert management via grafana
- grafana - update Prometheus Alerts dashboard to include new alert panel interface for active alerts
keithf4 marked this conversation as resolved.
Show resolved Hide resolved
27 changes: 27 additions & 0 deletions changelogs/fragments/template.yml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
breaking_changes:
- area affected (roles, specific role, playbooks, docs) - This category should list all changes to features which absolutely require attention from users when upgrading, because an existing behavior is changed. This section should only appear in a initial major release (`x.0.0`) according to semantic versioning.

major_changes:
- area affected (roles, specific role, playbooks, docs) - This category contains major changes to the project. It should only contain a few items per major version, describing high-level changes. This section should not appear in patch releases according to semantic versioning.

minor_changes:
- area affected (roles, specific role, playbooks, docs) - This category should mention all new features not contained elsewhere. This section should not appear in patch releases according to semantic versioning.

removed_features:
- area affected (roles, specific role, playbooks, docs) - This category should mention all features that have been removed in this release. This section should only appear in a initial major release (`x.0.0`) according to semantic versioning.

deprecated_features:
- area affected (roles, specific role, playbooks, docs) - This category should contain all features which have been deprecated and will be removed in a future release. This section should not appear in patch releases according to semantic versioning.

security_fixes:
- area affected (roles, specific role, playbooks, docs) - This category should mention all security relevant fixes, including CVEs if available.

bugfixes:
- area affected (roles, specific role, playbooks, docs) - This category should be a list of all bug fixes which fix a bug that was present in a previous version.

known_issues:
- area affected (roles, specific role, playbooks, docs) - This category should mention known issues that are currently not fixed or will not be fixed.

trivial:
- area affected (roles, specific role, playbooks, docs) - This category will **not be shown** in the changelog. It can be used to describe changes that are not touching user-facing code, like changes in tests. This is useful if every PR is required to have a changelog fragment.
189 changes: 55 additions & 134 deletions grafana/common/Prometheus_Alerts.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,164 +3,78 @@
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": false,
"gnetId": null,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 8,
"links": [],
"liveNow": false,
"panels": [
{
"columns": [],
"datasource": null,
"fontSize": "100%",
"datasource": {
"type": "prometheus",
"uid": "crunchyprometheus"
},
"gridPos": {
"h": 7,
"h": 8,
"w": 24,
"x": 0,
"y": 0
},
"id": 2,
"links": [],
"options": {},
"pageSize": null,
"scroll": true,
"showHeader": true,
"sort": {
"col": 0,
"desc": true
},
"styles": [
{
"alias": "Time",
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"link": false,
"pattern": "Time",
"type": "date"
},
{
"alias": "",
"colorMode": "row",
"colors": [
"rgba(50, 172, 45, 0.97)",
"rgba(237, 129, 40, 0.89)",
"rgba(245, 54, 54, 0.9)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 0,
"link": false,
"mappingType": 1,
"pattern": "severity_num",
"thresholds": [
"200",
"300"
],
"type": "string",
"unit": "none"
},
{
"alias": "",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"mappingType": 1,
"pattern": "__name__",
"thresholds": [],
"type": "hidden",
"unit": "short"
},
{
"alias": "",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"mappingType": 1,
"pattern": "alertstate",
"thresholds": [],
"type": "hidden",
"unit": "short"
"id": 5,
"options": {
"alertInstanceLabelFilter": "",
"alertName": "",
"dashboardAlerts": false,
"datasource": "PROMETHEUS",
"groupBy": [],
"groupMode": "default",
"maxItems": 20,
"sortOrder": 1,
"stateFilter": {
"error": true,
"firing": true,
"noData": false,
"normal": false,
"pending": true
},
{
"alias": "",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"mappingType": 1,
"pattern": "Value",
"thresholds": [],
"type": "hidden",
"unit": "short"
},
{
"alias": "",
"colorMode": null,
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
"rgba(50, 172, 45, 0.97)"
],
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"decimals": 2,
"mappingType": 1,
"pattern": "alert_value",
"thresholds": [],
"type": "number",
"unit": "none"
}
],
"targets": [
{
"expr": "ALERTS{alertstate=\"firing\"}",
"format": "table",
"instant": true,
"interval": "",
"intervalFactor": 4,
"legendFormat": "",
"refId": "A"
}
],
"timeFrom": null,
"viewMode": "list"
},
"title": "Active Alerts",
"transform": "table",
"type": "table"
"type": "alertlist"
},
{
"columns": [],
"datasource": null,
"datasource": {
"type": "prometheus",
"uid": "crunchyprometheus"
},
"fontSize": "100%",
"gridPos": {
"h": 7,
"w": 24,
"x": 0,
"y": 7
"y": 8
},
"id": 3,
"links": [],
"options": {},
"pageSize": null,
"scroll": true,
"showHeader": true,
"sort": {
Expand All @@ -170,13 +84,15 @@
"styles": [
{
"alias": "Time",
"align": "auto",
"dateFormat": "YYYY-MM-DD HH:mm:ss",
"link": false,
"pattern": "Time",
"type": "date"
},
{
"alias": "",
"align": "auto",
"colorMode": "row",
"colors": [
"rgba(50, 172, 45, 0.97)",
Expand All @@ -197,7 +113,7 @@
},
{
"alias": "",
"colorMode": null,
"align": "auto",
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
Expand All @@ -213,7 +129,7 @@
},
{
"alias": "",
"colorMode": null,
"align": "auto",
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
Expand All @@ -229,7 +145,7 @@
},
{
"alias": "",
"colorMode": null,
"align": "auto",
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
Expand All @@ -245,7 +161,7 @@
},
{
"alias": "",
"colorMode": null,
"align": "auto",
"colors": [
"rgba(245, 54, 54, 0.9)",
"rgba(237, 129, 40, 0.89)",
Expand All @@ -262,6 +178,10 @@
],
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "crunchyprometheus"
},
"expr": "ALERTS{alertstate=\"firing\"}",
"format": "table",
"instant": false,
Expand All @@ -274,11 +194,11 @@
"timeFrom": "1w",
"title": "Alert History (1 week)",
"transform": "table",
"type": "table"
"type": "table-old"
}
],
"refresh": "5m",
"schemaVersion": 21,
"schemaVersion": 37,
"style": "dark",
"tags": [],
"templating": {
Expand All @@ -304,5 +224,6 @@
"timezone": "",
"title": "Prometheus Alerts",
"uid": "QTsttxNmk",
"version": 2
"version": 1,
"weekStart": ""
}
20 changes: 19 additions & 1 deletion grafana/common/crunchy_grafana_datasource.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,32 @@
# config file version
apiVersion: 1

deleteDatasources:
- name: PROMETHEUS
orgId: 1
- name: ALERTMANAGER
orgId: 1

datasources:
- name: PROMETHEUS
uid: PDC1078F23EBDF0E5
uid: crunchyprometheus
type: prometheus
access: proxy
url: http://localhost:9090
isDefault: True
editable: False
orgId: 1
version: 1
jsonData:
manageAlerts: 'true'
alertmanagerUid: 'crunchyalertmanager'
- name: ALERTMANAGER
name: 'ALERTMANAGER'
uid: crunchyalertmanager
type: alertmanager
url: http://localhost:9093
access: proxy
jsonData:
implementation: 'prometheus'
handleGrafanaManagedAlerts: 'false'