ceph-zabbix
ceph-zabbix copied to clipboard
Template / script mismatch
Zabbix temaplate contains ceph.osd_in and ceph.osd_up parameters, while ceph-status.sh works with just in and up args:
<name>Ceph OSD in %</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>ceph.osd_in</key>
"in")
ceph_osd_in_percent
;;
The translation between the Zabbix item key and the script argument is done by the Zabbix agent configuration.
zabbix_agent_ceph_plugin.conf:
UserParameter=ceph.osd_in, /opt/ceph-status.sh in
UserParameter=ceph.osd_up, /opt/ceph-status.sh up
This should work like this although this may need a refactor to be easily understandable.
I'm using sh script with zabbix-sender. Python based daemon runs it every minute.
PARAMS = ['health', 'count', 'osd_in', 'osd_up', 'active', 'backfill', 'clean', 'creating',
'degraded', 'degraded_percent', 'down', 'incomplete', 'inconsistent',
'peering', 'recovering', 'remapped', 'repair', 'replay', 'scrubbing',
'splitting', 'stale', 'pgtotal', 'waitBackfill', 'mon', 'rados_total',
'rados_used', 'rados_free', 'wrbps', 'rdbps', 'ops']
class Mon(object):
def send_zabbix_stat(self, params):
for l_pname, l_pvalue in params.iteritems():
l_cmd = ["zabbix_sender", "-vv", "-s", HOSTNAME, "-z", ZABBIX_HOST, "-I", IP, "-k", l_pname, "-o", l_pvalue]
l_proc = subprocess.Popen(l_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
l_stdout, l_stderr = l_proc.communicate()
def get_stat(self, param_name):
l_cmd = [SCRIPT, param_name]
l_proc = subprocess.Popen(l_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
l_stdout, l_stderr = l_proc.communicate()
for l_line in l_stdout.splitlines():
l_line = l_line.strip();
return l_line
It's just easier when script params and zabbix keys are the same, so we can use PARAMS array for invoking script and sending data to zabbix simultaneously