#!/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
本文出自 “净空蓝星” 博客,请务必保留此出处http://jingkonglanxing.blog.51cto.com/1152128/1954591
原文地址:http://jingkonglanxing.blog.51cto.com/1152128/1954591