# k8s/longhorn/longhorn-servicemonitor.yaml
# Longhorn is deployed via raw manifest (cluster-config/longhorn_bootstrap.sh), not
# Helm, so there's no chart values toggle for metrics — the manager already exposes
# them on the existing longhorn-backend service (port 9500); this just wires Prometheus
# to it. longhorn_volume_robustness is the availability signal (degraded/faulted).
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: longhorn-manager
  namespace: longhorn-system
  labels:
    app: longhorn-manager
spec:
  selector:
    matchLabels:
      app: longhorn-manager
  namespaceSelector:
    matchNames:
      - longhorn-system
  endpoints:
    - port: manager
      interval: 30s
      scrapeTimeout: 10s
