collectd-python-mysql icon indicating copy to clipboard operation
collectd-python-mysql copied to clipboard

Slave lag zero (and other zero values) not picked up by collectd?

Open msims-okta opened this issue 8 years ago • 3 comments

There's something being dropped between the mysql plugin and collectd that I'm having a hard time tracking down.

mysql plugin verbose reports the following: [2016-08-29 17:07:24] mysql plugin: Sending value: slave/slave_lag=0

But this metric never makes it through collectd. It just disappears. Now if the value is greater than 0, collectd passes it through just fine.

I don't see any setting where collectd drops zero valued metrics. I'm seeing this for a few other slave metrics as well. Am I missing something?

msims-okta avatar Aug 29 '16 17:08 msims-okta

I figured it out why slave lag 0 was not being sent.

492 def dispatch_value(prefix, key, value, type, type_instance=None):
493         if not type_instance:
494                 type_instance = key
495 
496         log_verbose('Sending value: %s/%s=%s' % (prefix, type_instance, value))
497         if not value:
498                 return
499         try:
500                 value = int(value)
501         except ValueError:
502                 value = float(value)
503 
504         val               = collectd.Values(plugin='mysql', plugin_instance=prefix)
505         val.type          = type
506         val.type_instance = type_instance
507         val.values        = [value]
508         val.dispatch()

Line 497, value 0 is caught and a return is issued, causing metrics (slave_lag) with values of 0 to not be sent. If I comment out 497 and 498, the value goes through.

msims-okta avatar Dec 15 '16 21:12 msims-okta

I submitted PR #17 to help address this earlier today

cswingler avatar Dec 19 '16 22:12 cswingler

Ok cool. I haven't had time to figure out why it was getting caught there, though. Edit: Never mind I see your PR and get it now.

msims-okta avatar Dec 27 '16 04:12 msims-okta