檢視2222端口
[root@yunwei-ceshi ~]# lsof -i:2222
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
docker-pr 7179 root 4u IPv6 378945139 0t0 TCP *:EtherNet/IP-1 (LISTEN)
檢視docker運作junpserver程序名稱
[root@yunwei-ceshi ~]# ps -ef | grep docker
root 7179 26590 0 08:04 ? 00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 2222 -container-ip 172.17.0.2 -container-port 2222
編輯zabbix配置檔案
[root@yunwei-ceshi ~]# cd /usr/local/zabbix/etc/
[root@yunwei-ceshi etc]# ls
zabbix_agentd.conf zabbix_agentd.conf.d
[root@yunwei-ceshi etc]# vim zabbix_agentd.conf
找到
UserParameter=
添加:
# UserParameter=
UserParameter=jumpserver,sh /usr/local/zabbix/etc/process_sh/jumpserver.sh
jumpserver//程序名稱
sh /usr/local/zabbix/etc/process_sh/jumpserver.sh//執行的腳本
然後進入腳本目錄編輯腳本
[root@yunwei-ceshi etc]# mkdir /usr/local/zabbix/etc/process_sh/
[root@yunwei-ceshi etc]# cd /usr/local/zabbix/etc/process_sh/
[root@yunwei-ceshi process_sh]# vim jumpserver.sh
#/bin/bash
lsof -i:2222 | grep docker | wc -l
賦予權限
[root@yunwei-ceshi process_sh]# chmod 755 jumpserver.sh
重新開機zabbix_agentd
[root@yunwei-ceshi process_sh]# /etc/init.d/zabbix_agentd restart
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLicWZwpmLzgDOyYzN1YDZ3gTO3EDN2Y2M5IGOiNGOyEGNxQDZlJ2MjFzM1ITOy8CXt92Yu4GZjlGbh5SZslmZxl3Lc9CX6MHc0RHaiojIsJye.jpeg)