Skip to content

Instantly share code, notes, and snippets.

@hydrian
Created April 17, 2020 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hydrian/14be38f1ac51695f40eb3e9d70543905 to your computer and use it in GitHub Desktop.
Save hydrian/14be38f1ac51695f40eb3e9d70543905 to your computer and use it in GitHub Desktop.
disk_sudo definition
object CheckCommand "disk_sudo" {
import "plugin-check-command"
import "disk"
command = [ "/usr/bin/sudo", "/usr/lib/nagios/plugins/check_disk" ]
timeout = 1m
arguments += {
"-A" = {
description = "Explicitly select all paths. This is equivalent to -R .*"
set_if = "$disk_all$"
}
"-C" = {
description = "Clear thresholds"
set_if = "$disk_clear$"
}
"-E" = {
description = "For paths or partitions specified with -p, only check for exact paths"
set_if = "$disk_exact_match$"
}
"-I" = {
description = "Regular expression to ignore selected path/partition (case insensitive) (may be repeated)"
order = 2
repeat_key = true
value = "$disk_ignore_eregi_path$"
}
"-K" = {
description = "Exit with CRITICAL status if less than PERCENT of inode space is free"
value = "$disk_inode_cfree$"
}
"-L" = {
description = "Only check local filesystems against thresholds. Yet call stat on remote filesystems to test if they are accessible (e.g. to detect Stale NFS Handles)"
set_if = "$disk_stat_remote_fs$"
}
"-M" = {
description = "Display the mountpoint instead of the partition"
set_if = "$disk_mountpoint$"
}
"-R" = {
description = "Case insensitive regular expression for path/partition (may be repeated)"
repeat_key = true
value = "$disk_eregi_path$"
}
"-W" = {
description = "Exit with WARNING status if less than PERCENT of inode space is free"
value = "$disk_inode_wfree$"
}
"-X" = {
description = "Ignore all filesystems of indicated type (may be repeated)"
repeat_key = true
value = "$disk_exclude_type$"
}
"-c" = {
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"
order = -3
required = true
value = "$disk_cfree$"
}
"-e" = {
description = "Display only devices/mountpoints with errors"
set_if = "$disk_errors_only$"
}
"-f" = {
description = "Don't account root-reserved blocks into freespace in perfdata"
set_if = "$disk_ignore_reserved$"
}
"-g" = {
description = "Group paths. Thresholds apply to (free-)space of all partitions together"
value = "$disk_group$"
}
"-i" = {
description = "Regular expression to ignore selected path or partition (may be repeated)"
order = 2
repeat_key = true
value = "$disk_ignore_ereg_path$"
}
"-k" = {
description = "Same as --units kB"
set_if = "$disk_kilobytes$"
}
"-l" = {
description = " Only check local filesystems"
set_if = "$disk_local$"
}
"-m" = {
description = "Same as --units MB"
set_if = "$disk_megabytes$"
}
"-p" = {
description = "Path or partition (may be repeated)"
order = 1
repeat_key = true
value = "$disk_partitions$"
}
"-p_old" = {
order = 1
value = "$disk_partition$"
}
"-r" = {
description = "Regular expression for path or partition (may be repeated)"
repeat_key = true
value = "$disk_ereg_path$"
}
"-t" = {
description = "Seconds before connection times out (default: 10)"
value = "$disk_timeout$"
}
"-u" = {
description = "Choose bytes, kB, MB, GB, TB (default: MB)"
value = "$disk_units$"
}
"-w" = {
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"
order = -3
required = true
value = "$disk_wfree$"
}
"-x" = {
description = "Ignore device (only works if -p unspecified)"
value = "$disk_partitions_excluded$"
}
"-x_old" = "$disk_partition_excluded$"
}
vars.disk_cfree = "10%"
vars.disk_exclude_type = [
"none",
"tmpfs",
"sysfs",
"proc",
"configfs",
"devtmpfs",
"devfs",
"mtmfs",
"tracefs",
"cgroup",
"fuse.gvfsd-fuse",
"fuse.gvfs-fuse-daemon",
"fdescfs"
]
vars.disk_megabytes = true
vars.disk_wfree = "20%"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment