linux抓取load average数据

Posted wuzhiyi

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux抓取load average数据相关的知识,希望对你有一定的参考价值。

#!/bin/bash

echo ‘‘ > ~/getLoad/1minute.txt
echo ‘‘ > ~/getLoad/5minute.txt
echo ‘‘ > ~/getLoad/15minute.txt

#get load average data
oneminute=`uptime |awk {print $8}`
fiveminute=`uptime |awk {print $9}`
fifteenminute=`uptime |awk {print $10}`
SECONDS=0

# echo ${oneminute:0:4}

while [ $SECONDS -le 1200 ]
do
echo ${oneminute:0:4} >> ~/getLoad/1minute.txt
echo ${fiveminute:0:4} >> ~/getLoad/5minute.txt
echo ${fifteenminute} >> ~/getLoad/15minute.txt
sleep 2
done

 

以上是关于linux抓取load average数据的主要内容,如果未能解决你的问题,请参考以下文章

Linux 突然很占cpu load average 很高!!!

linux load average

理解LINUX LOAD AVERAGE的误区

Linux 平均负载 Load Average 详解

linux 平均负载 load average 的含义

深入理解 Linux Load Average