自定义监控
ss -ant | awk 'NR>1 {++s[$1]} END { for(k in s) print k,s[k] }'

- 查看其中监听状态的数量
ss -ant | awk 'NR>1 {++s[$1]} END { for(k in s) print k,s[k] }' | grep 'LISTEN' | cut -d ' ' -f2
步骤开始了
#!/bin/bash
contcp(){
tart=$1
Numbers=$( ss -ant | awk 'NR>1 {++s[$1]} END { for(k in s) print k,s[k] }' | grep "$tart"|cut -d ' ' -f2 )
echo $Numbers
}
contcp $1
# 有些变量美元符因为markdown格式看不到了, 需要对比图片

- 2 写入agent include 的文件夹下的*.conf 文件中
vim /etc/zabbix/zabbix_agentd.d/tcp1.conf
UserParameter=seetcp1[*],/root/seetcp1.sh $1

- 3 加执行权限

- 4 重启zabbix server 端 、zabbix agent 监控端,测试连接
/apps/zabbix_server/bin/zabbix_get -s 192.168.47.163 -k 'seetcp1[LISTEN]'

- 5 添加监控项


- 和之前一样完成完成其他几种状态数据监控


- 6 添加图形
-

- 多次选择添加 完成不同项的添加完成



- 7 稍微过一段时间后查看

