---
#==============================================================#
# File      :   agent.yml
# Ctime     :   2022-11-09
# Mtime     :   2024-08-08
# Desc      :   Agent Rules
# Path      :   /infra/rules/agent.yml
# License   :   Apache-2.0 @ https://pigsty.io/docs/about/license/
# Copyright :   2018-2026  Ruohang Feng / Vonng (rh@vonng.com)
#==============================================================#

groups:

  - name: agent-rules
    rules:

      # NODE
      - record: node_up
        expr: up{instance=~".*:{{ node_exporter_port|default('9100') }}"}

      - record: haproxy_up
        expr: up{instance=~".*:{{ haproxy_exporter_port|default('9101') }}"}

      - record: keepalived_exporter_up
        expr: up{instance=~".*:{{ vip_exporter_port|default('9650') }}"}

      - record: docker_up
        expr: up{instance=~".*:{{ docker_exporter_port|default('9323') }}"}

      - record: vector_up
        expr: up{instance=~".*:{{ vector_port|default('9598') }}"}

      # ETCD
      - record: etcd_up
        expr: up{job="etcd"}

      # MINIO
      - record: minio_up
        expr: up{job="minio"}

      # PGSQL
      - record: pg_exporter_agent_up
        expr: up{instance=~".*:{{ pg_exporter_port|default('9630') }}"}

      - record: pgbouncer_exporter_agent_up
        expr: up{instance=~".*:{{ pgbouncer_exporter_port|default('9631') }}"}

      - record: pgbackrest_exporter_agent_up
        expr: up{instance=~".*:{{ pgbackrest_exporter_port|default('9854') }}"}

      - record: patroni_up
        expr: up{instance=~".*:{{ patroni_port|default('8008') }}"}

      # MONGO
      - record: mongo_up
        expr: up{job="mongo"}

      # MYSQL
      - record: mysql_exporter_up
        expr: up{job="mysql"}

      # KAFKA
      - record: kafka_exporter_up
        expr: up{job="kafka"}
...