您当前的位置: 首页 >  linux

江湖有缘

暂无认证

  • 0浏览

    0关注

    446博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Linux下脚本实战之系统监控

江湖有缘 发布时间:2021-05-03 13:35:15 ,浏览量:0

Linux下脚本实战之系统监控
  • 一、脚本要求
  • 二、脚本内容
  • 三、运行脚本

一、脚本要求

1.监控系统的CPU、内存、硬盘使用率

二、脚本内容
#!/bin/bash
##########################################################
#File Name:monitor.sh
#Version:V1.0
#Aurhor:
#Emali:
#Created Time:2021-05-03 12:45:32
#Description:
##########################################################


#! /bin/bash
DATETIME=$(date +%F" "%H%M)
IP=$(ifconfig bond0 |awk '/netmask/ {print $2}')
which vmstat &> /dev/null
if [ ! $? = 0 ];then
echo "vmstat command no found,please install the package!"
exit 10
elif [  $? = 0 ] ; then



## mem the state
TOTAL=$(free -m |awk '/Mem/ {print $2}')
USED=$(free -m |awk '/Mem/ {print $3}')
FREE=$(free -m |awk '/Mem/ {print $4+$6}')
if [ $FREE -lt 1024 ];
关注
打赏
1665849170
查看更多评论
立即登录/注册

微信扫码登录

0.0594s