From 10f2d97ffebd576492f96356c6bb7e35918df441 Mon Sep 17 00:00:00 2001 From: HaseHarald Date: Sun, 23 Aug 2020 16:38:38 +0200 Subject: [PATCH 1/9] [plugins/disk/btrfs_device_usage] Add plugin to monitor btrfs usage on a device level. Shows the used size of each device in a btrfs pool in bytes and percent. --- plugins/disk/btrfs_device_usage | 96 +++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100755 plugins/disk/btrfs_device_usage diff --git a/plugins/disk/btrfs_device_usage b/plugins/disk/btrfs_device_usage new file mode 100755 index 00000000..4aca7d16 --- /dev/null +++ b/plugins/disk/btrfs_device_usage @@ -0,0 +1,96 @@ +#!/usr/bin/python3 +# +# This file contains a munin-plugin to gather btrfs statistics per device. +# +# This is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this plugin. If not, see . + + +import btrfs +import sys + +def munin_config(fs): + fsid = str(fs.fsid).replace('-', '_') + + print("multigraph btrfs_device_usage_byte_" + fsid) + print("graph_title btrfs usage by device in bytes on " + fs.path) + print("graph_args --base 1024 -l 0") + print("graph_scale yes") + print("graph_vlabel bytes") + print("graph_category disk") + print("graph_info This graph shows bytes used by btrfs on every device") + + 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_bytes_"+ fsid + "_" + str(this_device.devid) + ".label " + this_dev_name) + + print("") + + print("multigraph btrfs_device_usage_percent_" + fsid) + print("graph_title btrfs usage by device in percent on " + fs.path) + print("graph_args --base 1000 -l 0") + 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.") + + 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("") + +def munin_values(fs): + fsid = str(fs.fsid).replace('-', '_') + devices = fs.devices() + + print("multigraph btrfs_device_usage_byte_" + fsid) + + 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("") + + # Reset device iterator + devices = fs.devices() + + print("multigraph btrfs_device_usage_percent_" + fsid) + + 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("") + + +def main(): + for path in btrfs.utils.mounted_filesystem_paths(): + with btrfs.FileSystem(path) as fs: + if len(sys.argv) > 1 and sys.argv[1] == "config": + munin_config(fs) + else: + munin_values(fs) + + +if __name__ == "__main__": + main() + +exit(0) From 7bf77a008db2e3d682e1ee89bcb9689584795b29 Mon Sep 17 00:00:00 2001 From: HaseHarald Date: Sun, 23 Aug 2020 16:43:21 +0200 Subject: [PATCH 2/9] [plugins/disk/btrfs_device_stats] Add a plugin to monitor device stats from btrfs. Monitors the different device-counters (mostly for errors) of the disks in a btrfs pool. --- plugins/disk/btrfs_device_stats | 140 ++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100755 plugins/disk/btrfs_device_stats diff --git a/plugins/disk/btrfs_device_stats b/plugins/disk/btrfs_device_stats new file mode 100755 index 00000000..3f9b23a9 --- /dev/null +++ b/plugins/disk/btrfs_device_stats @@ -0,0 +1,140 @@ +#!/usr/bin/python3 +# +# This file contains a munin-plugin to gather btrfs statistics per device. +# +# This is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this plugin. If not, see . + + +import btrfs +import sys + + +def munin_config(fs): + fsid = str(fs.fsid).replace('-', '_') + print("multigraph btrfs_device_stats_" + fsid) + print("graph_args --base 1000 -l 0") + print("graph_vlabel total btrfs attribute value") + print("graph_title btrfs total device stats for " + fs.path) + print("graph_category disk") + print("graph_info This graph shows the total stats of devices used by btrfs") + + print("corruption_errs_total.label Corruption Errors") + print("flush_errs_total.label Flush Errors") + print("generation_errs_total.label Generation Errors") + print("read_errs_total.label Read Errors") + print("write_errs_total.label Write Errors") + print("nr_items_total.label Nr. of Items") + print("flags_total.label Nr. of Flags") + + print("") + + 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("multigraph btrfs_device_stats_" + fsid + "." + str(this_device.devid)) + print("graph_args --base 1000 -l 0") + print("graph_vlabel btrfs attribute value") + print("graph_title btrfs device stats for " + this_dev_name) + print("graph_category disk") + print("graph_info This graph shows stats of devices used by btrfs") + + print("corruption_errs.label Corruption Errors") + print("corruption_errs.warming 1") + print("flush_errs.label Flush Errors") + print("flush_errs.warming 1") + print("generation_errs.label Generation Errors") + print("generation_errs.warming 1") + print("read_errs.label Read Errors") + print("read_errs.warming 1") + print("write_errs.label Write Errors") + print("write_errs.warming 1") + print("nr_items.label Nr. of Items") + print("flags.label Nr. of Flags") + print("flags.warming 1") + + print("") + + +def munin_values(fs): + corruption_errs_total = 0 + flush_errs_total = 0 + generation_errs_total = 0 + read_errs_total = 0 + write_errs_total = 0 + nr_items_total = 0 + flags_total = 0 + + fsid = str(fs.fsid).replace('-', '_') + 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/', '') + this_dev_stat = fs.dev_stats(this_device.devid, False) + + corruption_errs = this_dev_stat.corruption_errs + flush_errs = this_dev_stat.flush_errs + generation_errs = this_dev_stat.generation_errs + read_errs = this_dev_stat.read_errs + write_errs = this_dev_stat.write_errs + nr_items = this_dev_stat.nr_items + flags = this_dev_stat.flags + + corruption_errs_total = corruption_errs_total + corruption_errs + flush_errs_total = flush_errs_total + flush_errs + generation_errs_total = generation_errs_total + generation_errs + read_errs_total = read_errs_total + read_errs + write_errs_total = write_errs_total + write_errs + nr_items_total = nr_items_total + nr_items + flags_total = flags_total + flags + + print("multigraph btrfs_device_stats_" + fsid + "." + str(this_device.devid)) + + print("corruption_errs.value " + str(corruption_errs)) + print("flush_errs.value " + str(flush_errs)) + print("generation_errs.value " + str(generation_errs)) + print("read_errs.value " + str(read_errs)) + print("write_errs.value " + str(write_errs)) + print("nr_items.value " + str(nr_items)) + print("flags.value " + str(flags)) + + print("") + + print("multigraph btrfs_device_stats_" + fsid) + + print("corruption_errs_total.value " + str(corruption_errs_total)) + print("flush_errs_total.value " + str(flush_errs_total)) + print("generation_errs_total.value " + str(generation_errs_total)) + print("read_errs_total.value " + str(read_errs_total)) + print("write_errs_total.value " + str(write_errs_total)) + print("nr_items_total.value " + str(nr_items_total)) + print("flags_total.value " + str(flags_total)) + + print("") + + +def main(): + for path in btrfs.utils.mounted_filesystem_paths(): + with btrfs.FileSystem(path) as fs: + if len(sys.argv) > 1 and sys.argv[1] == "config": + munin_config(fs) + else: + munin_values(fs) + + +if __name__ == "__main__": + main() + +exit(0) From 5f88f9ad0695e42197c14494345316ccf24c21eb Mon Sep 17 00:00:00 2001 From: HaseHarald Date: Sun, 23 Aug 2020 17:34:21 +0200 Subject: [PATCH 3/9] Fix issues brought up by CI. - Remove trailing whitespace - Remove unused variable. --- plugins/disk/btrfs_device_stats | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/disk/btrfs_device_stats b/plugins/disk/btrfs_device_stats index 3f9b23a9..2cbf1640 100755 --- a/plugins/disk/btrfs_device_stats +++ b/plugins/disk/btrfs_device_stats @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/python3 # # This file contains a munin-plugin to gather btrfs statistics per device. # @@ -81,7 +81,6 @@ def munin_values(fs): for this_device in devices: this_dev_info = fs.dev_info(this_device.devid) - this_dev_name = this_dev_info.path.replace('/dev/', '') this_dev_stat = fs.dev_stats(this_device.devid, False) corruption_errs = this_dev_stat.corruption_errs From 7d220d0ae683a926d73aaeed252a10630ced206c Mon Sep 17 00:00:00 2001 From: HaseHarald Date: Sun, 23 Aug 2020 17:45:08 +0200 Subject: [PATCH 4/9] [plugins/disk/btrfs_device_usage] Fix issues brought up by CI. - Remove trailing whitespace. - Add whitespace around operators. - Add linebreaks to shorten the lines. --- plugins/disk/btrfs_device_usage | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) 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("") From f12bfed79562026775da361ba5d51cd53198b5c1 Mon Sep 17 00:00:00 2001 From: HaseHarald Date: Sun, 23 Aug 2020 18:15:40 +0200 Subject: [PATCH 5/9] [plugins/disk/btrfs_device_stats] Remove unused variable. --- plugins/disk/btrfs_device_stats | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/disk/btrfs_device_stats b/plugins/disk/btrfs_device_stats index 2cbf1640..639fff2f 100755 --- a/plugins/disk/btrfs_device_stats +++ b/plugins/disk/btrfs_device_stats @@ -80,7 +80,6 @@ def munin_values(fs): devices = fs.devices() for this_device in devices: - this_dev_info = fs.dev_info(this_device.devid) this_dev_stat = fs.dev_stats(this_device.devid, False) corruption_errs = this_dev_stat.corruption_errs From 675dedf1d4776699a7e5a5fba5e41c9335957a18 Mon Sep 17 00:00:00 2001 From: HaseHarald Date: Sun, 23 Aug 2020 18:17:21 +0200 Subject: [PATCH 6/9] [plugins/disk/btrfs_device_usage] Reformat linebreaks. Following suggestions from linting. --- plugins/disk/btrfs_device_usage | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/disk/btrfs_device_usage b/plugins/disk/btrfs_device_usage index 04af4642..1876f235 100755 --- a/plugins/disk/btrfs_device_usage +++ b/plugins/disk/btrfs_device_usage @@ -35,8 +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("") @@ -53,8 +53,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_percent_" + fsid + "_" + str(this_device.devid) + \ - ".label " + this_dev_name) + 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") @@ -69,8 +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("") @@ -82,8 +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("") From bffbc23a4e118c16b90273e331b1a5b812fe56da Mon Sep 17 00:00:00 2001 From: HaseHarald Date: Mon, 24 Aug 2020 21:37:29 +0200 Subject: [PATCH 7/9] Fix linting issues. --- plugins/disk/btrfs_device_stats | 32 +++++++++++++------------- plugins/disk/btrfs_device_usage | 40 ++++++++++++++++----------------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/plugins/disk/btrfs_device_stats b/plugins/disk/btrfs_device_stats index 639fff2f..8555c280 100755 --- a/plugins/disk/btrfs_device_stats +++ b/plugins/disk/btrfs_device_stats @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # # This file contains a munin-plugin to gather btrfs statistics per device. # @@ -28,7 +28,7 @@ def munin_config(fs): print("graph_title btrfs total device stats for " + fs.path) print("graph_category disk") print("graph_info This graph shows the total stats of devices used by btrfs") - + print("corruption_errs_total.label Corruption Errors") print("flush_errs_total.label Flush Errors") print("generation_errs_total.label Generation Errors") @@ -36,9 +36,9 @@ def munin_config(fs): print("write_errs_total.label Write Errors") print("nr_items_total.label Nr. of Items") print("flags_total.label Nr. of Flags") - + print("") - + devices = fs.devices() for this_device in devices: this_dev_info = fs.dev_info(this_device.devid) @@ -49,7 +49,7 @@ def munin_config(fs): print("graph_title btrfs device stats for " + this_dev_name) print("graph_category disk") print("graph_info This graph shows stats of devices used by btrfs") - + print("corruption_errs.label Corruption Errors") print("corruption_errs.warming 1") print("flush_errs.label Flush Errors") @@ -63,7 +63,7 @@ def munin_config(fs): print("nr_items.label Nr. of Items") print("flags.label Nr. of Flags") print("flags.warming 1") - + print("") @@ -75,13 +75,13 @@ def munin_values(fs): write_errs_total = 0 nr_items_total = 0 flags_total = 0 - + fsid = str(fs.fsid).replace('-', '_') devices = fs.devices() - + for this_device in devices: this_dev_stat = fs.dev_stats(this_device.devid, False) - + corruption_errs = this_dev_stat.corruption_errs flush_errs = this_dev_stat.flush_errs generation_errs = this_dev_stat.generation_errs @@ -89,7 +89,7 @@ def munin_values(fs): write_errs = this_dev_stat.write_errs nr_items = this_dev_stat.nr_items flags = this_dev_stat.flags - + corruption_errs_total = corruption_errs_total + corruption_errs flush_errs_total = flush_errs_total + flush_errs generation_errs_total = generation_errs_total + generation_errs @@ -97,9 +97,9 @@ def munin_values(fs): write_errs_total = write_errs_total + write_errs nr_items_total = nr_items_total + nr_items flags_total = flags_total + flags - + print("multigraph btrfs_device_stats_" + fsid + "." + str(this_device.devid)) - + print("corruption_errs.value " + str(corruption_errs)) print("flush_errs.value " + str(flush_errs)) print("generation_errs.value " + str(generation_errs)) @@ -107,11 +107,11 @@ def munin_values(fs): print("write_errs.value " + str(write_errs)) print("nr_items.value " + str(nr_items)) print("flags.value " + str(flags)) - + print("") - + print("multigraph btrfs_device_stats_" + fsid) - + print("corruption_errs_total.value " + str(corruption_errs_total)) print("flush_errs_total.value " + str(flush_errs_total)) print("generation_errs_total.value " + str(generation_errs_total)) @@ -119,7 +119,7 @@ def munin_values(fs): print("write_errs_total.value " + str(write_errs_total)) print("nr_items_total.value " + str(nr_items_total)) print("flags_total.value " + str(flags_total)) - + print("") diff --git a/plugins/disk/btrfs_device_usage b/plugins/disk/btrfs_device_usage index 1876f235..e7265de8 100755 --- a/plugins/disk/btrfs_device_usage +++ b/plugins/disk/btrfs_device_usage @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # # This file contains a munin-plugin to gather btrfs statistics per device. # @@ -22,7 +22,7 @@ import sys def munin_config(fs): fsid = str(fs.fsid).replace('-', '_') - + print("multigraph btrfs_device_usage_byte_" + fsid) print("graph_title btrfs usage by device in bytes on " + fs.path) print("graph_args --base 1024 -l 0") @@ -30,16 +30,16 @@ def munin_config(fs): print("graph_vlabel bytes") print("graph_category disk") print("graph_info This graph shows bytes used by btrfs on every device") - + 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_bytes_" + fsid + "_" + str(this_device.devid) + - ".label " + this_dev_name) - + ".label " + this_dev_name) + print("") - + print("multigraph btrfs_device_usage_percent_" + fsid) print("graph_title btrfs usage by device in percent on " + fs.path) print("graph_args --base 1000 -l 0") @@ -47,46 +47,46 @@ def munin_config(fs): 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.") - + 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) + ".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() - + print("multigraph btrfs_device_usage_byte_" + fsid) - + 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)) - + ".value " + str(this_dev_info.bytes_used)) + print("") - + # Reset device iterator devices = fs.devices() - + print("multigraph btrfs_device_usage_percent_" + fsid) - + 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))) - + ".value " + str(round(usage, 2))) + print("") - + def main(): for path in btrfs.utils.mounted_filesystem_paths(): From 6f0e91f8507f26415d8f1b8ce17fa37a7c632537 Mon Sep 17 00:00:00 2001 From: HaseHarald Date: Tue, 25 Aug 2020 20:21:19 +0200 Subject: [PATCH 8/9] Add perldoc-style header. --- plugins/disk/btrfs_device_stats | 36 ++++++++++++++++++++++++++++++++- plugins/disk/btrfs_device_usage | 36 ++++++++++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 2 deletions(-) diff --git a/plugins/disk/btrfs_device_stats b/plugins/disk/btrfs_device_stats index 8555c280..c055d119 100755 --- a/plugins/disk/btrfs_device_stats +++ b/plugins/disk/btrfs_device_stats @@ -1,5 +1,39 @@ #!/usr/bin/env python3 -# + + +""" +=pod + +=head1 NAME + +btrfs_device_stats - Script to monitor btrfs device statistics + +=head1 CONFIGURATION + +Simply create a symlink in your plugins directory like with any other plugin. +No configuration needed. + +=head2 DEFAULT CONFIGURATION + +=head1 BUGS + +=head1 AUTHOR + +2019, HaseHarald + +=head1 MAGIC MARKERS + + #%# family=auto + #%# capabilities=autoconf suggest + +=head1 LICENSE + +LGPLv3 + +=cut +""" + + # This file contains a munin-plugin to gather btrfs statistics per device. # # This is free software: you can redistribute it and/or modify diff --git a/plugins/disk/btrfs_device_usage b/plugins/disk/btrfs_device_usage index e7265de8..ab683e0d 100755 --- a/plugins/disk/btrfs_device_usage +++ b/plugins/disk/btrfs_device_usage @@ -1,5 +1,39 @@ #!/usr/bin/env python3 -# + + +""" +=pod + +=head1 NAME + +btrfs_device_usage - Script to monitor usage of btrfs devices + +=head1 CONFIGURATION + +Simply create a symlink in your plugins directory like with any other plugin. +No configuration needed. + +=head2 DEFAULT CONFIGURATION + +=head1 BUGS + +=head1 AUTHOR + +2019, HaseHarald + +=head1 MAGIC MARKERS + + #%# family=auto + #%# capabilities=autoconf suggest + +=head1 LICENSE + +LGPLv3 + +=cut +""" + + # This file contains a munin-plugin to gather btrfs statistics per device. # # This is free software: you can redistribute it and/or modify From 3f92394b23b0a0a56e7cb0511eed8f01be1357ab Mon Sep 17 00:00:00 2001 From: HaseHarald Date: Tue, 25 Aug 2020 22:01:19 +0200 Subject: [PATCH 9/9] Touchups on configuration. --- plugins/disk/btrfs_device_stats | 7 +++++-- plugins/disk/btrfs_device_usage | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/plugins/disk/btrfs_device_stats b/plugins/disk/btrfs_device_stats index c055d119..0959381e 100755 --- a/plugins/disk/btrfs_device_stats +++ b/plugins/disk/btrfs_device_stats @@ -11,7 +11,10 @@ btrfs_device_stats - Script to monitor btrfs device statistics =head1 CONFIGURATION Simply create a symlink in your plugins directory like with any other plugin. -No configuration needed. +Must be run as root. + +[btrfs_device_stats] +user root =head2 DEFAULT CONFIGURATION @@ -24,7 +27,7 @@ No configuration needed. =head1 MAGIC MARKERS #%# family=auto - #%# capabilities=autoconf suggest + #%# capabilities=autoconf =head1 LICENSE diff --git a/plugins/disk/btrfs_device_usage b/plugins/disk/btrfs_device_usage index ab683e0d..c5c7238f 100755 --- a/plugins/disk/btrfs_device_usage +++ b/plugins/disk/btrfs_device_usage @@ -11,7 +11,10 @@ btrfs_device_usage - Script to monitor usage of btrfs devices =head1 CONFIGURATION Simply create a symlink in your plugins directory like with any other plugin. -No configuration needed. +Must be run as root. + +[btrfs_device_usage] +user root =head2 DEFAULT CONFIGURATION @@ -24,7 +27,7 @@ No configuration needed. =head1 MAGIC MARKERS #%# family=auto - #%# capabilities=autoconf suggest + #%# capabilities=autoconf =head1 LICENSE