Commit e9a4930
committed
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.1 parent e2e3bcb commit e9a4930
1 file changed
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
9 | 13 | | |
10 | 14 | | |
11 | 15 | | |
| |||
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
61 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
62 | 68 | | |
63 | 69 | | |
64 | 70 | | |
| |||
162 | 168 | | |
163 | 169 | | |
164 | 170 | | |
165 | | - | |
| 171 | + | |
166 | 172 | | |
167 | 173 | | |
168 | 174 | | |
| |||
179 | 185 | | |
180 | 186 | | |
181 | 187 | | |
182 | | - | |
| 188 | + | |
183 | 189 | | |
184 | 190 | | |
185 | 191 | | |
| |||
0 commit comments