-
Notifications
You must be signed in to change notification settings - Fork 2.4k
[mixins] Alertmanager Overview dashboard #2540
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2729314
Implements a Grafana dashboard to the mixin.
ArthurSens 18be2e3
Install jsonnet-bundler in CI
ArthurSens 904d455
Add UID to Alertmanager / Overview dashboard
ArthurSens 7704475
Merge branch 'master' into as/dashboard-mixins
ArthurSens 5360016
Change jsonnetfmt max-lines to 1
ArthurSens b05360b
Clean-up low level metrics
ArthurSens 9b7d3b8
wip
ArthurSens 216e2cc
Add HA cluster support
ArthurSens b36beb8
Small fixes
ArthurSens 43671c7
Move variables from config to dashboard lib
ArthurSens e7e574e
Address comments
ArthurSens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| vendor | ||
| dashboards_out |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| local dashboards = (import 'mixin.libsonnet').grafanaDashboards; | ||
|
|
||
| { | ||
| [name]: dashboards[name] | ||
| for name in std.objectFields(dashboards) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| (import './dashboards/overview.libsonnet') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| local grafana = import 'github.com/grafana/grafonnet-lib/grafonnet/grafana.libsonnet'; | ||
| local dashboard = grafana.dashboard; | ||
| local row = grafana.row; | ||
| local prometheus = grafana.prometheus; | ||
| local template = grafana.template; | ||
| local graphPanel = grafana.graphPanel; | ||
|
|
||
| { | ||
| grafanaDashboards+:: { | ||
|
|
||
| local amQuerySelector = std.join(',', ['%s="$%s"' % [label, label] for label in std.split($._config.alertmanagerClusterLabels, ',')]), | ||
| local amNameDashboardLegend = std.join('/', ['{{%s}}' % [label] for label in std.split($._config.alertmanagerNameLabels, ',')]), | ||
|
|
||
| local alertmanagerClusterSelectorTemplates = | ||
| [ | ||
| template.new( | ||
| name=label, | ||
| datasource='$datasource', | ||
| query='label_values(alertmanager_alerts, %s)' % label, | ||
| current='', | ||
| refresh=2, | ||
| includeAll=false, | ||
| sort=1 | ||
| ) | ||
| for label in std.split($._config.alertmanagerClusterLabels, ',') | ||
| ], | ||
|
|
||
| local integrationTemplate = | ||
| template.new( | ||
| name='integration', | ||
| datasource='$datasource', | ||
| query='label_values(alertmanager_notifications_total{integration=~"%s"}, integration)' % $._config.alertmanagerCriticalIntegrationsRegEx, | ||
| current='all', | ||
| hide='2', // Always hide | ||
| refresh=2, | ||
| includeAll=true, | ||
| sort=1 | ||
| ), | ||
|
|
||
| 'alertmanager-overview.json': | ||
| local alerts = | ||
| graphPanel.new( | ||
| 'Alerts', | ||
| datasource='$datasource', | ||
| span=6, | ||
| format='none', | ||
| stack=true, | ||
| fill=1, | ||
| legend_show=false, | ||
| ) | ||
| .addTarget(prometheus.target('sum(alertmanager_alerts{%(amQuerySelector)s}) by (%(alertmanagerClusterLabels)s,%(alertmanagerNameLabels)s)' % $._config { amQuerySelector: amQuerySelector }, legendFormat='%(amNameDashboardLegend)s' % $._config { amNameDashboardLegend: amNameDashboardLegend })); | ||
|
|
||
| local alertsRate = | ||
| graphPanel.new( | ||
| 'Alerts receive rate', | ||
| datasource='$datasource', | ||
| span=6, | ||
| format='ops', | ||
| stack=true, | ||
| fill=1, | ||
| legend_show=false, | ||
| ) | ||
| .addTarget(prometheus.target('sum(rate(alertmanager_alerts_received_total{%(amQuerySelector)s}[5m])) by (%(alertmanagerClusterLabels)s,%(alertmanagerNameLabels)s)' % $._config { amQuerySelector: amQuerySelector }, legendFormat='%(amNameDashboardLegend)s Received' % $._config { amNameDashboardLegend: amNameDashboardLegend })) | ||
| .addTarget(prometheus.target('sum(rate(alertmanager_alerts_invalid_total{%(amQuerySelector)s}[5m])) by (%(alertmanagerClusterLabels)s,%(alertmanagerNameLabels)s)' % $._config { amQuerySelector: amQuerySelector }, legendFormat='%(amNameDashboardLegend)s Invalid' % $._config { amNameDashboardLegend: amNameDashboardLegend })); | ||
|
|
||
| local notifications = | ||
| graphPanel.new( | ||
| '$integration: Notifications Send Rate', | ||
| datasource='$datasource', | ||
| format='ops', | ||
| stack=true, | ||
| fill=1, | ||
| legend_show=false, | ||
| repeat='integration' | ||
| ) | ||
| .addTarget(prometheus.target('sum(rate(alertmanager_notifications_total{%(amQuerySelector)s, integration="$integration"}[5m])) by (integration,%(alertmanagerClusterLabels)s,%(alertmanagerNameLabels)s)' % $._config { amQuerySelector: amQuerySelector }, legendFormat='%(amNameDashboardLegend)s Total' % $._config { amNameDashboardLegend: amNameDashboardLegend })) | ||
| .addTarget(prometheus.target('sum(rate(alertmanager_notifications_failed_total{%(amQuerySelector)s, integration="$integration"}[5m])) by (integration,%(alertmanagerClusterLabels)s,%(alertmanagerNameLabels)s)' % $._config { amQuerySelector: amQuerySelector }, legendFormat='%(amNameDashboardLegend)s Failed' % $._config { amNameDashboardLegend: amNameDashboardLegend })); | ||
|
|
||
| local notificationDuration = | ||
| graphPanel.new( | ||
| '$integration: Notification Duration', | ||
| datasource='$datasource', | ||
| format='s', | ||
| stack=false, | ||
| fill=1, | ||
| legend_show=false, | ||
| repeat='integration' | ||
| ) | ||
| .addTarget(prometheus.target( | ||
| ||| | ||
| histogram_quantile(0.99, | ||
| sum(rate(alertmanager_notification_latency_seconds_bucket{%(amQuerySelector)s, integration="$integration"}[5m])) by (le,%(alertmanagerClusterLabels)s,%(alertmanagerNameLabels)s) | ||
| ) | ||
| ||| % $._config { amQuerySelector: amQuerySelector }, legendFormat='%(amNameDashboardLegend)s 99th Percentile' % $._config { amNameDashboardLegend: amNameDashboardLegend } | ||
| )) | ||
| .addTarget(prometheus.target( | ||
| ||| | ||
| histogram_quantile(0.50, | ||
| sum(rate(alertmanager_notification_latency_seconds_bucket{%(amQuerySelector)s, integration="$integration"}[5m])) by (le,%(alertmanagerClusterLabels)s,%(alertmanagerNameLabels)s) | ||
| ) | ||
| ||| % $._config { amQuerySelector: amQuerySelector }, legendFormat='%(amNameDashboardLegend)s Median' % $._config { amNameDashboardLegend: amNameDashboardLegend } | ||
| )) | ||
| .addTarget(prometheus.target( | ||
| ||| | ||
| sum(rate(alertmanager_notification_latency_seconds_sum{%(amQuerySelector)s, integration="$integration"}[5m])) by (%(alertmanagerClusterLabels)s,%(alertmanagerNameLabels)s) | ||
| / | ||
| sum(rate(alertmanager_notification_latency_seconds_count{%(amQuerySelector)s, integration="$integration"}[5m])) by (%(alertmanagerClusterLabels)s,%(alertmanagerNameLabels)s) | ||
| ||| % $._config { amQuerySelector: amQuerySelector }, legendFormat='%(amNameDashboardLegend)s Average' % $._config { amNameDashboardLegend: amNameDashboardLegend } | ||
| )); | ||
|
|
||
| dashboard.new( | ||
| '%sOverview' % $._config.dashboardNamePrefix, | ||
| time_from='now-1h', | ||
| tags=($._config.dashboardTags), | ||
| timezone='utc', | ||
| refresh='30s', | ||
| graphTooltip='shared_crosshair', | ||
| uid='alertmanager-overview' | ||
| ) | ||
| .addTemplate( | ||
| { | ||
| current: { | ||
| text: 'Prometheus', | ||
| value: 'Prometheus', | ||
| }, | ||
| hide: 0, | ||
| label: null, | ||
| name: 'datasource', | ||
| options: [], | ||
| query: 'prometheus', | ||
| refresh: 1, | ||
| regex: '', | ||
| type: 'datasource', | ||
| }, | ||
| ) | ||
| .addTemplates(alertmanagerClusterSelectorTemplates) | ||
| .addTemplate(integrationTemplate) | ||
| .addRow( | ||
| row.new('Alerts') | ||
| .addPanel(alerts) | ||
| .addPanel(alertsRate) | ||
| ) | ||
| .addRow( | ||
| row.new('Notifications') | ||
| .addPanel(notifications) | ||
| .addPanel(notificationDuration) | ||
| ), | ||
| }, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "version": 1, | ||
| "dependencies": [ | ||
| { | ||
| "source": { | ||
| "git": { | ||
| "remote": "https://github.com/grafana/grafonnet-lib.git", | ||
| "subdir": "grafonnet" | ||
| } | ||
| }, | ||
| "version": "master" | ||
| } | ||
| ], | ||
| "legacyImports": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| { | ||
| "version": 1, | ||
| "dependencies": [ | ||
| { | ||
| "source": { | ||
| "git": { | ||
| "remote": "https://github.com/grafana/grafonnet-lib.git", | ||
| "subdir": "grafonnet" | ||
| } | ||
| }, | ||
| "version": "55cf4ee53ced2b6d3ce96ecce9fb813b4465be98", | ||
| "sum": "4/sUV0Kk+o8I+wlYxL9R6EPhL/NiLfYHk+NXlU64RUk=" | ||
| } | ||
| ], | ||
| "legacyImports": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| (import 'config.libsonnet') + | ||
| (import 'alerts.libsonnet') | ||
| (import 'alerts.libsonnet') + | ||
| (import 'dashboards.libsonnet') |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.