NAME
Monitoring::Sneck::Checks::swap - checks how much swap is used
VERSION
Version 0.0.1
SYNOPSIS
swap|perl:swap
swap_tight|perl:swap -w 20 -c 50 -n critical
swapping|perl:swap -W 100 -C 1000
DESCRIPTION
Checks the percent of swap used, across every swap device. On Linux it is read from /proc/meminfo. On FreeBSD it is from running swapinfo, as the sysctl it keeps it in is not one BSD::Sysctl reads. Other OSes are UNKNOWN.
Having no swap is OK, unless --no-swap says otherwise, as plenty of hosts run without it on purpose.
Swap being used but sitting there is harmless, while swapping all the time is not. --rate-warning and --rate-critical check the pages swapped in and out per second since the last run, from pswpin and pswpout in /proc/vmstat on Linux, and v_swappgsin and v_swappgsout through BSD::Sysctl on FreeBSD. The counts are kept in a state file, see "read_state" in Monitoring::Sneck::Checks::base, so the first run, or one after a reboot, has no rate. They are only kept and checked if one of those is given.
OPTIONS
- -w, --warning :: Range of percent used. Default :: 80
- -c, --critical :: Range of percent used. Default :: 90
- -n, --no-swap :: What having no swap is, ok, warning, critical, or unknown. Default :: ok
- -W, --rate-warning :: Range of pages swapped in and out per second.
- -C, --rate-critical :: Range of pages swapped in and out per second.
METHODS
check
Does the check.
rate_status
Works out the pages swapped per second since the last run, if --rate-warning or --rate-critical is given, saving the counts for the next, and adds its perfdata.
Returns the code and text to add to the message, OK and '' if not checked or there is no rate yet. Dies if the state can not be kept.
swap_counts
Returns the pages swapped in and out since boot. Dies if they can not be found.
swap
Returns the bytes of swap in total and used. Dies if they can not be found.
swapinfo
Runs swapinfo -k and adds up its devices. Dies if it fails.
Returns the bytes of swap in total and used.