linux shell compiles monitoring scripts to realize the function of monitoring various computer performance data

[root@master shell]# cat monitoring_host.sh
#!/bin/bash
ip= ifconfig ens33 | awk '/inet/{print $2}'
echo "The IP of this machine is:" $ip
cpu= uptime |awk '{print "CPU的负载情况\t1分钟负载情况:"$8"\t5分钟负载情况:"$9"\t15分钟负载情况"$10}'
echo "The CPU load of this machine:" $cpu
net_in= ifconfig ens33 | awk '/RX p/{print $5}'
echo "This machine The ingress traffic of the network card is:" $net_in
net_out= ifconfig ens33 | awk '/TX p/{print $5}'
echo "The egress traffic of the local network card is:" $net_out
mem= free -h | awk '/Mem:/{print $4}'
echo "The current remaining memory of the machine:" KaTeX parse error: Undefined control sequence: \/ at position 26 : -H ... DF / | awk '/ \ / / Print $ {}. 4' echo "本机目前根分区剩余磁盘空间" $disk user=CAT / etc / the passwd | WC -l echo "本地账户数量为:"$user login=WHO | WC -l echo "当前登陆计算机的账户数量为:"$login process=PS AUX | WC -l echo "当前计算机启动的进程数量为:"$process soft=RPM -qa | WC -l`
echo " The number of software installed on the current computer is: "$soft

Guess you like

Origin blog.csdn.net/qq_34939308/article/details/112390237