Monitor the three-way handshake connection
The initial order is as follows
[root@mysql ~]# netstat -antp Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 1610/smbd tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 78742/zabbix_agentd tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 1610/smbd tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 1732/dnsmasq tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1608/sshd tcp 0 0 192.168.1.201:10050 192.168.1.200:40278 TIME_WAIT - tcp 0 0 192.168.1.201:10050 192.168.1.200:40272 TIME_WAIT - tcp 0 0 192.168.1.201:10050 192.168.1.200:40314 TIME_WAIT - tcp 0 0 192.168.1.201:10050 192.168.1.200:40322 TIME_WAIT - tcp 0 0 192.168.1.201:10050 192.168.1.200:40302 TIME_WAIT -
Then we get a little change to change the number of connections as TIME_WAIT
[root@mysql ~]# netstat -antp |awk 'NR>2{print $6}' |grep "TIME_WAIT"|wc -l
37
Then we will be in a slightly modified after the command written to the client's profile
[root@mysql ~]# vim /etc/zabbix/zabbix_agentd.d/tcp_status.conf
UserParameter=TIME_WAIT,netstat -ant |awk 'NR>2{print $6}' |grep "TIME_WAIT"|wc -l UserParameter=LISTEN,netstat -ant |awk 'NR>2{print $6}' |grep "LISTEN"|wc -l UserParameter=ESTABLISHED,netstat -ant |awk 'NR>2{print $6}' |grep "ESTABLISHED"|wc -l
Principle is as follows
Restart the client zabbix-agent service
[root@mysql zabbix_agentd.d]# systemctl restart zabbix-agent
In the server inquiry
[root@tz ~]# zabbix_get -s 192.168.1.201 -k TIME_WAIT 42
Add a custom monitor items
Continue to add other key
clone
Under the name can change with key
Note It is best to use now checks to determine there is no problem in the update
Normally are enabled