# Source: tidb-cluster/templates/monitor-configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: external-config
  labels:
    app.kubernetes.io/name: tidb-cluster
    app.kubernetes.io/instance: test
    app.kubernetes.io/component: monitor
data:
  test.rules.yml: |-
    groups:
      - name: test.rules
        rules:
          - alert: PD_cluster_offline_tikv_nums
            expr: (sum ( pd_cluster_status{type="store_down_count"} ) by (instance) > 0) and
              (sum(etcd_server_is_leader) by (instance) > 1000000)
            for: 1m
            labels:
              env: Cluster
              expr: (sum ( pd_cluster_status{type="store_down_count"} ) by (instance) > 0)
                and (sum(etcd_server_is_leader) by (instance) > 0)
              level: emergency
            annotations:
              description: 'cluster: Cluster, instance: {{ $labels.instance }}, values:{{
            $value }}'
              summary: PD_cluster_offline_tikv_nums
              value: '{{ $value }}'
  app.rules.yml: |-
    groups:
      - name: app.rules
        rules:
          - alert: PD_cluster_offline_tikv_nums
            expr: (sum ( pd_cluster_status{type="store_down_count"} ) by (instance) > 0) and
              (sum(etcd_server_is_leader) by (instance) > 1000000)
            for: 1m
            labels:
              env: Cluster
              expr: (sum ( pd_cluster_status{type="store_down_count"} ) by (instance) > 0)
                and (sum(etcd_server_is_leader) by (instance) > 0)
              level: emergency
            annotations:
              description: 'cluster: Cluster, instance: {{ $labels.instance }}, values:{{
            $value }}'
              summary: PD_cluster_offline_tikv_nums
              value: '{{ $value }}'
  cw.rules.yml: |-
    groups:
      - name: cw.rules
        rules:
          - alert: PD_cluster_offline_tikv_nums
            expr: (sum ( pd_cluster_status{type="store_down_count"} ) by (instance) > 0) and
              (sum(etcd_server_is_leader) by (instance) > 1000000)
            for: 1m
            labels:
              env: Cluster
              expr: (sum ( pd_cluster_status{type="store_down_count"} ) by (instance) > 0)
                and (sum(etcd_server_is_leader) by (instance) > 0)
              level: emergency
            annotations:
              description: 'cluster: Cluster, instance: {{ $labels.instance }}, values:{{
            $value }}'
              summary: PD_cluster_offline_tikv_nums
              value: '{{ $value }}'
