Monitoring
The metrics that matter, the alerts, and the dashboard
Every SeaweedFS component serves Prometheus metrics on its -metricsPort.
The Prometheus stack from the
Prometheus & Grafana module scrapes all eight:
The metrics that matter
| Metric | Means |
|---|---|
SeaweedFS_master_is_leader | 1 on the leader. Every component exports it; only the leader says 1 |
SeaweedFS_master_volume_layout_writable{collection} | Writable volumes per bucket. 0 = writes to it fail |
SeaweedFS_master_under_replicated_volumes{collection} | Volumes missing copies |
SeaweedFS_volumeServer_resource{type="avail"} and {type="all"} | Disk space per volume server |
SeaweedFS_volumeServer_file_read_failures, _write_failures | Disk-level errors |
SeaweedFS_s3_request_total{bucket,code,type} | S3 requests by bucket, status and operation |
SeaweedFS_s3_request_seconds_bucket | S3 latency histogram |
SeaweedFS_s3_bucket_size_bytes, _object_count | Per-bucket usage |
Three traps in these metrics
Every component exports the master gauges. Volume servers and the
filer report SeaweedFS_master_is_leader 0, and followers keep the last
values they computed while they were leader. A follower that led an hour
ago still reports 16 under-replicated volumes forever. Every alert on
master gauges filters to the current leader:
... and on (instance) SeaweedFS_master_is_leader == 1.
Master gauges are recomputed about every 5 minutes, on the leader's
volume-growth pass, not on each scrape. After a server came back, the
under-replicated count stayed at 16 for about 5 more minutes. Alerts on
them need a for: longer than that.
avail and all differ in their type label, so
resource{type="avail"} / resource{type="all"} matches nothing and
returns an empty result. The first version of this module's disk alert
and two dashboard panels had exactly that bug: an alert that could never
fire, and panels that stayed empty. It was caught by checking the query
against live data and is fixed with / ignoring (type). The module's
rule tests now cover it. An alert you haven't seen fire is a guess.
S3 request metrics also appear only after the first request: a freshly
started gateway has no SeaweedFS_s3_request_total series at all.
Alerts
SeaweedFSNoMasterLeader uses != 1 on purpose: 0 means no leader (no
new writes), and 2 would mean a split brain, which Raft should never allow
but you'd want to know about immediately.
The dashboard
Grafana provisions SeaweedFS Overview from
grafana/dashboards/Storage/seaweedfs-overview.json:
- Top row: volume servers up, leader count, under-replicated volumes, S3 requests per second, S3 error ratio, lowest free disk.
- S3 gateway: requests by operation and by bucket, p99 latency by operation, bytes in and out.
- Cluster: writable volumes per bucket, free disk per server, read and write failures, leader changes, bucket sizes and object counts.
Also watch from the outside: a probe that PUTs, GETs and DELETEs a small object every minute with a real application identity (the Blackbox exporter can't sign S3 requests, so this is a small script). It catches what the internal metrics don't: expired TLS certificates, a broken load balancer, wrong keys after a rotation.
Lab
- Open the dashboard and run
s3_basics.pya few times. Which operation type is slowest at p99? - Stop one volume server and watch which panels and alerts change, and how long each takes.
- Stop the leader master and find the leader change on the dashboard.