#!/bin/sh SWAP_THR=5.0 SWAP_TOTAL=`LANG=C && free | egrep '^Swap:' | tr -s ' ' | awk '{print $2}'` SWAP_USED=`LANG=C && free | egrep '^Swap:' | tr -s ' ' | awk '{print $3}'` define_ngfile_path check_swap if [ ${SWAP_TOTAL} -gt 0 ]; then SWAP_PUSED=`scale=3; echo "(${SWAP_USED} * 100.0) / ${SWAP_TOTAL}" | bc -s` if [ `echo "${SWAP_PUSED} > ${SWAP_THR}" | bc` -eq 1 ]; then echo "SWAP ALERT!!" fi fi