ganglia/gmond_python_modules — pull request #120 by hashar (2013-10-23 09:58:35+00:00)
Title: diskstat: really discover devs when devices is missing

The diskstat plugin is supposed, by default, to monitor any entry not
containing a number under /proc/diskstat. Hence I created a very basic
diskstat.pyconf, roughly:

modules {
module {
name = 'diskstat'
language = 'python'
}
}

The metric_init would get() 'devices' from the list of parameters which
set it to None. The partition discovery is only done when 'devices' is
an empty string so the rest of the code would try to interact with None.
That eventually leads to:

diskstat.py", line 181, in get_partitions
for dev in out.split():
AttributeError: 'NoneType' object has no attribute 'split'

The fix is to make DEVICES to default to None and change the boolean
logic:

- if DEVICES != '':
+ if DEVICES is not None:

To be ultra explicit to python newbie, we might even want to update the
get() call to: get('devices', None), but I dont think that is really
needed.