apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: dns
  namespace: openshift-dns-operator
  labels:
    role: alert-rules
spec:
  groups:
    - name: openshift-dns.rules
      rules:
      - alert: CoreDNSPanicking
        expr: increase(coredns_panic_count_total[10m]) > 0
        for: 5m
        labels:
          severity: warning
        annotations:
          message: "{{ $value }} CoreDNS panics observed on {{ $labels.instance }}"
      - alert: CoreDNSHealthCheckSlow
        expr: histogram_quantile(.95, sum(rate(coredns_health_request_duration_seconds_bucket[5m])) by (instance, le)) > 10
        for: 5m
        labels:
          severity: warning
        annotations:
          message: "CoreDNS Health Checks are slowing down (instance {{ $labels.instance }})"
      - alert: CoreDNSErrorsHigh
        expr: |
          (sum(rate(coredns_dns_response_rcode_count_total{rcode="SERVFAIL"}[5m]))
            /
          sum(rate(coredns_dns_response_rcode_count_total[5m])))
          > 0.01
        for: 5m
        labels:
          severity: warning
        annotations:
          message: "CoreDNS is returning SERVFAIL for {{ $value | humanizePercentage }} of requests."
