1、CPU负载
uptime
cpu=uptime | awk '{print $NF}'
echo “CPU最近15分钟负载为$cpu”
![](https://img2022.cnblogs.com/blog/2705490/202204/2705490-20220420223848903-528472385.png)
2、内存容量
free -m
free -m | awk '/Mem:/{print $4}'
![](https://img2022.cnblogs.com/blog/2705490/202204/2705490-20220420225554213-1648198584.png)
3、硬盘空间
df -h
df -h | awk '/sda/{print $4}' #查的是根分区剩余容量
![](https://img2022.cnblogs.com/blog/2705490/202204/2705490-20220420230011381-1365930803.png)
4、网卡流量
ifconfig ens33
ifconfig ens33 | awk '/RX p/{print $5}'
1414852
ifconfig ens33 | awk '/TX p/{print $5}'
1183133
![](https://img2022.cnblogs.com/blog/2705490/202204/2705490-20220420230431607-476693363.png)
5、安装的软件包数量
rpm -qa | wc -l
![](https://img2022.cnblogs.com/blog/2705490/202204/2705490-20220420231527714-1967806075.png)
6、账户数量
cat /etc/passwd | wc -l
![](https://img2022.cnblogs.com/blog/2705490/202204/2705490-20220420231701384-1399504555.png)
7、当前登录的账户数量
who | wc -l
![](https://img2022.cnblogs.com/blog/2705490/202204/2705490-20220420232022384-2035247473.png)
8、进程数量
ps aux | wc -l
![](https://img2022.cnblogs.com/blog/2705490/202204/2705490-20220420232112601-1342618225.png)
9、输错密码的主机
grep "Failed" /var/log/secure | awk '{print $(NF-3)}'
grep "Failed" /var/log/secure | awk '{print $(NF-3)}' | sort | uniq -c
grep "Failed" /var/log/secure | awk '{print $(NF-3)}' | sort | uniq -c | awk '{print $2"输错密码"$1"次"}'
![](https://img2022.cnblogs.com/blog/2705490/202204/2705490-20220420235112471-1185724354.png)
![](https://img2022.cnblogs.com/blog/2705490/202204/2705490-20220421000010531-462203902.png)
10、本地IP地址
ifconfig ens33
ifconfig ens33 | awk '/inet/ {print $2}'
ifconfig ens33 | awk '$1=="inet" {print $2}'
![](https://img2022.cnblogs.com/blog/2705490/202204/2705490-20220421000946990-919712960.png)