728x90
[출처] https://github.com/sensu/sensu-community-plugins/blob/master/plugins/system/check-swap.sh
#!/bin/bash## Evaluate swap memory usage from Linux based systems.## Date: 2007-11-12# Author: Thomas Borger - ESG# Date: 2012-04-02# Modified: Norman Harman - norman.harman@mutualmobile.com# Date: 2013-03-13# Modified: Jean-Francois Theroux - jtheroux@lapresse.ca## The swap check is done with following command line:# vmstat | tail -n1 | awk '{ print $3 }'# get argumentswhile getopts 'w:c:hp' OPT; docase $OPT inw) WARN=$OPTARG;;c) CRIT=$OPTARG;;h) hlp="yes";;p) perform="yes";;*) unknown="yes";;esacdone# usageHELP="usage: $0 [ -w value -c value -p -h ]-w --> Warning MB < value-c --> Critical MB < value-p --> print out performance data-h --> print this help screen"if [ "$hlp" = "yes" ]; thenecho "$HELP"exit 0fiWARN=${WARN:=0}CRIT=${CRIT:=0}USED_SWAP=$((`vmstat | tail -n1 | awk '{ print $3 }'` / 1024 ))if [ "$USED_SWAP" = "" ]; thenecho "SWAP UNKNOWN -"exit 3fiif [ "$perform" = "yes" ]; thenoutput="used swap memory: $USED_SWAP MB | used swap memory="$USED_SWAP"MB;$WARN;$CRIT;0"elseoutput="used swap memory: $USED_SWAP MB"fiif (( $USED_SWAP >= $CRIT )); thenecho "SWAP CRITICAL - $output"exit 2elif (( $USED_SWAP >= $WARN )); thenecho "SWAP WARNING - $output"exit 1elseecho "SWAP OK - $output"exit 0fi
728x90
'script' 카테고리의 다른 글
InvalidCharactErerror (0) | 2016.01.11 |
---|---|
iframe javascript access parent cross domain (0) | 2014.07.14 |
JAVACRIPT 와 PHP 간 암호화 복호화 연동 (0) | 2014.06.27 |
화면회전 in javascript (0) | 2014.04.15 |
pc 표준시간대 변경에 따른 javascript 현재시간 조정 (0) | 2014.04.08 |
댓글