婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁(yè) > 知識(shí)庫(kù) > 獲取磁盤(pán)IO與系統(tǒng)負(fù)載Load的shell腳本

獲取磁盤(pán)IO與系統(tǒng)負(fù)載Load的shell腳本

熱門(mén)標(biāo)簽:百度地圖標(biāo)注錯(cuò)了有責(zé)任嗎 客服外呼系統(tǒng)怎么樣 江蘇云電銷(xiāo)機(jī)器人公司 如果做線上地圖標(biāo)注 揭陽(yáng)智能電話機(jī)器人推薦 打電話機(jī)器人接我是他的秘書(shū) 地圖標(biāo)注員都是年輕人 華鋒e路航港口地圖標(biāo)注 河南信譽(yù)好的不封卡電話外呼系統(tǒng)

1,提取系統(tǒng)負(fù)載信息

復(fù)制代碼 代碼如下:

#!/bin/sh
host=$(hostname)
channel=$(hostname | sed 's/[0-9]//g')
runday=$(date +%Y-%m-%d)
IPhost=$(/sbin/ifconfig  | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}')
i=1
 while [ $i -le 120 ];do
 rundaytime=$(date "+%Y-%m-%d %H:%M:%S")
 /bin/cat /proc/loadavg | awk -F " " '{print "'"$rundaytime"'"","$1","$2","$3","$4","$5}' >> /tmp/$(hostname)-${runday}load.txt
 /usr/bin/sar -u 1 1 | grep -v Average | /bin/sed -n '4,$p' | awk -F " " '{print "'"$rundaytime"'"","$4","$6","$7","$9}'  >>  /tmp/$(hostname)-${runday}sar.txt
 i=$((i+1))
 sleep 59
done
awk -F "," '{print "'"$host"'"",""'"$channel"'"",""'"$IPhost"'"","$1","$2","$3","$4","$5}' /tmp/$(hostname)-${runday}sar.txt > /tmp/$(hostname)${runday}sar.txt
awk -F "," '{print "'"$host"'"",""'"$channel"'"",""'"$IPhost"'"","$1","$2","$3","$4","$5","$6}' /tmp/$(hostname)-${runday}load.txt  > /tmp/$(hostname)${runday}load.txt
rm -rf /tmp/$(hostname)-${runday}sar.txt
rm -rf /tmp/$(hostname)-${runday}load.txt

2,代碼2

復(fù)制代碼 代碼如下:

#!/bin/sh
PDIR=/monitor/nagios/shell/sarlog
runday=$(date +%Y-%m-%d)
TmpDir=/monitor/nagios/tmp
for i in `/bin/cat /monitor/nagios/shell/sarlog/machine.lst`
do
   /usr/bin/scp ${PDIR}/sarlog.sh ${i}:/root /usr/bin/rsh ${i} /root/sarlog.sh
done

3,代碼3

復(fù)制代碼 代碼如下:

#!/bin/sh
PDIR=/monitor/nagios/shell/sarlog
runday=$(date +%Y-%m-%d)
TmpDir=/monitor/nagios/shell/sarlog/log
Machinelst=/monitor/nagios/shell/sarlog/machine.lst
for i in `/bin/cat /monitor/nagios/shell/sarlog/machine.lst`
do
   /usr/bin/scp ${i}:/tmp/*${runday}sar.txt ${TmpDir}
   /usr/bin/scp ${i}:/tmp/*${runday}load.txt ${TmpDir}
done
/bin/cat ${TmpDir}/*${runday}sar.txt >> ${TmpDir}/Tmp${runday}.txt
/bin/cat ${TmpDir}/*${runday}load.txt >> ${TmpDir}/${runday}loadResult.txt
count=1
Line=$(cat ${TmpDir}/Tmp${runday}.txt |wc -l)
>${TmpDir}/Result${runday}.txt
while [ "$count" -le "$Line" ]
do
        Idle=$(sed -n "${count}p" ${TmpDir}/Tmp${runday}.txt | awk -F "," '{print $8}')
        Busy=`echo "scale=2;100-$Idle"|bc`
        sed -n "${count}p" ${TmpDir}/Tmp${runday}.txt | sed  "s/$/,$Busy/g" >> ${TmpDir}/${runday}sarResult.txt
        let count=count+1
done
/usr/local/mysql/bin/mysql -u root -D nagios -pbj7n48dM  EOF
   load data infile '${TmpDir}/${runday}sarResult.txt' into table t_daily_stats FIELDS TERMINATED BY  ',';
   load data infile '${TmpDir}/${runday}loadResult.txt' into table t_daily_load FIELDS TERMINATED BY  ',';
EOF
rm -rf ${TmpDir}/*${runday}sar.txt
rm -rf ${TmpDir}/*${runday}load.txt
rm -rf rm -rf ${TmpDir}/*${runday}.txt

您可能感興趣的文章:
  • shell腳本快速創(chuàng)建、格式化、掛載新添加的磁盤(pán)實(shí)現(xiàn)方法詳解
  • powershell遠(yuǎn)程管理服務(wù)器磁盤(pán)空間的實(shí)現(xiàn)代碼
  • 一天一個(gè)shell命令 linux好管家--磁盤(pán)--df命令詳解
  • Powershell中獲取所有磁盤(pán)盤(pán)符的方法
  • 使用shell腳本采集系統(tǒng)cpu、內(nèi)存、磁盤(pán)、網(wǎng)絡(luò)等信息
  • 監(jiān)視磁盤(pán)使用情況的Shell腳本(本地+遠(yuǎn)程)
  • shell腳本快速創(chuàng)建格式化磁盤(pán)與詳細(xì)操作步驟

標(biāo)簽:金昌 赤峰 婁底 邵陽(yáng) 許昌 巴彥淖爾 淘寶邀評(píng) 馬鞍山

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《獲取磁盤(pán)IO與系統(tǒng)負(fù)載Load的shell腳本》,本文關(guān)鍵詞  獲取,磁盤(pán),與,系統(tǒng),負(fù)載,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《獲取磁盤(pán)IO與系統(tǒng)負(fù)載Load的shell腳本》相關(guān)的同類信息!
  • 本頁(yè)收集關(guān)于獲取磁盤(pán)IO與系統(tǒng)負(fù)載Load的shell腳本的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 梅州市| 英德市| 定安县| 饶平县| 静海县| 苏尼特左旗| 灵丘县| 离岛区| 广元市| 千阳县| 攀枝花市| 邢台县| 进贤县| 张家界市| 浦江县| 莆田市| 大港区| 合肥市| 泸溪县| 长武县| 木兰县| 裕民县| 赤水市| 泰来县| 岢岚县| 宝兴县| 泽州县| 鹰潭市| 石棉县| 无为县| 米易县| 时尚| 闻喜县| 深圳市| 仁寿县| 武穴市| 定兴县| 逊克县| 镇宁| 沽源县| 南康市|