updated callback frequency

This commit is contained in:
Shailaja Kumari 2023-11-08 23:01:13 +05:30
parent 4db580ac62
commit c684beab6f
Signed by: shailaja
GPG Key ID: 81C942771BB69898
1 changed files with 5 additions and 3 deletions

View File

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