diff --git a/plugins/disk/btrfs_device_usage b/plugins/disk/btrfs_device_usage index 519e10d5..530e1568 100755 --- a/plugins/disk/btrfs_device_usage +++ b/plugins/disk/btrfs_device_usage @@ -155,9 +155,14 @@ 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))) + if this_dev_info.total_bytes > 0: + 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))) + else: + print("btrfs_percent_" + fsid + "_" + str(this_device.devid) + + ".value U") + print("")