Skip to content

Commit 4e65c6b

Browse files
authored
docs: add YAML spec and health checks documentation (#105)
- Add Declarative configuration format section to README with CephConfig and CephOSDConfig kind descriptions and field tables - Add Health checks section documenting all 14 indicators with thresholds and descriptions - Update examples/config.yaml with multi-doc example including CephOSDConfig and inline comments - Fix copy-paste bug in UncleanPGs GoDoc comment --------- Signed-off-by: Igor Shishkin <me@teran.dev>
1 parent d134fd2 commit 4e65c6b

3 files changed

Lines changed: 175 additions & 21 deletions

File tree

README.md

Lines changed: 150 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,20 @@
55
[![Go Reference](https://pkg.go.dev/badge/github.com/runityru/cephctl.svg)](https://pkg.go.dev/github.com/runityru/cephctl)
66

77
Small utility to control Ceph cluster configuration just like any other declarative
8-
configuration
8+
configuration
99

1010
## Main features
1111

1212
* Easy-to-use healthcheck which may contain checks against status & configuration
13-
and indicate some some not trivial issues
13+
and indicate some some not trivial issues
1414
* Declarative configuration support which is apply only if needed
1515
* Diff configuration: check what the difference between currently running configuration
16-
and desired or migrated from other cluster
16+
and desired or migrated from other cluster
1717

1818
## Usage
1919

2020
<!-- markdownlint-disable MD013 -->
21+
2122
```shell
2223
$ ./cephctl
2324
usage: cephctl [<flags>] <command> [<args> ...]
@@ -56,6 +57,7 @@ version
5657
Print version and exit
5758

5859
```
60+
5961
<!-- markdownlint-enable MD013 -->
6062

6163
## How it works
@@ -64,20 +66,148 @@ Cephctl uses native Ceph CLIs to work with cluster configuration so it's require
6466
to have Ceph binaries w/ configured `ceph.conf`. Alternatively it's possible
6567
to adjust `ceph` binary path to access ceph in container and/or remote machine.
6668

69+
## Declarative configuration format
70+
71+
cephctl uses a declarative YAML specification to describe the desired Ceph cluster
72+
configuration. The file can contain one or more configuration documents separated
73+
by `---`.
74+
75+
Each document has two mandatory fields:
76+
77+
* `kind` — defines the type of configuration section (see below)
78+
* `spec` — the actual configuration payload
79+
80+
### kind: CephConfig
81+
82+
Maps to `ceph config set` commands. The spec is a nested map of configuration
83+
sections and their key-value pairs:
84+
85+
```yaml
86+
kind: CephConfig
87+
spec:
88+
<section>:
89+
<key>: "<value>"
90+
```
91+
92+
* **section** — any valid Ceph configuration section (e.g., `global`, `mon`,
93+
`osd`, `client.radosgw`, `mgr`, etc.)
94+
* **key** — any valid Ceph configuration parameter within that section
95+
* **value** — the value as a string (YAML strings, quoted or unquoted)
96+
97+
Example:
98+
99+
```yaml
100+
kind: CephConfig
101+
spec:
102+
global:
103+
rbd_cache: "true"
104+
osd_pool_default_size: 3
105+
client.radosgw:
106+
rgw_cache_lru_size: 100
107+
rgw_crypt_require_ssl: "true"
108+
osd:
109+
rocksdb_perf: "true"
110+
```
111+
112+
### kind: CephOSDConfig
113+
114+
Maps to `ceph osd set-*` commands. The spec defines OSD-level operational
115+
parameters:
116+
117+
```yaml
118+
kind: CephOSDConfig
119+
spec:
120+
allow_crimson: <bool>
121+
backfillfull_ratio: <float>
122+
full_ratio: <float>
123+
nearfull_ratio: <float>
124+
require_min_compat_client: <string>
125+
```
126+
127+
Available fields and their defaults:
128+
129+
| Field | Type | Default | Description |
130+
| --------------------------- | ------ | ------- | -------------------------------------------------------------------------------------------------------- |
131+
| `allow_crimson` | bool | `false` | Enable experimental Crimson OSD backend (risky for production) |
132+
| `backfillfull_ratio` | float | `0.9` | OSD considered full for backfill purposes at this ratio |
133+
| `full_ratio` | float | `0.95` | OSD considered full and blocks writes at this ratio |
134+
| `nearfull_ratio` | float | `0.85` | OSD considered near-full at this ratio |
135+
| `require_min_compat_client` | string | `reef` | Minimum allowed client version (`luminous`, `nautilus`, `octopus`, `pacific`, `quincy`, `reef`, `squid`) |
136+
137+
### Multi-document example
138+
139+
Both kinds can be combined in a single file using the `---` separator:
140+
141+
```yaml
142+
---
143+
kind: CephConfig
144+
spec:
145+
global:
146+
rbd_cache: "true"
147+
client.radosgw:
148+
rgw_cache_lru_size: 100
149+
---
150+
kind: CephOSDConfig
151+
spec:
152+
allow_crimson: false
153+
backfillfull_ratio: 0.9
154+
full_ratio: 0.95
155+
nearfull_ratio: 0.85
156+
require_min_compat_client: reef
157+
```
158+
159+
## Health checks
160+
161+
`cephctl healthcheck` runs the following checks and reports the status for each
162+
indicator. Each check is reported as **GOOD**, **AT_RISK**, **DANGEROUS**, or
163+
**UNKNOWN**.
164+
165+
| Indicator | Type | GOOD | AT_RISK | DANGEROUS | Description |
166+
| ------------------------- | ---------------- | ------------------ | ----------------- | ---------------- | ------------------------------------------------------------ |
167+
| `CLUSTER_STATUS` | overall | `HEALTH_OK` | `HEALTH_WARN` | `HEALTH_ERR` | Overall cluster health status from `ceph status` |
168+
| `QUORUM` | monitors | all mons in quorum | some mons missing | — | Whether all monitor nodes are participating in quorum |
169+
| `MON_DOWN` | monitors | 0 | >0 | — | Count of monitor nodes that are not up |
170+
| `OSD_DOWN` | OSD | 0 | >0 | — | Count of OSDs in down state |
171+
| `OSD_OUT` | OSD | 0 | >0 | — | Count of OSDs in out state |
172+
| `DOWN_PGS` | placement groups | 0 | — | >0 | PGs stored on down OSDs with no available copy |
173+
| `UNCLEAN_PGS` | placement groups | 0 | >0 | — | PGs not in clean state (e.g., recovering, backfilling) |
174+
| `INACTIVE_PGS` | placement groups | 0 | — | >0 | PGs that cannot perform IO (inactive) |
175+
| `IP_COLLISION` | networking | no collisions | — | collisions found | Duplicate front or back IP addresses across OSD hosts |
176+
| `MUTES_AMOUNT` | health | 0 | >0 | — | Muted health checks that could mask real issues |
177+
| `OSD_METADATA_SIZE` | storage | ≤7% | >15% | >20% | OSD metadata (block.db) size as percentage of total capacity |
178+
| `OSD_NUM_DAEMON_VERSIONS` | versions | 1 version | 2 versions | >2 versions | Number of distinct OSD daemon versions running |
179+
| `ALLOW_CRIMSON` | OSD | disabled | enabled | — | Whether experimental Crimson OSD is allowed |
180+
| `DEVICE_HEALTH_WEAROUT` | hardware | no worn devices | wear >50% | wear >75% | SSD/NVMe devices with high wear level |
181+
182+
### Using health checks for monitoring
183+
184+
You can run health checks against a remote cluster via SSH:
185+
186+
```shell
187+
cephctl --ceph-binary='ssh user@mon01 ceph' healthcheck
188+
```
189+
190+
Or by setting the environment variable:
191+
192+
```shell
193+
export CEPHCTL_CEPH_BINARY='ssh user@mon01 ceph'
194+
cephctl healthcheck
195+
```
196+
67197
## Roadmap
68198

69-
* [X] v0.0.0
70-
* [X] Apply declarative configuration for `ceph config`
71-
* [X] Dump cluster configuration to CephConfig specification
72-
* [X] Diff configuration against running configuration for `ceph config`
73-
* [X] Perform healthcheck based on current cluster status
74-
* [X] Add healthchecks based on current cluster configuration
75-
* [X] v0.1.0
76-
* [X] Additional healthchecks based on hardware status
77-
* [X] FreeBSD support in builds
78-
* [X] Remote Ceph cluster access via SSH
79-
* [X] v0.2.0
80-
* [X] Apply/Dump declarative configuration for `ceph osd set-*` stuff
199+
* [x] v0.0.0
200+
* [x] Apply declarative configuration for `ceph config`
201+
* [x] Dump cluster configuration to CephConfig specification
202+
* [x] Diff configuration against running configuration for `ceph config`
203+
* [x] Perform healthcheck based on current cluster status
204+
* [x] Add healthchecks based on current cluster configuration
205+
* [x] v0.1.0
206+
* [x] Additional healthchecks based on hardware status
207+
* [x] FreeBSD support in builds
208+
* [x] Remote Ceph cluster access via SSH
209+
* [x] v0.2.0
210+
* [x] Apply/Dump declarative configuration for `ceph osd set-*` stuff
81211
* [ ] v0.3.0
82212
* [ ] Apply/Dump declarative configuration for Ceph Object Gateway (rgw)
83213
* [ ] v0.4.0
@@ -96,11 +226,11 @@ If you gonna use cephctl as a library for your purposes please feel free to
96226
but please note a few things:
97227

98228
1. Cephctl doesn't use internal packages to allow you to do whatever you like.
99-
Cephctl project doesn't aim to limit your usage.
229+
Cephctl project doesn't aim to limit your usage.
100230
2. Internal program interfaces are not guaranteed to be stable between releases
101-
since they're written and serve for internal purposes.
231+
since they're written and serve for internal purposes.
102232
3. CLI interface (until 1.0.x at least) is also not guaranteed to be stable:
103-
subcommands and options are subjects to change between versions.
233+
subcommands and options are subjects to change between versions.
104234

105235
## Installation
106236

@@ -168,9 +298,11 @@ goreleaser build --snapshot --clean
168298
or manually via Go compiler
169299

170300
<!-- markdownlint-disable MD013 -->
301+
171302
```shell
172303
go build -v -ldflags="-X 'main.appVersion=$(git rev-parse --short HEAD) (trunk build)' -X 'main.buildTimestamp=$(date -u +%Y-%m-%dT%H:%m:%SZ)'" -o dist/cephctl ./cmd/cephctl/...
173304
```
305+
174306
<!-- markdownlint-enable MD013 -->
175307

176308
## Contribution

examples/config.yaml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
11
---
2+
# CephConfig: maps to `ceph config set` commands
3+
# Sections: global, mon, osd, mgr, client.radosgw, etc.
24
kind: CephConfig
35
spec:
46
global:
7+
# Enable RBD caching for improved performance
58
rbd_cache: "true"
9+
# Default replication size
10+
osd_pool_default_size: "3"
611
client.radosgw:
7-
rgw_cache_lru_size: 100
12+
rgw_cache_lru_size: "100"
13+
# Require SSL for RadosGW encryption operations
814
rgw_crypt_require_ssl: "true"
915
osd:
1016
rocksdb_perf: "true"
17+
---
18+
# CephOSDConfig: maps to `ceph osd set-*` commands
19+
kind: CephOSDConfig
20+
spec:
21+
# Crimson is experimental - keep disabled for production
22+
allow_crimson: false
23+
# OSDs at 90% capacity prevent backfill to this OSD
24+
backfillfull_ratio: 0.9
25+
# OSDs at 95% capacity block all writes
26+
full_ratio: 0.95
27+
# OSDs at 85% capacity trigger near-full warning
28+
nearfull_ratio: 0.85
29+
# Minimum client version allowed to connect (luminous, nautilus,
30+
# octopus, pacific, quincy, reef, squid)
31+
require_min_compat_client: reef

models/clusterhealth.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,9 @@ const (
143143

144144
// ClusterHealthIndicatorTypeUncleanPGs reflects amount of PGs which are not in clean state
145145
//
146-
// Description: Inactive PGs indicator shows how many PGs are inactive i.e. can not be
147-
// used to perform IO operations at the moment.
146+
// Description: Unclean PGs indicator shows how many PGs are not in clean state i.e.
147+
// they are in states like recovering, backfilling, peering, etc. This is normal
148+
// during maintenance operations but may indicate issues if persistent.
148149
//
149150
// Ref: https://docs.ceph.com/en/latest/rados/operations/monitoring-osd-pg/#monitoring-pg-states
150151
//

0 commit comments

Comments
 (0)