---
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  annotations:
    exclude.release.openshift.io/internal-openshift-hosted: "true"
  creationTimestamp: "2022-03-08T10:14:07Z"
  generation: 1
  labels:
    prometheus: k8s
    role: alert-rules
  managedFields:
  - apiVersion: monitoring.coreos.com/v1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .: {}
          f:exclude.release.openshift.io/internal-openshift-hosted: {}
        f:labels:
          .: {}
          f:prometheus: {}
          f:role: {}
      f:spec:
        .: {}
        f:groups: {}
    manager: cluster-version-operator
    operation: Update
    time: "2022-03-08T10:14:07Z"
  name: machine-api-operator-prometheus-rules
  namespace: openshift-machine-api
  resourceVersion: "1529"
  selfLink: /apis/monitoring.coreos.com/v1/namespaces/openshift-machine-api/prometheusrules/machine-api-operator-prometheus-rules
  uid: 97218a7e-c96d-4650-8cc3-1b9c94d6be99
spec:
  groups:
  - name: machine-without-valid-node-ref
    rules:
    - alert: MachineWithoutValidNode
      annotations:
        message: machine {{ $labels.name }} does not have valid node reference
      expr: |
        (mapi_machine_created_timestamp_seconds unless on(node) kube_node_info) > 0
      for: 60m
      labels:
        severity: warning
  - name: machine-with-no-running-phase
    rules:
    - alert: MachineWithNoRunningPhase
      annotations:
        message: 'machine {{ $labels.name }} is in phase: {{ $labels.phase }}'
      expr: |
        (mapi_machine_created_timestamp_seconds{phase!="Running"}) > 0
      for: 60m
      labels:
        severity: warning
  - name: machine-api-operator-metrics-collector-up
    rules:
    - alert: MachineAPIOperatorMetricsCollectionFailing
      annotations:
        message: 'machine api operator metrics collection is failing. For more details:  oc logs <machine-api-operator-pod-name> -n openshift-machine-api'
      expr: |
        mapi_mao_collector_up == 0
      for: 5m
      labels:
        severity: critical
  - name: machine-api-operator-down
    rules:
    - alert: MachineAPIOperatorDown
      annotations:
        message: machine api operator is down
      expr: |
        absent(up{job="machine-api-operator"} == 1)
      for: 5m
      labels:
        severity: critical
