1.1 准备脚本
vi /root/my_shell/get_os_info.sh
#!/bin/bash
#if [ $# -ne 1 ];then
# echo "Usage: get_os_info.sh conn_cnt|total_mem|cpu_cnt"
#else
# exit 1
#fi
case $1 in
conn_cnt)
w|awk 'NR==1{print $4}'
;;
total_mem)
free -m
本文介绍了如何使用vi编辑器创建一个脚本get_os_info.sh,监控Linux系统连接数、内存和CPU核心数,并通过Zabbix Agent配置参数,实现远程监控。遇到权限问题后,作者详细展示了如何解决并成功获取被监控端的数据。最后,展示了如何在Zabbix服务端添加自定义监控项和查看结果。
1.1 准备脚本
vi /root/my_shell/get_os_info.sh
#!/bin/bash
#if [ $# -ne 1 ];then
# echo "Usage: get_os_info.sh conn_cnt|total_mem|cpu_cnt"
#else
# exit 1
#fi
case $1 in
conn_cnt)
w|awk 'NR==1{print $4}'
;;
total_mem)
free -m
2151

被折叠的 条评论
为什么被折叠?