赞
踩
1.监控系统的CPU、内存、硬盘使用率
#!/bin/bash ########################################################## #File Name:monitor.sh #Version:V1.0 #Aurhor: #Emali: #Created Time:2021-05-03 12:45:32 #Description: ########################################################## #! /bin/bash DATETIME=$(date +%F" "%H%M) IP=$(ifconfig bond0 |awk '/netmask/ {print $2}') which vmstat &> /dev/null if [ ! $? = 0 ];then echo "vmstat command no found,please install the package!" exit 10 elif [ $? = 0 ] ; then ## mem the state TOTAL=$(free -m |awk '/Mem/ {print $2}') USED=$(free -m |awk '/Mem/ {print $3}') FREE=$(free -m |awk '/Mem/ {print $4+$6}') if [ $FREE -lt 1024 ];then echo " Date: $DATETIME Hosts: $IP Problem: Total=$TOTAL,USE=$USED,Free=$FREE" fi ## the cpu state US=$(vmst
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。