From 47b3ed948d04382e29a34bb629e9e5edd68ebe18 Mon Sep 17 00:00:00 2001 From: Louis Sautier Date: Tue, 10 Mar 2015 18:46:27 +0100 Subject: [PATCH] Fix check_disk default thresholds and document the change of unit fixes #8673 Signed-off-by: Michael Friedrich --- doc/3-monitoring-basics.md | 42 ++++++++++++++++++++++++-------- doc/7-icinga-template-library.md | 9 +++++-- itl/command-plugins.conf | 4 +-- test/config/8063.conf | 42 ++++++++++++++++++++++++-------- 4 files changed, 73 insertions(+), 24 deletions(-) diff --git a/doc/3-monitoring-basics.md b/doc/3-monitoring-basics.md index 86c2137f3..bb52e26a7 100644 --- a/doc/3-monitoring-basics.md +++ b/doc/3-monitoring-basics.md @@ -1058,16 +1058,38 @@ can also be inherited from a parent template using additive inheritance (`+=`). command = [ PluginDir + "/check_disk" ] arguments = { - "-w" = "$disk_wfree$%" - "-c" = "$disk_cfree$%" - "-W" = "$disk_inode_wfree$%" - "-K" = "$disk_inode_cfree$%" - "-p" = "$disk_partitions$" - "-x" = "$disk_partitions_excluded$" + "-w" = { + value = "$disk_wfree$" + description = "Exit with WARNING status if less than INTEGER units of disk are free or Exit with WARNING status if less than PERCENT of disk space is free" + required = true + } + "-c" = { + value = "$disk_cfree$" + description = "Exit with CRITICAL status if less than INTEGER units of disk are free or Exit with CRITCAL status if less than PERCENT of disk space is free" + required = true + } + "-W" = { + value = "$disk_inode_wfree$" + description = "Exit with WARNING status if less than PERCENT of inode space is free" + } + "-K" = { + value = "$disk_inode_cfree$" + description = "Exit with CRITICAL status if less than PERCENT of inode space is free" + } + "-p" = { + value = "$disk_partitions$" + description = "Path or partition (may be repeated)" + repeat_key = true + order = 1 + } + "-x" = { + value = "$disk_partitions_excluded$" + description = "Ignore device (only works if -p unspecified)" + } } - vars.disk_wfree = 20 - vars.disk_cfree = 10 + vars.disk_wfree = "20%" + vars.disk_cfree = "10%" } > **Note** @@ -1098,8 +1120,8 @@ string values for passing multiple partitions to the `check_disk` check plugin. vars += config - vars.disk_wfree = 10 - vars.disk_cfree = 5 + vars.disk_wfree = "10%" + vars.disk_cfree = "5%" } diff --git a/doc/7-icinga-template-library.md b/doc/7-icinga-template-library.md index a9714df96..029842015 100644 --- a/doc/7-icinga-template-library.md +++ b/doc/7-icinga-template-library.md @@ -129,12 +129,17 @@ dig_lookup | **Optional.** The address that should be looked up. Check command object for the `check_disk` plugin. +> **Note** +> +> `disk_wfree` and `disk_cfree` require the percent sign compared to older versions. +> If omitted, disk units can be used. This has been changed in **2.3.0**. + Custom Attributes: Name | Description ------------------------|------------------------ -disk_wfree | **Optional.** The free space warning threshold in %. Defaults to 20. -disk_cfree | **Optional.** The free space critical threshold in %. Defaults to 10. +disk_wfree | **Optional.** The free space warning threshold. Defaults to "20%". If the percent sign is omitted, units from `disk_units` are used. +disk_cfree | **Optional.** The free space critical threshold. Defaults to "10%". If the percent sign is omitted, units from `disk_units` are used. disk_inode_wfree | **Optional.** The free inode warning threshold. disk_inode_cfree | **Optional.** The free inode critical threshold. disk_partition | **Optional.** The partition. **Deprecated in 2.3.** diff --git a/itl/command-plugins.conf b/itl/command-plugins.conf index 5f345c25c..1f4262d74 100644 --- a/itl/command-plugins.conf +++ b/itl/command-plugins.conf @@ -603,8 +603,8 @@ object CheckCommand "disk" { } } - vars.disk_wfree = 20 - vars.disk_cfree = 10 + vars.disk_wfree = "20%" + vars.disk_cfree = "10%" vars.disk_megabytes = true vars.disk_exclude_type = ["none", "tmpfs", "sysfs", "proc", "devtmpfs", "devfs", "mtmfs"] } diff --git a/test/config/8063.conf b/test/config/8063.conf index fe3bcc787..991372c46 100644 --- a/test/config/8063.conf +++ b/test/config/8063.conf @@ -4,16 +4,38 @@ object CheckCommand "8063-my-disk" { command = [ PluginDir + "/check_disk" ] arguments = { - "-w" = "$disk_wfree$%" - "-c" = "$disk_cfree$%" - "-W" = "$disk_inode_wfree$%" - "-K" = "$disk_inode_cfree$%" - "-p" = "$disk_partitions$" - "-x" = "$disk_partitions_excluded$" + "-w" = { + value = "$disk_wfree$" + description = "Exit with WARNING status if less than INTEGER units of disk are free or Exit with WARNING status if less than PERCENT of disk space is free" + required = true + } + "-c" = { + value = "$disk_cfree$" + description = "Exit with CRITICAL status if less than INTEGER units of disk are free or Exit with CRITCAL status if less than PERCENT of disk space is free" + required = true + } + "-W" = { + value = "$disk_inode_wfree$" + description = "Exit with WARNING status if less than PERCENT of inode space is free" + } + "-K" = { + value = "$disk_inode_cfree$" + description = "Exit with CRITICAL status if less than PERCENT of inode space is free" + } + "-p" = { + value = "$disk_partitions$" + description = "Path or partition (may be repeated)" + repeat_key = true + order = 1 + } + "-x" = { + value = "$disk_partitions_excluded$" + description = "Ignore device (only works if -p unspecified)" + } } - vars.disk_wfree = 20 - vars.disk_cfree = 10 + vars.disk_wfree = "20%" + vars.disk_cfree = "10%" } object Host "8063-my-server" { @@ -37,8 +59,8 @@ apply Service "8063-" for (disk => config in host.vars.local_disks) { vars += config - vars.disk_wfree = 10 - vars.disk_cfree = 5 + vars.disk_wfree = "10%" + vars.disk_cfree = "5%" assign where host.vars.local_disks }