Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Check swap activity on Linux
Current Version
1.0
Last Release Date
2012-06-10
Compatible With
- Nagios 3.x
Owner
License
GPL
Hits
76961
Files:
File | Description |
---|---|
check_swap_activity | check_swap_activity |
This plugin is designed to determine if your Linux server is swapping excessively from physical to virtual memory. Displays swap activity in bytes (e.g. 124 bytes swapped into virtual memory in the last 2 seconds). Includes performance data for graphing.
Reviews (2)
byftobin, December 20, 2013
alext's fixes are appropriate. Here's the patch:
--- check_swap_activity 2013-12-19 10:03:53.760950053 -0500
+++ check_swap_activity-2 2013-12-20 11:26:27.860034216 -0500
@@ -96,12 +96,12 @@
LINE="OK! Swapout size in last ${DURATION} second(s): ${SWAPOUT_ACTIVITY} | swapout_size=${SWAPOUT_ACTIVITY}B;${SWAP_WARN};${SWAP_CRIT};"
echo $LINE
exit 0
-elif [ ${SWAPOUT_ACTIVITY} -gt ${SWAP_WARN} ] && [ ${SWAPOUT_ACTIVITY} -lt ${SWAP_CRIT} ] || [ ${SWAPOUT_ACTIVITY} -eq ${SWAP_WARN} ]; then
+elif [ ${SWAPOUT_ACTIVITY} -ge ${SWAP_WARN} ] && [ ${SWAPOUT_ACTIVITY} -lt ${SWAP_CRIT} ]; then
## SWAP IS IN WARNING STATE
LINE="WARNING! Swapout size in last ${DURATION} second(s): ${SWAPOUT_ACTIVITY} | swapout_size=${SWAPOUT_ACTIVITY}B;${SWAP_WARN};${SWAP_CRIT};"
echo $LINE
exit 1
-elif [ ${USED_SWAP} -gt ${SWAP_CRIT} ] || [ ${USED_SWAP} -eq ${SWAP_CRIT} ]; then
+elif [ ${SWAPOUT_ACTIVITY} -ge ${SWAP_CRIT} ]; then
## SWAP IS IN CRITICAL STATE
LINE="CRITICAL! Swapout size in last ${DURATION} second(s): ${SWAPOUT_ACTIVITY} | swapout_size=${SWAPOUT_ACTIVITY}B;${SWAP_WARN};${SWAP_CRIT};"
echo $LINE
--- check_swap_activity 2013-12-19 10:03:53.760950053 -0500
+++ check_swap_activity-2 2013-12-20 11:26:27.860034216 -0500
@@ -96,12 +96,12 @@
LINE="OK! Swapout size in last ${DURATION} second(s): ${SWAPOUT_ACTIVITY} | swapout_size=${SWAPOUT_ACTIVITY}B;${SWAP_WARN};${SWAP_CRIT};"
echo $LINE
exit 0
-elif [ ${SWAPOUT_ACTIVITY} -gt ${SWAP_WARN} ] && [ ${SWAPOUT_ACTIVITY} -lt ${SWAP_CRIT} ] || [ ${SWAPOUT_ACTIVITY} -eq ${SWAP_WARN} ]; then
+elif [ ${SWAPOUT_ACTIVITY} -ge ${SWAP_WARN} ] && [ ${SWAPOUT_ACTIVITY} -lt ${SWAP_CRIT} ]; then
## SWAP IS IN WARNING STATE
LINE="WARNING! Swapout size in last ${DURATION} second(s): ${SWAPOUT_ACTIVITY} | swapout_size=${SWAPOUT_ACTIVITY}B;${SWAP_WARN};${SWAP_CRIT};"
echo $LINE
exit 1
-elif [ ${USED_SWAP} -gt ${SWAP_CRIT} ] || [ ${USED_SWAP} -eq ${SWAP_CRIT} ]; then
+elif [ ${SWAPOUT_ACTIVITY} -ge ${SWAP_CRIT} ]; then
## SWAP IS IN CRITICAL STATE
LINE="CRITICAL! Swapout size in last ${DURATION} second(s): ${SWAPOUT_ACTIVITY} | swapout_size=${SWAPOUT_ACTIVITY}B;${SWAP_WARN};${SWAP_CRIT};"
echo $LINE
byalext, April 1, 2013
The last elif condition uses an undefined variable, ${USED_SWAP} which was probably replaced by ${SWAPOUT_ACTIVITY}. Just a heads up in case the check returns UNKNOWN status when it should be CRITICAL. Also, the double pipes can be replaced with -ge, for the two elifs.