利用shell脚本实现每隔60秒磁盘内存数据监控脚本
16lz
2021-04-14
#!/bin/bash#Author:GaoHongYu#QQ:1061767621#Time:2019-12-24 18:43:22#Name:ncjk.sh#Version:V1.0clearxtip=$(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=1while [ $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 60let i++done
效果如图:
更多相关文章
- volatile关键字?MESI协议?指令重排?内存屏障?这都是啥玩意
- 【linux】循序渐进学运维-基础篇-磁盘加密解密技术
- 用好HugePage,告别Linux性能故障
- Linux中启动Eclipse报错: JVM terminated. Exit code=1
- Huge pages (标准大页)和 Transparent Huge pages(透明大页)
- ASM重命名包含OCR/vote file的磁盘组
- zabbix的简单介绍
- 【Linux】虚拟磁盘挂载错误,不能进入系统(fsck.ext3:no such file
- Linux 磁盘分区管理