1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 02:51:03 +00:00

[plugins/disk/btrfs_device_usage] Fix issues brought up by CI.

- Remove trailing whitespace.
- Add whitespace around operators.
- Add linebreaks to shorten the lines.
This commit is contained in:
HaseHarald 2020-08-23 17:45:08 +02:00
parent 5f88f9ad06
commit 7d220d0ae6

View file

@ -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("")