feat(monitoring): add VM packets drop alert#3889
Open
Yaguang Tang (yaguangtang) wants to merge 1 commit intomainfrom
Open
feat(monitoring): add VM packets drop alert#3889Yaguang Tang (yaguangtang) wants to merge 1 commit intomainfrom
Yaguang Tang (yaguangtang) wants to merge 1 commit intomainfrom
Conversation
Signed-off-by: Yaguang Tang <[email protected]>
9df2fe2 to
282184c
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces Prometheus alerting for libvirt virtual machine interface packet drops, wiring the new alert rules into the kube-prometheus-stack jsonnet mixin system and documenting the new alerts.
Changes:
- Add two new alerts for VM interface receive/transmit packet drops (P3) under a new
libvirtalert group. - Add promtool rule tests covering negative/positive cases for both alerts.
- Add operator documentation + a release note describing the new alerts.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| roles/kube_prometheus_stack/files/jsonnet/tests.yml | Adds promtool test cases for the new libvirt drop alerts. |
| roles/kube_prometheus_stack/files/jsonnet/mixins.libsonnet | Registers the new libvirt jsonnet mixin so its alert group is rendered. |
| roles/kube_prometheus_stack/files/jsonnet/libvirt.libsonnet | Defines LibvirtDomainInterfaceReceiveDrops and LibvirtDomainInterfaceTransmitDrops alerts. |
| releasenotes/notes/add-libvirt-interface-drop-alerts-5a7e1d9552a1a38e.yaml | Adds a feature release note for the new alerts. |
| doc/source/admin/monitoring.rst | Adds runbook-style documentation entries for both new alerts. |
8a29afd to
282184c
Compare
Comment on lines
+1
to
+26
| { | ||
| prometheusAlerts+: { | ||
| groups+: [ | ||
| { | ||
| name: 'libvirt', | ||
| rules: | ||
| local dropAlert(direction) = | ||
| local capitalized = std.asciiUpper(std.substr(direction, 0, 1)) + std.substr(direction, 1, std.length(direction) - 1); | ||
| local alertName = 'LibvirtDomainInterface' + capitalized + 'Drops'; | ||
| { | ||
| alert: alertName, | ||
| expr: 'increase(libvirt_domain_interface_stats_' + direction + '_drops_total[5m]) > 0', | ||
| 'for': '5m', | ||
| labels: { | ||
| severity: 'P3', | ||
| }, | ||
| annotations: { | ||
| summary: 'Libvirt: virtual machine network interface dropping ' + direction + ' packets', | ||
| description: 'Domain {{ $labels.domain }} interface {{ $labels.target_device }} has dropped {{ $value }} ' + direction + ' packets in the last 5 minutes. Sustained packet drops can degrade tenant connectivity. Normal behavior is zero drops.', | ||
| runbook_url: 'https://vexxhost.github.io/atmosphere/admin/monitoring.html#' + std.asciiLower(alertName), | ||
| }, | ||
| }; | ||
| [ | ||
| dropAlert('receive'), | ||
| dropAlert('transmit'), | ||
| ], |
There was a problem hiding this comment.
For consistency with the other custom alert files, consider defining helper locals at file scope and keeping rules as a plain array literal. For example, coredns.libsonnet and nginx.libsonnet define locals at the top of the file and use rules: [ ... ], which is easier to scan and keeps alert rule objects more uniform.
Suggested change
| { | |
| prometheusAlerts+: { | |
| groups+: [ | |
| { | |
| name: 'libvirt', | |
| rules: | |
| local dropAlert(direction) = | |
| local capitalized = std.asciiUpper(std.substr(direction, 0, 1)) + std.substr(direction, 1, std.length(direction) - 1); | |
| local alertName = 'LibvirtDomainInterface' + capitalized + 'Drops'; | |
| { | |
| alert: alertName, | |
| expr: 'increase(libvirt_domain_interface_stats_' + direction + '_drops_total[5m]) > 0', | |
| 'for': '5m', | |
| labels: { | |
| severity: 'P3', | |
| }, | |
| annotations: { | |
| summary: 'Libvirt: virtual machine network interface dropping ' + direction + ' packets', | |
| description: 'Domain {{ $labels.domain }} interface {{ $labels.target_device }} has dropped {{ $value }} ' + direction + ' packets in the last 5 minutes. Sustained packet drops can degrade tenant connectivity. Normal behavior is zero drops.', | |
| runbook_url: 'https://vexxhost.github.io/atmosphere/admin/monitoring.html#' + std.asciiLower(alertName), | |
| }, | |
| }; | |
| [ | |
| dropAlert('receive'), | |
| dropAlert('transmit'), | |
| ], | |
| local dropAlert(direction) = | |
| local capitalized = std.asciiUpper(std.substr(direction, 0, 1)) + std.substr(direction, 1, std.length(direction) - 1); | |
| local alertName = 'LibvirtDomainInterface' + capitalized + 'Drops'; | |
| { | |
| alert: alertName, | |
| expr: 'increase(libvirt_domain_interface_stats_' + direction + '_drops_total[5m]) > 0', | |
| 'for': '5m', | |
| labels: { | |
| severity: 'P3', | |
| }, | |
| annotations: { | |
| summary: 'Libvirt: virtual machine network interface dropping ' + direction + ' packets', | |
| description: 'Domain {{ $labels.domain }} interface {{ $labels.target_device }} has dropped {{ $value }} ' + direction + ' packets in the last 5 minutes. Sustained packet drops can degrade tenant connectivity. Normal behavior is zero drops.', | |
| runbook_url: 'https://vexxhost.github.io/atmosphere/admin/monitoring.html#' + std.asciiLower(alertName), | |
| }, | |
| }; | |
| { | |
| prometheusAlerts+: { | |
| groups+: [ | |
| { | |
| name: 'libvirt', | |
| rules: [ | |
| dropAlert('receive'), | |
| dropAlert('transmit'), | |
| ], |
5 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.