Skip to content

Commit b6c93be

Browse files
bzedmistral-vibe
andcommitted
Apply PR ceph#88: Add cephadm support to all check scripts
Applied cephadm compatibility changes from bluikko/ceph-nagios-plugins PR ceph#88: - Added CEPH_ADM_COMMAND constant and --admexe argument to all scripts - Added --cephadm flag to enable cephadm mode - Modified command building to prepend 'cephadm shell' when enabled - Added keyring handling for cephadm using -v flag - Updated error handling to skip cephadm's extra output lines - Bumped version numbers for all modified scripts Affected scripts: - check_ceph_df (v1.8.0) - check_ceph_mgr (v1.1.0) - check_ceph_mon (v1.6.0) - check_ceph_osd (v1.6.0) - check_ceph_osd_db (v1.1.0) - check_ceph_osd_df (v1.1.0) - check_ceph_rgw (v1.6.0) Copyright: bluikko (https://github.com/bluikko/ceph-nagios-plugins) Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
1 parent c184c87 commit b6c93be

8 files changed

Lines changed: 457 additions & 57 deletions

FORKS_AND_PRS_ANALYSIS.md

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
# Forks and Pull Requests Analysis for ceph/ceph-nagios-plugins
2+
3+
## Summary
4+
5+
- **Total Forks**: 82 (retrieved via GitHub API using `gh` CLI)
6+
- **Total Pull Requests**: 61 (50 merged/closed, 7 open)
7+
- **Analysis Date**: 2026-05-12
8+
9+
## Forks (82 total)
10+
11+
All forks retrieved from: `gh api /repos/ceph/ceph-nagios-plugins/forks --paginate`
12+
13+
Notable forks with recent activity or significant modifications:
14+
- **bzed/ceph-nagios-plugins** - Current maintainer's fork (updated 2026-05-12)
15+
- **emmcdonald/ceph-nagios-plugins** - Has PR #94 (host escaping simplification)
16+
- **Imatic-IT/ceph-nagios-plugins** - Has PR #90 (python3 dependency update)
17+
- **bluikko/ceph-nagios-plugins** - Has PRs #88, #86 (cephadm support, README updates)
18+
- **lbausch/ceph-nagios-plugins** - Has PR #85 (bytes decode fix)
19+
- **niclan/ceph-nagios-plugins** - Has PR #89 (health plugin full status)
20+
- **HeroesLament/ceph-nagios-plugins** - Has PR #83 (Octopus fix - BROKEN Python 3)
21+
- **noris-network/ceph-nagios-plugins** - Has merged PRs #81, #80
22+
- **maartenbeeckmans/ceph-nagios-plugins** - Has merged PR #82 (python3 for osd_db)
23+
24+
## Pull Requests Analysis
25+
26+
### Open PRs (7 total) - Not yet merged
27+
28+
| # | Title | Author | Fork | Status | Useful? | Notes |
29+
|---|-------|--------|------|--------|---------|-------|
30+
| 94 | Simplify host address escaping in check_ceph_osd | emmcdonald | emmcdonald | Open | **YES** | Uses `re.escape()` - ALREADY APPLIED in current repo |
31+
| 90 | Update dependency from python to python3 for debian bookworm | janpekar | Imatic-IT | Open | **YES** | Debian packaging updates - PARTIALLY APPLIED |
32+
| 89 | health plugin to give full status | niclan | niclan | Open | Maybe | Changes health output format - NOT APPLIED |
33+
| 88 | Cephadm support and other minor changes | bluikko | bluikko | Open | **YES** | Adds cephadm support - NOT APPLIED |
34+
| 86 | Update plugin usage and add check_ceph_osd_df in README | bluikko | bluikko | Open | No | Documentation only |
35+
| 85 | check_ceph_osd_db: Decode bytes output to string | lbausch | lbausch | Open | **YES** | Partial fix - ALREADY APPLIED |
36+
| 83 | Fixed check_ceph_osd for Ceph Octopus. | HeroesLament | HeroesLament | Open | **NO** | Uses Python 2 print statements - BREAKS Python 3 |
37+
38+
### Merged/Closed PRs (50 total) - Already in upstream
39+
40+
Most relevant merged PRs (already in the repository):
41+
- **#82** (maartenbeeckmans): Make check_ceph_osd_db python3 - **ALREADY MERGED**
42+
- **#81** (Syphdias/noris-network): Stop error from ceph command being silenced - **ALREADY MERGED**
43+
- **#80** (Syphdias/noris-network): Fix exclude example for check_ceph_health --check - **ALREADY MERGED**
44+
- **#79** (dalees): Consistent formatting for extended messages - **ALREADY MERGED**
45+
- **#78** (janpekar/Imatic-IT): Allow deb packages to be build using docker - **ALREADY MERGED**
46+
- **#77** (tobias-urdin): Add check_ceph_osd_db - **ALREADY MERGED**
47+
- **#72** (lorenzbausch): Convert output to utf-8 - **ALREADY MERGED**
48+
- **#69** (tobias-urdin): Add -s/--skip-muted to skip muted checks - **ALREADY MERGED**
49+
- **#68** (WarriorXK): Added cephadm compatibility - **ALREADY MERGED**
50+
- **#57** (j-licht): Add python3 compatibility - **ALREADY MERGED**
51+
52+
## Changes Already Applied in Current Repository
53+
54+
Based on git history, the following changes have been applied:
55+
56+
1. **PR #82**: check_ceph_osd_db python3 compatibility
57+
2. **PR #81**: Error handling fixes
58+
3. **PR #80**: Documentation fix for --check
59+
4. **PR #79**: Extended messages formatting
60+
5. **PR #78**: Docker build support
61+
6. **PR #77**: check_ceph_osd_db plugin added
62+
7. **PR #75**: Client ID argument fix
63+
8. **PR #72**: UTF-8 output conversion
64+
65+
Additional changes applied (not from PRs):
66+
- Shebang updates: `#!/usr/bin/env python``#!/usr/bin/env python3` (all scripts)
67+
- Removed `from __future__ import print_function` (all scripts)
68+
- Added `.decode('utf-8')` to subprocess output (all scripts)
69+
- Added `.decode('utf-8')` to error output (check_ceph_health, check_ceph_osd_df, etc.)
70+
- `re.escape()` for host escaping (check_ceph_osd, check_ceph_osd_db)
71+
- Debian packaging: python → python3 in dependencies
72+
- Maintainer updated to Bernd Zeimetz <bzed@debian.org>
73+
- Vcs-Git added: https://github.com/bzed/ceph-nagios-plugins.git
74+
75+
## Useful Changes NOT Yet Applied
76+
77+
### PR #90: Update dependency from python to python3 for debian bookworm
78+
**Origin**: Imatic-IT/ceph-nagios-plugins (janpekar)
79+
**Copyright**: Jan Pekar <jan.pekar@imatic.cz>
80+
**Files Modified**:
81+
- `debian/control`: python → python3 in Build-Depends and Depends
82+
- `debian/rules`: --with python2 → --with python3
83+
- `debian/changelog`: Added entries for python3 changes
84+
- `BUILD_DEBIAN.md`: python → python3
85+
- `Makefile`: debian:buster → debian:bookworm, python → python3
86+
- `src/check_ceph_df`: Shebang update
87+
- `src/check_ceph_health`: Shebang update
88+
89+
**Status**: PARTIALLY APPLIED (debian packaging done, but changelog entries may differ)
90+
91+
### PR #88: Cephadm support and other minor changes
92+
**Origin**: bluikko/ceph-nagios-plugins
93+
**Copyright**: bluikko
94+
**Files Modified**:
95+
- `src/check_ceph_df`: Added cephadm support
96+
- `src/check_ceph_mgr`: Added cephadm support
97+
98+
**Status**: NOT APPLIED
99+
100+
### PR #89: health plugin to give full status
101+
**Origin**: niclan/ceph-nagios-plugins
102+
**Copyright**: niclan
103+
**Files Modified**:
104+
- `src/check_ceph_health`: Refactored health checking logic
105+
106+
**Status**: NOT APPLIED
107+
108+
### PR #94: Simplify host address escaping in check_ceph_osd
109+
**Origin**: emmcdonald/ceph-nagios-plugins
110+
**Copyright**: Michael McDonald (emmcdonald)
111+
**Files Modified**:
112+
- `src/check_ceph_osd`: Replace manual escaping with `re.escape()`
113+
114+
**Status**: ALREADY APPLIED
115+
116+
### PR #85: check_ceph_osd_db: Decode bytes output to string
117+
**Origin**: lbausch/ceph-nagios-plugins
118+
**Copyright**: lbausch (Lorenz Bausch)
119+
**Files Modified**:
120+
- `src/check_ceph_osd_db`: Added `.decode('utf-8')` to output
121+
122+
**Status**: PARTIALLY APPLIED (only one line of the fix applied, but comprehensive decode fixes have been applied to all scripts)
123+
124+
## Changes to AVOID
125+
126+
### PR #83: Fixed check_ceph_osd for Ceph Octopus
127+
**Origin**: HeroesLament/ceph-nagios-plugins
128+
**Problem**: Uses Python 2 style `print` statements without parentheses
129+
**Status**: **REJECT** - Would break Python 3 compatibility
130+
**Reason**: This PR was created before Python 3 was a requirement and uses `print "text"` instead of `print("text")`
131+
132+
## Copyright Attribution
133+
134+
All changes from the following contributors should be attributed:
135+
136+
| Contributor | GitHub | Email | Contributions |
137+
|-------------|--------|-------|----------------|
138+
| Michael McDonald | emmcdonald | emmcdonald@users.noreply.github.com | PR #94 (re.escape) |
139+
| Jan Pekar | janpekar | jan.pekar@imatic.cz | PR #90, #78 (python3 deps, docker build) |
140+
| niclan | niclan | - | PR #89 (health full status) |
141+
| bluikko | bluikko | - | PR #88, #86 (cephadm support, README) |
142+
| Lorenz Bausch | lbausch | - | PR #85, #76, #72 (bytes decode, client id, utf-8) |
143+
| Maarten Beeckmans | maartenbeeckmans | - | PR #82 (osd_db python3) |
144+
| Syphdias | Syphdias | - | PR #81, #80, #62 (noris-network) |
145+
| Tobias Urdin | tobias-urdin | - | PR #77, #69 (osd_db, skip-muted) |
146+
| Dale Es | dalees | - | PR #79 (extended messages) |
147+
| WarriorXK | WarriorXK | - | PR #68 (cephadm compatibility) |
148+
149+
## Recommendations
150+
151+
1. **Apply PR #88** (cephadm support) - Adds useful cephadm compatibility
152+
2. **Review PR #89** (health full status) - May improve health check output
153+
3. **Skip PR #83** - Breaks Python 3
154+
4. **Verify PR #90 changes** - Some may already be applied with different changelog entries
155+
156+
## Files Created
157+
158+
- `FORKS_AND_PRS_ANALYSIS.md` - This analysis document
159+
- `/tmp/ceph-nagios-forks.json` - Raw fork data
160+
- `/tmp/ceph-nagios-all-prs.json` - Raw PR data
161+
162+
163+
## Analysis of Commits from Forks Without PRs
164+
165+
### NDPF/ceph-nagios-plugins (Dennis van Dok)
166+
167+
**Notable Commits**:
168+
169+
1. **9384d072** (2025-08-20): Add dotenv makefile target
170+
- **File**: `Makefile`
171+
- **Change**: Adds `build.env` target for CI/CD pipelines
172+
- **Useful**: YES - Useful for CI/CD integration
173+
- **Status**: NOT APPLIED
174+
- **Copyright**: Dennis van Dok
175+
176+
2. **0ad0e28a** (2025-08-20): Update scripts for python3 and pep8
177+
- **Files**: All scripts
178+
- **Changes**: Removes `from __future__ import print_function`, adds blank lines, comments unused imports
179+
- **Useful**: NO - Mostly formatting, already applied
180+
- **Status**: ALREADY APPLIED (similar changes)
181+
182+
3. **4629db49** (2025-08-20): Update Debian packaging
183+
- **Files**: `debian/control`, `debian/compat`
184+
- **Changes**: Adds `python3-all-dev` to Build-Depends, updates compat to 12
185+
- **Useful**: NO - Different approach than current repo (uses debhelper-compat = 13)
186+
- **Status**: SKIPPED (different packaging approach)
187+
188+
4. **ef20047c** (2025-08-20): Update for python3
189+
- **Files**: All scripts (shebang), `debian/control`, `debian/rules`, `Makefile`
190+
- **Changes**: Shebang updates, python → python3 in deps, bookworm base image
191+
- **Useful**: YES
192+
- **Status**: ALREADY APPLIED
193+
194+
### Imatic-IT/ceph-nagios-plugins (Jan Pekar)
195+
196+
**Notable Commits**:
197+
198+
1. **6dbc72f3** (2025-02-09): Fix python to python3, imatic dependency fix and new release
199+
- **Files**: `debian/changelog`, `debian/control`, `src/check_ceph_df`, `src/check_ceph_health`
200+
- **Changes**: Shebang updates, Replaces/Breaks for imt-nagios-nrpe
201+
- **Useful**: YES
202+
- **Status**: ALREADY APPLIED
203+
204+
### Other Forks
205+
206+
Most other forks (idledk, tiwek, mkarpiarz, spacelama, devwatchdog, INDIGEX, etc.) only contain commits that are already merged into upstream. No unique useful changes found.
207+
208+
## Summary of Applied Changes
209+
210+
### PR #88 Applied (Cephadm Support)
211+
212+
Applied cephadm support to the following scripts:
213+
- `src/check_ceph_df` (v1.8.0)
214+
- `src/check_ceph_mgr` (v1.1.0)
215+
- `src/check_ceph_mon` (v1.6.0)
216+
- `src/check_ceph_osd` (v1.6.0)
217+
- `src/check_ceph_osd_db` (v1.1.0)
218+
- `src/check_ceph_osd_df` (v1.1.0)
219+
- `src/check_ceph_rgw` (v1.6.0)
220+
221+
**Changes per script**:
222+
1. Added `CEPH_ADM_COMMAND = '/usr/sbin/cephadm'` constant
223+
2. Added `--admexe` argument for custom cephadm path
224+
3. Added `--cephadm` flag to enable cephadm mode
225+
4. Added validation for cephadm executable
226+
5. Modified command building to prepend `cephadm shell` when `--cephadm` is used
227+
6. Added keyring handling for cephadm (using `-v` flag)
228+
7. Updated error handling to skip cephadm's extra output lines
229+
8. Bumped version numbers
230+
231+
### PR #90 Analysis
232+
233+
**Status**: ALREADY FULLY APPLIED
234+
235+
All changes from PR #90 are already in the repository:
236+
- `debian/control`: python → python3 in Build-Depends and Depends ✓
237+
- `debian/rules`: --with python2 → --with python3 ✓
238+
- `BUILD_DEBIAN.md`: python → python3 ✓
239+
- `Makefile`: debian:buster → debian:bookworm, python → python3 ✓
240+
- `src/check_ceph_df`: Shebang update ✓
241+
- `src/check_ceph_health`: Shebang update ✓
242+
- Replaces/Breaks for imt-nagios-nrpe ✓
243+
244+
### Unique Changes from Forks (Not in PRs)
245+
246+
Only one unique useful change found:
247+
- **NDPF fork**: Added `build.env` target to Makefile for CI/CD (commit 9384d072)
248+
- **Status**: NOT APPLIED (optional enhancement)
249+
250+
## Recommendation
251+
252+
The only remaining useful change from forks is:
253+
1. Add the `build.env` target from NDPF fork for CI/CD integration (optional)
254+
255+
All other changes from PRs and forks have been either:
256+
- Already applied
257+
- Skipped due to being Python 2 incompatible (PR #83)
258+
- Documentation only (PR #86)
259+

src/check_ceph_df

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ import os
2121
import subprocess
2222
import sys
2323

24-
__version__ = '1.7.1'
24+
__version__ = '1.8.0'
2525

2626
# default ceph values
2727
CEPH_COMMAND = '/usr/bin/ceph'
28+
CEPH_ADM_COMMAND = '/usr/sbin/cephadm'
2829

2930
# nagios exit code
3031
STATUS_OK = 0
@@ -37,6 +38,7 @@ def main():
3738
# parse args
3839
parser = argparse.ArgumentParser(description="'ceph df' nagios plugin.")
3940
parser.add_argument('-e','--exe', help='ceph executable [%s]' % CEPH_COMMAND)
41+
parser.add_argument('-A','--admexe', help='cephadm executable [%s]' % CEPH_ADM_COMMAND)
4042
parser.add_argument('-c','--conf', help='alternative ceph conf file')
4143
parser.add_argument('-m','--monaddress', help='ceph monitor address[:port]')
4244
parser.add_argument('-i','--id', help='ceph client id')
@@ -47,13 +49,20 @@ def main():
4749
parser.add_argument('-W','--warn', help="warn above this percent RAW USED", type=float)
4850
parser.add_argument('-C','--critical', help="critical alert above this percent RAW USED", type=float)
4951
parser.add_argument('-V','--version', help='show version and exit', action='store_true')
52+
parser.add_argument('-a','--cephadm', help='uses cephadm to execute the command', action='store_true')
5053
args = parser.parse_args()
5154

5255
# validate args
56+
cephadm_exec = args.admexe if args.admexe else CEPH_ADM_COMMAND
5357
ceph_exec = args.exe if args.exe else CEPH_COMMAND
54-
if not os.path.exists(ceph_exec):
55-
print("ERROR: ceph executable '%s' doesn't exist" % ceph_exec)
56-
return STATUS_UNKNOWN
58+
if args.cephadm:
59+
if not os.path.exists(cephadm_exec):
60+
print("ERROR: cephadm executable '%s' doesn't exist" % cephadm_exec)
61+
return STATUS_UNKNOWN
62+
else:
63+
if not os.path.exists(ceph_exec):
64+
print("ERROR: ceph executable '%s' doesn't exist" % ceph_exec)
65+
return STATUS_UNKNOWN
5766

5867
if args.version:
5968
print('version %s' % __version__)
@@ -73,6 +82,17 @@ def main():
7382

7483
# build command
7584
ceph_df = [ceph_exec]
85+
86+
if args.cephadm:
87+
# Prepend the command with the cephadm binary and the shell command
88+
ceph_df = [cephadm_exec, 'shell']
89+
90+
if args.keyring:
91+
ceph_df.append('-v')
92+
ceph_df.append('%s:%s:ro' % (args.keyring, args.keyring))
93+
ceph_df.append('--')
94+
ceph_df.append(ceph_exec)
95+
7696
if args.monaddress:
7797
ceph_df.append('-m')
7898
ceph_df.append(args.monaddress)
@@ -215,9 +235,9 @@ def main():
215235
return STATUS_OK
216236

217237
#for
218-
elif err:
219-
# read only first line of error
220-
one_line = err.decode('utf-8').split('\n')[0]
238+
elif p.returncode != 0:
239+
# read only first line of error, cephadm prints 4 lines
240+
one_line = err.decode('utf-8').split('\n')[4 if args.cephadm else 0]
221241
if '-1 ' in one_line:
222242
idx = one_line.rfind('-1 ')
223243
print('ERROR: %s: %s' % (ceph_exec, one_line[idx+len('-1 '):]))

0 commit comments

Comments
 (0)