To add a monitoring entry for the number of TCP connections on Zabbix

Source: Internet
Author: User

Set up a Zabbix monitoring service, but there is no default template to monitor the number of TCP connections on the Zabbix. After going online search many articles do not have a complete operation steps, maybe I still small white bar.

The following details to write down my operation steps.

1, check the installation package and understand the Zabbix to the number of TCP connections monitoring configuration process.

Zabbix server-side and client installation will no longer be described, directly said the operation process (the process in RPM, for example, the source package is simpler).

A, the required installation package on the client: Zabbix-agent, Zabbix-sender. Zabbix-get and Zabbix-web can be used without installation.

b, to understand the monitoring configuration process of TCP connections: the client through the Zabbix-agent service through the local script (custom or self-writing shell or other type of script) to collect the corresponding values of the number of links, such as the establishment of connected, listening, waiting, and so on. It is then sent to the server. The server side establishes the monitoring of the number of connections to the client through the Iteam key.

2. Write a script that monitors the status of the TCP connection at the client and put it in a custom location.

 /etc/zabbix/scripts/tcp_connection_status.sh#!/bin/bashsynrecv () {a= '/usr/sbin/ss -ant |  awk  ' {++s[$1]} end {for (k in s)  print k,s[k]} '  | grep  ' Syn-recv '  | awk  ' {print $2} ' if test -z  ' $a ' then   echo  0else   echo  $afi}estab () {a= '/usr/sbin/ss -ant | awk  ' {++s[$1]}  end {for (K in s)  print k,s[k]} '  | grep  ' Estab '  | awk   ' {print $2} ' if test -z  ' $a ' then   echo 0else    echo  $afi}timewait () {a= '/usr/sbin/ss -ant | awk  ' {++s[$1]} end {for (k  in s)  print k,s[k]} '  | grep  ' time-wait '  | awk  ' {print $2} ' if test -z  "$a" then   echo 0else   echo  $afi}total () {a= '/usr/sbin/ss -ant | awk  ' begin{t=0;}  { t++; } end{print t; } ' if test -z  ' $a ' then    echo 0else   echo  $afi}$1

2. Modify the ZABBIX-AGENTD service configuration file in the client

/etc/zabbix/zabbix-agentd.confunsafeuserparameters=1userparameter=synrecv,/etc/zabbix/scripts/tcp_connection_ status.sh synrecvuserparameter=estab,/etc/zabbix/scripts/tcp_connection_status.sh ESTABUserParameter=timewait,/ Etc/zabbix/scripts/tcp_connection_status.sh Timewaituserparameter=total,/etc/zabbix/scripts/tcp_connection_ status.sh Total

In the above code, Userparameter is followed by the Zabbix monitoring item value, which is the key entry.

3. Restart the Zabbix-agent service on the client and test the configured key key.

Service zabbix-agent Restart Zabbix_agentd-t synrecv (key value)

650) this.width=650; "title=" Zabbixs5015.png "src=" http://s3.51cto.com/wyfs02/M01/84/3B/wKiom1eIz0-SBz4hAAAlZCj3_ Ky685.png-wh_500x0-wm_3-wmp_4-s_3480652189.png "alt=" Wkiom1eiz0-sbz4haaalzcj3_ky685.png-wh_50 "/>

4, test key on the server side, and add the monitoring item Iteam.

Zabbix_get-s 1.1.1.1 (client IP address)-K synrecv (key value)

650) this.width=650; "title=" Zabbixserver59.png "src=" http://s1.51cto.com/wyfs02/M02/84/3B/ Wkiom1ei0c3xubtqaaawvs4ofau351.png-wh_500x0-wm_3-wmp_4-s_552985372.png "alt=" Wkiom1ei0c3xubtqaaawvs4ofau351.png-wh_50 "/>

Add a value. Add configuration to Zabbix Web interface--templates--Create or customize templates--project--

Create a monitoring entry-- fill in the name and key value , the key value is tcpconnect--and then you can add graphics and so on

650) this.width=650; "title=" Iteam957.png "src=" http://s4.51cto.com/wyfs02/M00/84/3B/wKioL1eI0SOCKGW4AACgX_ Jzzhe521.png-wh_500x0-wm_3-wmp_4-s_324879208.png "alt=" Wkiol1ei0sockgw4aacgx_jzzhe521.png-wh_50 "/>

When you finish adding iteams, the status becomes Enable.

650) this.width=650; "title=" Tieam5200231.png "src=" http://s1.51cto.com/wyfs02/M01/84/3B/ Wkiom1ei0dyj7smmaabg34mjujg535.png-wh_500x0-wm_3-wmp_4-s_1961075491.png "alt=" Wkiom1ei0dyj7smmaabg34mjujg535.png-wh_50 "/>

Add this to completion.

The above has successfully realized the Zabbix to the TCP connection state monitoring.

This article is from the "rookie" blog, please be sure to keep this source http://chier11.blog.51cto.com/4922641/1826837

To add a monitoring entry for the number of TCP connections on Zabbix

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.