{{- $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 "," $additionalGroupByLabels }}
{{- $grafanaHost := ternary (index (($Values.grafana).ingress).hosts 0) (($Values.external).grafana).host ($Values.grafana).enabled }}
condition: '{{ true }}'
name: node-network
rules:
- alert: NodeNetworkInterfaceFlapping
  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 }}'
  expr: changes(node_network_up{job="node-exporter",device!~"veth.+"}[2m]) > 2
  for: 2m
  labels:
    severity: warning
