天天看点

系统一般信息监控查看shell.磁盘,负载等达阀值告警机制,改进测试中.

  1 #!/bin/sh

  2 #Create by Qrui

  3 while [ "1"="1" ]

  4 do

  5 clear

  6

  7 echo "=======menu by Qrui======="

  8 echo "1)Show Time"

  9 echo "2)CPU load"

 10 echo "3)Memory free"

 11 echo "4)DiskSpace status"

 12 #echo "5)display input file_directory disk use!"

 13 echo "5)current login users"

 14 echo "0)Exit"

 15 echo "=========================="

 16

 17 echo -n "Enter you chose [0-5]:"

 18 read Chose

 19

 20 case ${Chose} in

 21 0)exit;;

 22 1)date +%T;;

 23 2)uptime|awk -F":" '{print $5}';;

 24 3)free -m |grep "Mem"|awk '{print $4}';;

 25 4)df -lh;;

 26 #5)du -sh $2;;

 27 5)who;;

 28 *)echo "This is not between 0-5,sorry!";;

 29 esac

 30

 31 echo -n "Do you contiue [y/n]:"

 32 read contine

 33

 34 if [ "${contine}" == "n" -o "${contine}" =="N" ]

 35 then

 36    exit

 37 fi

 38

 39 done