Configuration
-------------
-Two configuration keys are mandatory for the module to work:
+Two configuration keys are vital for the module to work:
-- mgr/zabbix/zabbix_host
-- mgr/zabbix/identifier
+- zabbix_host
+- identifier (optional)
The parameter *zabbix_host* controls the hostname of the Zabbix server to which
*zabbix_sender* will send the items. This can be a IP-Address if required by
when sending items to Zabbix. This should match the name of the *Host* in
your Zabbix server.
+When the *identifier* parameter is not configured the ceph-<fsid> of the cluster
+will be used when sending data to Zabbix.
+
+This would for example be *ceph-c4d32a99-9e80-490f-bd3a-1d22d8a7d354*
+
Additional configuration keys which can be configured and their default values:
- mgr/zabbix/zabbix_port: 10051
'zabbix_sender': '/usr/bin/zabbix_sender',
'zabbix_host': None,
'zabbix_port': 10051,
- 'identifier': None, 'interval': 60
+ 'identifier': "",
+ 'interval': 60
}
COMMANDS = [
self.event = Event()
def init_module_config(self):
+ self.fsid = self.get('mon_map')['fsid']
for key, default in self.config_keys.items():
value = self.get_localized_config(key, default)
if value is None:
raise RuntimeError('Configuration key {0} not set; "ceph '
- 'config-key set mgr/zabbix/{0} '
- '<value>"'.format(key))
+ 'zabbix config-set {0} <value>"'.format(key))
self.set_config_option(key, value)
def send(self):
data = self.get_data()
- self.log.debug('Sending data to Zabbix server %s',
- self.config['zabbix_host'])
+ identifier = self.config['identifier']
+ if identifier is None or len(identifier) == 0:
+ identifier = 'ceph-{0}'.format(self.fsid)
+
+ self.log.debug('Sending data to Zabbix server %s as host/identifier %s',
+ self.config['zabbix_host'], identifier)
self.log.debug(data)
try:
zabbix = ZabbixSender(self.config['zabbix_sender'],
self.config['zabbix_host'],
self.config['zabbix_port'], self.log)
- zabbix.send(self.config['identifier'], data)
+
+ zabbix.send(identifier, data)
except Exception as exc:
self.log.error('Exception when sending: %s', exc)