The connection number of Zabbix3.2 monitoring database in distributed monitoring system

Source: Internet
Author: User

In the? Distributed monitoring System Zabbix3.2 jump Pit Guide? Distributed monitoring System Zabbix3.2 to add mail alarms to exceptions? already described how to install and alarm. This article describes how to monitor other ports and configure custom monitoring entries by introducing the number of 3306 port connections in the monitoring database.

Add a monitoring script

To create a new script on the client you want to monitor:

/usr/local/zabbix/alertscripts/check_3306_port_num.sh

The contents are as follows:

#!/bin/bashss?-an|grep?3306|grep? Estab|wc?-l

? This script is simple, is to get 3306 ports already established connection, and "Wc-l" to count the total number of rows, in short, the final return is an integer

Note: If the alertscripts directory does not exist, you need to create
To add execute permissions to the script:
#chmod a+x check_3306_port_num.sh

Configuring Client Files

Modify the Zabbix_agentd configuration file and add a "userparameter":
#vi/usr/local/zabbix/etc/zabbix_agentd.conf
Add the following content:

Change? Unsafeuserparameters=1 add? userparameter=3306connectnum,/usr/local/zabbix/alertscripts/check_3306_port_num.sh

Note: the "3306connectNum" Here is Item key, which cannot be duplicated with the existing one, and needs to be used later

Restart Zabbix_agentd

#systemctl Restart Zabbix-agent


Zabbix server-side test to get data

#zabbix_get-S 192.168.80.30-k 3306connectNum
The output is as follows:
48V
Note: The above 192.168.80.30 refers to the client's ip,3306connectnum is the key we want to test, the return of 587 is 3306 database port connection number

New templates, monitoring items, and graphics in the Zabbix Web interface

To create a new template:
To configure the –> template –> Create a template:
Template name: Template App MySQL (option exists)

To add a monitoring entry to the template:

Open the template –> monitoring item –> Create a monitoring entry:
Name: MySQL 3306 Port Connection number
Key value: 3306connectNum
Selected information type is numeric

To add a graphic:

Open the template –> graphics –> Create graphics:
Name: Mysql 3306 Port Connection number
Monitoring items: Add the monitoring item that you just created

?

After you bind the template to the host:

Host "find the monitored host" graphic "

Note here that you need to add a reference to the template App mysql templates for this host.

Check the changes in the number of connections in a few minutes:

To this end, we use Zabbix to customize the configuration of the number of connections that monitor one port. Of course, according to the principle I mentioned above, using Zabbix to monitor some other services will be no longer difficult.

The above content refers to other online materials, but also thanks to other users to share.


The connection number of Zabbix3.2 monitoring database in distributed monitoring system

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.