Compare commits

..

No commits in common. "main" and "main" have entirely different histories.
main ... main

View File

@ -5,7 +5,7 @@ import collectd
PLUGIN = 'btrfs' PLUGIN = 'btrfs'
TYPE_STATS = "device_stats" TYPE_STATS = "device_stats"
INTERVAL = 600
def read_callback(): def read_callback():
"""Read Btrfs device information and dispatch values to collectd.""" """Read Btrfs device information and dispatch values to collectd."""
@ -22,17 +22,13 @@ def read_callback():
r'[^a-zA-Z0-9]', r'[^a-zA-Z0-9]',
r'-', r'-',
dev_info.path)[1:] dev_info.path)[1:]
if not metric.plugin_instance:
metric.plugin_instance = "missing"
for counter, value in stats.counters.items(): for counter, value in stats.counters.items():
metric.type_instance = counter metric.type_instance = counter
metric.dispatch(TYPE_STATS, [value], interval=INTERVAL) metric.dispatch(TYPE_STATS, [value])
except Exception as e: except Exception as e:
collectd.error("btrfs: read_callback: {}".format(e)) collectd.error("btrfs: read_callback: {}".format(e))
collectd.debug("btrfs: read done") collectd.debug("btrfs: read done")
if __name__ != "__main__": if __name__ != "__main__":
# Register callbacks # Register callbacks
collectd.register_read(read_callback, INTERVAL) collectd.register_read(read_callback)