groups:
  - name: monad-node
    rules:
      - alert: MonadServiceDown
        expr: monad_service_up == 0
        for: 2m
        labels:
          severity: critical
        annotations:
          summary: "Monad service down"
          description: "Service {{ $labels.service }} is down on the Monad node."

      - alert: MonadRPCDown
        expr: monad_rpc_up == 0
        for: 2m
        labels:
          severity: critical
        annotations:
          summary: "Monad RPC is down"
          description: "Local Monad RPC checks are failing."

      - alert: MonadRPCSyncing
        expr: monad_rpc_syncing == 1
        for: 10m
        labels:
          severity: warning
        annotations:
          summary: "Monad RPC reports syncing"
          description: "The local RPC endpoint reports syncing for more than 10 minutes."

      - alert: MonadOTelMetricsDown
        expr: monad_otel_metrics_up == 0
        for: 2m
        labels:
          severity: warning
        annotations:
          summary: "Monad OTEL metrics are unavailable"
          description: "The local OTEL metrics endpoint is not responding."

      - alert: MonadNodeExporterTargetDown
        expr: up{job="node_exporter"} == 0
        for: 2m
        labels:
          severity: critical
        annotations:
          summary: "node_exporter target down"
          description: "Prometheus cannot scrape node_exporter on the Monad host."

      - alert: MonadOTelTargetDown
        expr: up{job="monad_otel"} == 0
        for: 2m
        labels:
          severity: warning
        annotations:
          summary: "OTEL scrape target down"
          description: "Prometheus cannot scrape the Monad OTEL endpoint."

      - alert: MonadSSHListenerDown
        expr: monad_ssh_listener_up == 0
        for: 2m
        labels:
          severity: critical
        annotations:
          summary: "SSH listener missing"
          description: "The local SSH listener on port 22 is not present."

      - alert: MonadP2PTCPListenerDown
        expr: monad_p2p_tcp_listener_up == 0
        for: 2m
        labels:
          severity: critical
        annotations:
          summary: "Monad P2P TCP listener missing"
          description: "The local Monad TCP listener on port 8000 is not present."

      - alert: MonadP2PUDPListenerDown
        expr: monad_p2p_udp_listener_up == 0
        for: 2m
        labels:
          severity: critical
        annotations:
          summary: "Monad P2P UDP listener missing"
          description: "One or more required Monad UDP listeners are missing."

      - alert: MonadTrieDBSymlinkBroken
        expr: monad_triedb_symlink_ok == 0
        for: 2m
        labels:
          severity: critical
        annotations:
          summary: "TrieDB symlink mismatch"
          description: "The /dev/triedb symlink no longer resolves to the expected TrieDB device."

      - alert: MonadRootDiskLow
        expr: monad_root_free_bytes < 21474836480
        for: 10m
        labels:
          severity: warning
        annotations:
          summary: "Low free space on root disk"
          description: "Root filesystem free space dropped below 20 GiB."
