diff --git a/doc/10-icinga-template-library.md b/doc/10-icinga-template-library.md index 24feec845..a8ef71e73 100644 --- a/doc/10-icinga-template-library.md +++ b/doc/10-icinga-template-library.md @@ -3217,6 +3217,34 @@ ceph_client_key | **Optional.** Ceph client keyring file. ceph_whitelist | **Optional.** Whitelist regexp for ceph health warnings. ceph_details | **Optional.** Run 'ceph health detail'. +#### btrfs + +The [btrfs plugin](https://github.com/knorrie/python-btrfs/) +is used to check the btrfs storage health on the server. + +The plugin requires `sudo` permissions. +You can add a sudoers file to allow your monitoring user to use the plugin, i.e. edit /etc/sudoers.d/icinga and add: +``` +icinga ALL=(root) NOPASSWD:/usr/lib/nagios/plugins/check_btrfs +``` + +and set the correct permissions: +```bash +chown -c root: /etc/sudoers.d/icinga +chmod -c 0440 /etc/sudoers.d/icinga +``` + +[monitoring-plugins-btrfs](https://packages.debian.org/monitoring-plugins-btrfs) provide the necessary binary on debian/ubuntu. + +Custom attributes passed as [command parameters](03-monitoring-basics.md#command-passing-parameters): + +Name | Description +-----------------|--------------------------------------------------------- +btrfs_awg | **Optional.** Exit with WARNING status if less than the specified amount of disk space (in GiB) is unallocated +btrfs_acg | **Optional.** Exit with CRITICAL status if less than the specified amount of disk space (in GiB) is unallocated +btrfs_awp | **Optional.** Exit with WARNING status if more than the specified percent of disk space is allocated +btrfs_acp | **Optional.** Exit with CRITICAL status if more than the specified percent of disk space is allocated +btrfs_mountpoint | **Required.** Path to the BTRFS mountpoint ### Virtualization diff --git a/itl/plugins-contrib.d/storage.conf b/itl/plugins-contrib.d/storage.conf index 3e413e0ab..1d1822ea0 100644 --- a/itl/plugins-contrib.d/storage.conf +++ b/itl/plugins-contrib.d/storage.conf @@ -102,3 +102,35 @@ object CheckCommand "ceph" { } } } + +object CheckCommand "btrfs" { + import "plugin-check-command" + command = [ "sudo", PluginDir + "/check_btrfs" ] + + arguments = { + "--allocated-warning-gib" = { + value = "$btrfs_awg$" + description = "Exit with WARNING status if less than the specified amount of disk space (in GiB) is unallocated" + } + "--allocated-critical-gib" = { + value = "$btrfs_acg$" + description = "Exit with CRITICAL status if less than the specified amount of disk space (in GiB) is unallocated" + } + "--allocated-warning-percent" = { + value = "$btrfs_awp$" + description = "Exit with WARNING status if more than the specified percent of disk space is allocated" + } + "--allocated-critical-percent" = { + value = "$btrfs_acp$" + description = "Exit with CRITICAL status if more than the specified percent of disk space is allocated" + } + "--mountpoint" = { + value = "$btrfs_mountpoint$" + description = "Path to the BTRFS mountpoint" + required = true + } + } + vars.btrfs_awp = 80 + vars.btrfs_acp = 90 +} +