
{{- $Values := (.helm).Values | default .Values }}
{{- $runbookUrl := ($Values.defaultRules).runbookUrl | default "https://runbooks.prometheus-operator.dev/runbooks" }}
{{- $clusterLabel := ($Values.global).clusterLabel | default "cluster" }}
{{- $additionalGroupByLabels := append $Values.defaultRules.additionalGroupByLabels $clusterLabel }}
{{- $groupLabels := join "," (uniq $additionalGroupByLabels) }}
{{- $grafanaAddr := include "vm-k8s-stack.grafana.addr" . }}
name: node-network
rules:
- alert: NodeNetworkInterfaceFlapping
  expr: {{ printf "changes(node_network_up{job=\"%s\",device!~\"veth.+\"}[2m]) > 2" (include "vm-k8s-stack.nodeExporter.name" .) }}
  annotations:
    description: Network interface "{{`{{`}} $labels.device {{`}}`}}" changing its up status often on node-exporter {{`{{`}} $labels.namespace {{`}}`}}/{{`{{`}} $labels.pod {{`}}`}}
    runbook_url: {{ $runbookUrl }}/general/nodenetworkinterfaceflapping
    summary: Network interface is often changing its status
  condition: true
  for: 2m
  labels:
    severity: warning
condition: true
