-
Notifications
You must be signed in to change notification settings - Fork 307
Add some examples of per-queue alerts/dashboards #865
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 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e111f80
Add some examples of per-queue alerts/dashboards
binarin 209e682
Fix typo
binarin fa21cb0
Fix cluster name in per-queue alert examples
binarin 7db5cec
Use cleanly exported grafana dashboard definition
binarin aff2805
Fix queue selector on a per-queue dashboard
binarin 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,277 @@ | ||
| --- | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: rabbitmq-queue-grafana-dashboard | ||
| labels: | ||
| grafana_dashboard: "1" | ||
| data: | ||
| rabbitmq-queue-grafana-dashboard.json: |- | ||
| { | ||
| "annotations": { | ||
| "list": [ | ||
| { | ||
| "builtIn": 1, | ||
| "datasource": "-- Grafana --", | ||
| "enable": true, | ||
| "hide": true, | ||
| "iconColor": "rgba(0, 211, 255, 1)", | ||
| "name": "Annotations & Alerts", | ||
| "type": "dashboard" | ||
| } | ||
| ] | ||
| }, | ||
| "editable": true, | ||
| "gnetId": null, | ||
| "graphTooltip": 0, | ||
| "id": 31, | ||
| "iteration": 1633436610573, | ||
| "links": [], | ||
| "panels": [ | ||
| { | ||
| "datasource": null, | ||
| "fieldConfig": { | ||
| "defaults": { | ||
| "color": { | ||
| "mode": "palette-classic" | ||
| }, | ||
| "custom": { | ||
| "axisLabel": "Messages", | ||
| "axisPlacement": "left", | ||
| "axisSoftMin": 0, | ||
| "barAlignment": 0, | ||
| "drawStyle": "line", | ||
| "fillOpacity": 0, | ||
| "gradientMode": "none", | ||
| "hideFrom": { | ||
| "legend": false, | ||
| "tooltip": false, | ||
| "viz": false | ||
| }, | ||
| "lineInterpolation": "linear", | ||
| "lineWidth": 1, | ||
| "pointSize": 5, | ||
| "scaleDistribution": { | ||
| "type": "linear" | ||
| }, | ||
| "showPoints": "auto", | ||
| "spanNulls": false, | ||
| "stacking": { | ||
| "group": "A", | ||
| "mode": "none" | ||
| }, | ||
| "thresholdsStyle": { | ||
| "mode": "off" | ||
| } | ||
| }, | ||
| "mappings": [], | ||
| "thresholds": { | ||
| "mode": "absolute", | ||
| "steps": [ | ||
| { | ||
| "color": "green", | ||
| "value": null | ||
| }, | ||
| { | ||
| "color": "red", | ||
| "value": 80 | ||
| } | ||
| ] | ||
| } | ||
| }, | ||
| "overrides": [ | ||
| { | ||
| "matcher": { | ||
| "id": "byName", | ||
| "options": "Consumers" | ||
| }, | ||
| "properties": [ | ||
| { | ||
| "id": "custom.axisPlacement", | ||
| "value": "right" | ||
| }, | ||
| { | ||
| "id": "unit", | ||
| "value": "prefix:" | ||
| }, | ||
| { | ||
| "id": "custom.axisLabel", | ||
| "value": "Consumers" | ||
| } | ||
| ] | ||
| }, | ||
| { | ||
| "matcher": { | ||
| "id": "byName", | ||
| "options": "Messages" | ||
| }, | ||
| "properties": [ | ||
| { | ||
| "id": "custom.drawStyle", | ||
| "value": "line" | ||
| }, | ||
| { | ||
| "id": "custom.fillOpacity", | ||
| "value": 0 | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "gridPos": { | ||
| "h": 17, | ||
| "w": 11, | ||
| "x": 0, | ||
| "y": 0 | ||
| }, | ||
| "id": 2, | ||
| "options": { | ||
| "legend": { | ||
| "calcs": [], | ||
| "displayMode": "list", | ||
| "placement": "bottom" | ||
| }, | ||
| "tooltip": { | ||
| "mode": "single" | ||
| } | ||
| }, | ||
| "targets": [ | ||
| { | ||
| "exemplar": true, | ||
| "expr": "(rabbitmq_detailed_queue_messages{namespace=\"$namespace\", queue=\"$queue\"} * on (instance, job) rabbitmq_identity_info{namespace=\"$namespace\",rabbitmq_cluster=\"$rabbitmq_cluster\"})", | ||
| "interval": "", | ||
| "legendFormat": "Messages", | ||
| "refId": "A" | ||
| }, | ||
| { | ||
| "exemplar": true, | ||
| "expr": "rabbitmq_detailed_queue_consumers{namespace=\"$namespace\", queue=\"$queue\"} * on (instance, job) rabbitmq_identity_info{namespace=\"$namespace\",rabbitmq_cluster=\"$rabbitmq_cluster\"}", | ||
| "hide": false, | ||
| "interval": "", | ||
| "legendFormat": "Consumers", | ||
| "refId": "B" | ||
| } | ||
| ], | ||
| "title": "Queue messages and consumers", | ||
| "type": "timeseries" | ||
| } | ||
| ], | ||
| "refresh": false, | ||
| "schemaVersion": 30, | ||
| "style": "dark", | ||
| "tags": [], | ||
| "templating": { | ||
| "list": [ | ||
| { | ||
| "current": { | ||
| "selected": false, | ||
| "text": "Prometheus", | ||
| "value": "Prometheus" | ||
| }, | ||
| "description": null, | ||
| "error": null, | ||
| "hide": 2, | ||
| "includeAll": false, | ||
| "label": "datasource", | ||
| "multi": false, | ||
| "name": "DS_PROMETHEUS", | ||
| "options": [], | ||
| "query": "prometheus", | ||
| "refresh": 1, | ||
| "regex": "", | ||
| "skipUrlSync": false, | ||
| "type": "datasource" | ||
| }, | ||
| { | ||
| "allValue": null, | ||
| "current": { | ||
| "selected": false, | ||
| "text": "opportunity-92", | ||
| "value": "opportunity-92" | ||
| }, | ||
| "datasource": "${DS_PROMETHEUS}", | ||
| "definition": "label_values(rabbitmq_identity_info, namespace)", | ||
| "description": null, | ||
| "error": null, | ||
| "hide": 0, | ||
| "includeAll": false, | ||
| "label": "Namespace", | ||
| "multi": false, | ||
| "name": "namespace", | ||
| "options": [], | ||
| "query": { | ||
| "query": "label_values(rabbitmq_identity_info, namespace)", | ||
| "refId": "StandardVariableQuery" | ||
| }, | ||
| "refresh": 2, | ||
| "regex": "", | ||
| "skipUrlSync": false, | ||
| "sort": 1, | ||
| "type": "query" | ||
| }, | ||
| { | ||
| "allValue": null, | ||
| "current": { | ||
| "selected": false, | ||
| "text": "rabbitmq", | ||
| "value": "rabbitmq" | ||
| }, | ||
| "datasource": "${DS_PROMETHEUS}", | ||
| "definition": "label_values(rabbitmq_identity_info{namespace=\"$namespace\"}, rabbitmq_cluster)", | ||
| "description": null, | ||
| "error": null, | ||
| "hide": 0, | ||
| "includeAll": false, | ||
| "label": "RabbitMQ Cluster", | ||
| "multi": false, | ||
| "name": "rabbitmq_cluster", | ||
| "options": [], | ||
| "query": { | ||
| "query": "label_values(rabbitmq_identity_info{namespace=\"$namespace\"}, rabbitmq_cluster)", | ||
| "refId": "StandardVariableQuery" | ||
| }, | ||
| "refresh": 2, | ||
| "regex": "", | ||
| "skipUrlSync": false, | ||
| "sort": 1, | ||
| "type": "query" | ||
| }, | ||
| { | ||
| "allValue": null, | ||
| "current": { | ||
| "selected": false, | ||
| "text": "perf-test-1", | ||
| "value": "perf-test-1" | ||
| }, | ||
| "datasource": null, | ||
| "definition": "query_result(rabbitmq_detailed_queue_messages{namespace=\"$namespace\"} * on (instance, job) group_left(rabbitmq_cluster) rabbitmq_identity_info{namespace=\"$namespace\"})", | ||
| "description": null, | ||
| "error": null, | ||
| "hide": 0, | ||
| "includeAll": false, | ||
| "label": "Queue", | ||
| "multi": false, | ||
| "name": "queue", | ||
| "options": [], | ||
| "query": { | ||
| "query": "query_result(rabbitmq_detailed_queue_messages{namespace=\"$namespace\"} * on (instance, job) group_left(rabbitmq_cluster) rabbitmq_identity_info{namespace=\"$namespace\"})", | ||
| "refId": "StandardVariableQuery" | ||
| }, | ||
| "refresh": 2, | ||
| "regex": "/.*queue=\"([^\"]+)\".*/", | ||
| "skipUrlSync": false, | ||
| "sort": 0, | ||
| "type": "query" | ||
| } | ||
| ] | ||
| }, | ||
| "time": { | ||
| "from": "now-6h", | ||
| "to": "now" | ||
| }, | ||
| "timepicker": {}, | ||
| "timezone": "", | ||
| "title": "RabbitMQ-Queue", | ||
| "uid": "j9t8vwH7k", | ||
| "version": 10 | ||
| } | ||
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,5 @@ | ||
| # RabbitMQ per-object rules | ||
|
|
||
| RabbitMQ >= 3.9.7 is required for functioning of these alerts. | ||
|
|
||
| Also they are highly opionated and probably require some tuning before applying, e.g. filtering by specific queue names. | ||
binarin marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
27 changes: 27 additions & 0 deletions
27
observability/prometheus/rules/rabbitmq-per-object/queue-has-no-consumers.yml
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,27 @@ | ||
| --- | ||
| apiVersion: monitoring.coreos.com/v1 | ||
| kind: PrometheusRule | ||
| metadata: | ||
| name: rabbitmq-queue-has-no-consumers | ||
| # If labels are defined in spec.ruleSelector.matchLabels of your deployed Prometheus object, make sure to include them here. | ||
| labels: | ||
| role: alert-rules | ||
| spec: | ||
| groups: | ||
| - name: rabbitmq | ||
| rules: | ||
| - alert: QueueHasNoConsumers | ||
| expr: | | ||
| ((rabbitmq_detailed_queue_consumers{vhost="/", queue=~".*"} == 0) + rabbitmq_detailed_queue_messages) > 0 | ||
| for: 10m | ||
| annotations: | ||
| description: | | ||
| Over the last 10 minutes, non-empty queue `{{ $labels.queue }}` with {{ $value }} messages | ||
| in virtual host `{{ $labels.vhost }}` didn't have any consumers in | ||
| RabbitMQ cluster `{{ $labels.rabbitmq_cluster }}` in namespace `{{ $labels.namespace }}`. | ||
binarin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| summary: | | ||
| Messages are sitting idle in the queue, without any processing. | ||
| This alert is highly application specific (and e.g. doesn't make sense for stream queues). | ||
| labels: | ||
| rulesgroup: rabbitmq | ||
| severity: warning | ||
27 changes: 27 additions & 0 deletions
27
observability/prometheus/rules/rabbitmq-per-object/queue-is-growing.yml
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,27 @@ | ||
| --- | ||
| apiVersion: monitoring.coreos.com/v1 | ||
| kind: PrometheusRule | ||
| metadata: | ||
| name: rabbitmq-queue-is-growing | ||
| # If labels are defined in spec.ruleSelector.matchLabels of your deployed Prometheus object, make sure to include them here. | ||
| labels: | ||
| role: alert-rules | ||
| spec: | ||
| groups: | ||
| - name: rabbitmq | ||
| rules: | ||
| - alert: QueueIsGrowing | ||
| # `> 1` because of floating point rounding errors | ||
| expr: | | ||
| avg_over_time(rabbitmq_detailed_queue_messages[10m]) - avg_over_time(rabbitmq_detailed_queue_messages[10m] offset 1m) > 1 | ||
| for: 10m | ||
| annotations: | ||
| description: | | ||
| Over the last 10 minutes, queue `{{ $labels.queue }}` in virtual host `{{ $labels.vhost }}` | ||
| was growing. 10 minute moving average has grown by {{ $value }}. | ||
| This happens in RabbitMQ cluster `{{ $labels.rabbitmq_cluster }}` in namespace `{{ $labels.namespace }}`. | ||
| summary: | | ||
| Queue size is steadily growing over time. | ||
| labels: | ||
| rulesgroup: rabbitmq | ||
| severity: warning |
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.