Added ability to change ID used to connect to ceph. (#8276)
* Added ability to change ID used to connect to ceph. Allows the creation of a user with read only caps for the mon + mgr. * Force "admin" as rados_id if none given.
Paul Mezzanini committed
Mar 4, 2020 at 10:09 UTC
4ca5569f9e3bc3496215eb34e27e005e717b56b1
2 files changed
+6
-2
collectors/python.d.plugin/ceph/ceph.chart.py
+3
-1
@@ -120,6 +120,7 @@ class Service(SimpleService):
120
self.definitions = CHARTS
121
self.config_file = self.configuration.get('config_file')
122
self.keyring_file = self.configuration.get('keyring_file')
123
+ self.rados_id = self.configuration.get('rados_id', 'admin')
124
125
def check(self):
126
"""
@@ -148,7 +149,8 @@ class Service(SimpleService):
149
return False
150
try:
151
self.cluster = rados.Rados(conffile=self.config_file,
151
- conf=dict(keyring=self.keyring_file))
152
+ conf=dict(keyring=self.keyring_file),
153
+ rados_id=self.rados_id)
154
self.cluster.connect()
155
except rados.Error as error:
156
self.error(error)
collectors/python.d.plugin/ceph/ceph.conf
+3
-1
@@ -64,10 +64,12 @@
64
# config_file: 'config_file' # Ceph config file.
65
# keyring_file: 'keyring_file' # Ceph keyring file. netdata user must be added into ceph group
66
# # and keyring file must be read group permission.
67
+# rados_id: 'rados username' # ID used to connect to ceph cluster. Allows
68
+# # creating a read only key for pulling data v.s. admin
69
# ----------------------------------------------------------------------
70
# AUTO-DETECTION JOBS
71
# only one of them will run (they have the same name)
72
#
73
config_file: '/etc/ceph/ceph.conf'
74
keyring_file: '/etc/ceph/ceph.client.admin.keyring'
73
-
75
+rados_id: 'admin'