zabbix - tcp state of an application set

Foreword

zabbix-agent built-in key there is no monitoring of the tcp state, but the state of tcp very important to us, commonly used tcp status of 11 species, 11 kinds we can put all the mess monitored item, and then focus on these monitoring items application set to make a tcp state together.

We can use the awkward, like this:

[root@NFS zabbix_agentd.d]# cat tcp_estab.conf 
UserParameter=tcp_estab,netstat -ant | grep -i established | wc -l  

Follows, then tcp_tstab is a key term monitoring, monitoring the number of connections, there are 10 states established, then we would not write such a 10, as follows:

[root@NFS zabbix_agentd.d]# cat tcp_estab.conf 
UserParameter=tcp_estab,netstat -ant | grep -i established | wc -l
UserParameter=tcp_time_wait,netstat -ant | grep -i time_wait| wc -l  
……

  

This is too much trouble to add 10 times, 11 times it has a lot of similarities, in addition to the name and key values ​​you want to filter status is not the same, the other are the same, we can engage in a key parameter that can be passed, What think when the state directly to the state's name as a parameter passed to the keys, which do not line yet! How do it? Here we will talk about, you will find all key system parameters can be passed, such net.tcp.port [<ip>, port], we also engage in a.

 

Tcp state custom set of applications

Host:

[root @ NFS zabbix_agentd.d] # vim tcp_status.conf 
UserParameter = tcp_status [*], netstat -ant | grep -i "$ 1" | WC the -l 

# Do not forget to restart agent agency services 
[root @ NFS zabbix_agentd.d] # systemctl restart zabbix-agent

  

 Explain, tcp_status is the key name Well, back in parentheses and asterisks are fixed format, you want to pass parameters to the inside so you have to write back $ 1 on behalf of the first argument

 zabbix端

In zabbix end test, noted above format corresponding to the format of 
[@ zabbix the root ~] -s 192.168.80.24 -k # zabbix_get tcp_status [the TIME_WAIT] 
50

Well, the most critical step is done, let's start the definition of what tcp status of the application set.

 

 The result is like this

 

 

 

 

 Be patient, do this once, after save these templates down, directly apply the next time, there is underneath a batch change, to change the time to see every 5 seconds, so help us to do the experiment.

 We can install the host to be monitored on httpd, and then press down with ab, we can clearly see the effect of the latest data will change back, sometimes turns gray, on behalf of overtime, never-ending, we go to " management - queue (select details) "will see the details.

Timeout, zabbix default configuration file which is defined as three seconds, we can change a timeout value in /etc/zabbix/zabbix_agentd.conf inside, it can be changed.

 

skill:

General management --- --- --- You can change the other, "do not support the project refresh time"

Queue - an overview, see the number of requests is less than a fixed value of the time taken

Guess you like

Origin www.cnblogs.com/yizhangheka/p/12123099.html