時間:2020-10-11來源:www.outletmksalestore.com作者:電腦系統城
利用shell腳本實現每隔60秒磁盤內存數據監控
?1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
#!/bin/bash #Author:GaoHongYu #QQ:1061767621 #Time:2019-12-24 18:43:22 #Name:ncjk.sh #Version:V1.0 clear xtip=$( hostname -I) cprl=$( df -Th | head -2| tail -1| cut -d " " -f 10) cpky=$( df -Th | head -2| tail -1| cut -d " " -f 12) cpbfb=$( df -Th | head -2| tail -1| cut -d " " -f 18) ncrl=$( free -m | head -2| tail -1| cut -d " " -f 13) ncsy=$( free -m | head -2| tail -1| cut -d " " -f 22)BC=$( echo "scale=2;$ncsy/$ncrl*100" | bc | cut -d "." -f 1) i=1 while [ $i - le 60 ]; do echo -e '\n' echo -e '\n' echo "-----磁盤監控系統-----" echo "--作者:Mr_GaoHongYu--" echo -n "監控本機IP地址:" $xtip echo -e '\n' echo "-----磁盤使用情況-----" echo -n "系統磁盤總容量:" $cprl echo -e '\n' echo -n "當前磁盤可用容量:" $cpky echo -e '\n' echo -n "可用容量百分比:" $cpbfb echo -e '\n' echo "-----內存使用情況-----" echo -n "內存總容量:" $ncrl echo -e '\n' echo -n "內存已使用:" $ncsy echo -e '\n' echo -n "內存已用百分比:" echo "$BC%" sleep 60 let i++ done |
效果如圖:
以上就是shell腳本實現磁盤監控系統的詳細內容,更多關于shell 磁盤監控的資料請關注腳本之家其它相關文章!
2020-10-11
詳解shell 函數定義與調用2020-10-11
一鍵配置本地yum源的shell腳本2020-03-19
學會這些Shell小技巧,我就愛上Linux了Shell 是一個用 C 語言編寫的程序,它是用戶使用 Linux 的橋梁。Shell 既是一種命令語言,又是一種程序設計語言。這篇文章主要介紹了shell腳本之備份數據庫、代碼上線,需要的朋友可以參考下...
2020-02-24
Kubernetes/K8s CFSSL 證書相關,各節點訪問之間使用證書驗證可靠性 work node ——> load banlancer ——>api server ——>etcd<——etcd worknode 訪問load banlancer 需要驗證證書的有限性 所以需要同一個ca根證書,...
2020-02-24