#!/bin/bash
#磁盘容量报警
disks=`df -Th |awk NR==7'{print $6}'`
if [ ${disks%%%*} -gt 80 ];then
echo "您的磁盘使用率为:$disks 超过80%!!!"|mail -s "磁盘空间不足" xxx@163.com
else
echo "您的磁盘空间使用率为:$disks 正常"
fi
#cpu
cpus=`vmstat |awk NR==3'{print $(NF-2)}'`
if [ $cpus -lt 10 ];then
echo "您的cup空闲率为: $cpus 已经小于10%!!!"|mail -s "cpu空闲不足" xxx@163.com
else
echo "您的cup空闲率为: $cpus 正常"
fi
检测cpu空闲率磁盘使用率,并设置报警脚本
于 2023-09-15 21:27:23 首次发布