diff --git a/plugins/disk/btrfs_device_usage b/plugins/disk/btrfs_device_usage index 4aca7d16..04af4642 100755 --- a/plugins/disk/btrfs_device_usage +++ b/plugins/disk/btrfs_device_usage @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/python3 # # This file contains a munin-plugin to gather btrfs statistics per device. # @@ -19,6 +19,7 @@ import btrfs import sys + def munin_config(fs): fsid = str(fs.fsid).replace('-', '_') @@ -34,7 +35,8 @@ def munin_config(fs): for this_device in devices: this_dev_info = fs.dev_info(this_device.devid) this_dev_name = this_dev_info.path.replace('/dev/', '') - print("btrfs_bytes_"+ fsid + "_" + str(this_device.devid) + ".label " + this_dev_name) + print("btrfs_bytes_" + fsid + "_" + str(this_device.devid) + \ + ".label " + this_dev_name) print("") @@ -44,18 +46,21 @@ def munin_config(fs): print("graph_scale no") print("graph_vlabel %") print("graph_category disk") - print("graph_info This graph shows percentage used by btrfs on every device. Maesured in percentage of device capacity.") + print("graph_info This graph shows percentage used by btrfs on every \ + device. Maesured in percentage of device capacity.") devices = fs.devices() for this_device in devices: this_dev_info = fs.dev_info(this_device.devid) this_dev_name = this_dev_info.path.replace('/dev/', '') - print("btrfs_percent_"+ fsid + "_" + str(this_device.devid) + ".label " + this_dev_name) - print("btrfs_percent_"+ fsid + "_" + str(this_device.devid) + ".warning 95") - print("btrfs_percent_"+ fsid + "_" + str(this_device.devid) + ".critical 98") + print("btrfs_percent_" + fsid + "_" + str(this_device.devid) + \ + ".label " + this_dev_name) + print("btrfs_percent_" + fsid + "_" + str(this_device.devid) + ".warning 95") + print("btrfs_percent_" + fsid + "_" + str(this_device.devid) + ".critical 98") print("") + def munin_values(fs): fsid = str(fs.fsid).replace('-', '_') devices = fs.devices() @@ -64,7 +69,8 @@ def munin_values(fs): for this_device in devices: this_dev_info = fs.dev_info(this_device.devid) - print("btrfs_bytes_"+ fsid + "_" + str(this_device.devid) + ".value " + str(this_dev_info.bytes_used)) + print("btrfs_bytes_" + fsid + "_" + str(this_device.devid) + \ + ".value " + str(this_dev_info.bytes_used)) print("") @@ -76,7 +82,8 @@ def munin_values(fs): for this_device in devices: this_dev_info = fs.dev_info(this_device.devid) usage = 100.0 * this_dev_info.bytes_used / this_dev_info.total_bytes - print("btrfs_percent_"+ fsid + "_" + str(this_device.devid) + ".value " + str(round(usage, 2))) + print("btrfs_percent_" + fsid + "_" + str(this_device.devid) + \ + ".value " + str(round(usage, 2))) print("")