#!/bin/bash cpu_usage_idle=`top -b -n 1 | grep Cpu | awk ‘{print $5}‘ | cut -f 1 -d "."` let cpu_usage=100-$cpu_usage_idle mem_total=`awk ‘/MemTotal/{total=$2}/MemFree/{free=$2}END{print (total-free)/1024}‘ /proc/meminfo` mem_usage=`echo ${mem_total} | awk ‘{print $1*100/16240}‘` month=`date ‘+%m‘` day=`date ‘+%d‘` hour=`date ‘+%H‘` echo "CPU利用率 $cpu_usage" echo "内存使用率 $mem_usage
时间: 2024-12-29 09:19:29