Skip to content
This repository has been archived by the owner on Nov 12, 2018. It is now read-only.

Template / script mismatch #10

Open
bmarkowww opened this issue May 31, 2016 · 2 comments
Open

Template / script mismatch #10

bmarkowww opened this issue May 31, 2016 · 2 comments

Comments

@bmarkowww
Copy link

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
  ;;
@thelan
Copy link
Owner

thelan commented May 31, 2016

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.

@bmarkowww
Copy link
Author

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants