用nagios檢測內存

插件腳本

#!/bin/bash

f=`free -m | awk ''NR==2{print $4}'`

b=`free -m | awk ''NR==2{print $6}'`

c=`free -m | awk ''NR==2{print $7}'`

total=$(($f+$b+$c))

if [ $total -ge 400 ];then

     echo "me wen ti"

     exit 0;

elif [ $total -lt 400 ] && [ $total -gt 100 ];then

      echo "warning"

      exit 1;

else

      echo "err nei cun bu zu"

       exit 2

fi

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章