CephLXXIV · ObservabilityObservability
OSD state metrics
What you'll learn
- Express OSD state as monitoring signals
- Alert on the combinations that matter
- Distinguish expected from unexpected states
- Track state transitions over time
Prerequisites
None — start here.
Verified against Ceph Tentacle 20.2.x · Ceph Squid 19.2.x (supported previous) · cephadm matches the verified Ceph release · podman 4.x · csi-rbd and csi-cephfs current · RBD / CephFS / RGW current (matches Ceph release) · Linux kernel 5.15+ (5.10 minimum) · Ubuntu 24.04 LTS (Ceph host baseline) · Debian 12 (Bookworm) (Ceph host baseline) · Rocky Linux / RHEL / AlmaLinux 9.x (Ceph host baseline) · Proxmox VE 9.x (cross-course integration) · Kubernetes 1.31+ (cross-course integration) · 2026-08-18
Why this matters in production
up/in are independent, and the four combinations mean different
things. Alerting on “OSD down” without distinguishing them produces pages
for planned maintenance and silence for real problems.
The metrics
ceph_osd_up{ceph_daemon="osd.12"} # 1 if up
ceph_osd_in{ceph_daemon="osd.12"} # 1 if in
ceph_osd_weight
ceph_osd_metadata # labels: hostname, device class
ceph_osd_numpg
The four combinations
| up | in | Meaning | Alert |
|---|---|---|---|
| 1 | 1 | normal | no |
| 0 | 1 | failed recently; data not yet re-replicated | page |
| 1 | 0 | draining or newly added | no |
| 0 | 0 | failed and drained, or removed | ticket |
# the dangerous one: down but still in
count(ceph_osd_up == 0 and ceph_osd_in == 1)
- alert: CephOSDDownAndIn
expr: (ceph_osd_up == 0) and (ceph_osd_in == 1)
for: 5m
labels: { severity: page }
annotations:
summary: "{{ $labels.ceph_daemon }} is down and still in — data is under-replicated"
up=0, in=1 is the state where PGs are degraded and recovery has not yet
started or completed. It is the one that warrants immediate attention.
Distinguishing expected states
# draining is expected during maintenance
ceph_osd_up == 1 and ceph_osd_in == 0
An OSD being drained is up=1, in=0 and requires no alert. An OSD that
has been in that state for days, however, is an unfinished operation:
- alert: CephOSDOutTooLong
expr: (ceph_osd_in == 0) and (ceph_osd_up == 1)
for: 48h
labels: { severity: ticket }
annotations:
summary: "{{ $labels.ceph_daemon }} has been out for 48h — unfinished drain?"
Counting rather than per-OSD alerting
On a large cluster, per-OSD alerts produce a storm during a host failure:
- alert: CephOSDsDown
expr: count(ceph_osd_up == 0 and ceph_osd_in == 1) > 0
for: 5m
labels: { severity: page }
annotations:
summary: "{{ $value }} OSD(s) down and in"
- alert: CephHostOSDsDown
expr: |
count by (hostname) (
(ceph_osd_up == 0) * on(ceph_daemon) group_left(hostname) ceph_osd_metadata
) >= 4
for: 5m
labels: { severity: page }
annotations:
summary: "{{ $value }} OSDs down on {{ $labels.hostname }} — likely host failure"
The second is more useful than twelve individual alerts: it names the host, which is the actual failure.
Tracking transitions
changes(ceph_osd_up[1h]) > 4
An OSD transitioning repeatedly is flapping, which is a different problem from one that is simply down — usually network instability or a failing device rather than a clean failure.
Quiz
Knowledge check · 4 questions
Q1. Which OSD state combination warrants an immediate page?
Q2. One alert grouped by hostname can describe a twelve-OSD host failure more accurately than twelve per-OSD alerts do.
Q3. Design OSD alerting for a large cluster.
A 500-OSD cluster alerts per OSD on ceph_osd_up == 0. A recent host failure produced 24 simultaneous pages and the responder spent the first ten minutes correlating them.
Q4. What distinguishes a flapping OSD from one that is simply down, and why does it matter?
Passing score: 75%. Answers are checked in this browser.
Production discipline
Page on up=0, in=1 specifically — that is the window where
redundancy is reduced and recovery has not started. Aggregate by hostname
using ceph_osd_metadata so a host failure produces one accurate alert
rather than one per OSD.
Cross-course references
- Kubernetes: node-level alerts beat per-pod alerts for the same correlation reason
- Linux: distinguishing a failed device from a flapping one changes the remedy