ceph-nagios-plugins icon indicating copy to clipboard operation
ceph-nagios-plugins copied to clipboard

Passing keyring to a cephadm volume for health check

Open bluikko opened this issue 2 years ago • 0 comments

Trying to use the check_ceph_health script I hit an issue: the keyring is not passed to the cephadm container that runs the ceph command.

I do not know how this current implementation is supposed to be run but usually there would be an additional switch passed to cephadm that mounts the keyring from the host OS to the container as a volume, for example with:

cephadm shell -v /etc/ceph/client.nagios.keyring:/etc/ceph/client.nagios.keyring:z

Possibly the :z at the end of the volume specification would not work on a system without SELinux but I do not have any other than RPM systems to test with. In the example code this is not included since I couldn't test it on other systems.

The example I made is very simple, possibly it is not pretty but Python is not one of my favorites: https://github.com/bluikko/ceph-nagios-plugins/compare/master...bluikko-cephadm-volume
It works on my system but since this was not included in the original implementation it makes me question how was the cephadm support supposed to work earlier. Usually (?) the container it runs would not include keyrings, to my knowledge.

I would like feedback on this before I make a PR.

Additionally running the script without adding the above patch fails at line 189 on Python 3.9 (the real error is about the missing keyring)...

TypeError: a bytes-like object is required, not 'str'

bluikko avatar Dec 08 '22 11:12 bluikko