Monitor MySQL with Zabbix ODBC monitoring

Source: Internet
Author: User

Monitor MySQL with Zabbix ODBC monitoring

1. Create a group ODBC Templates

650) this.width=650; "title=" clip_image002 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "Alt=" Clip_ image002 "src=" http://s3.51cto.com/wyfs02/M01/96/47/wKioL1keysuwPIENAABgHo84rPc577.jpg "border=" 0 "height=" 294 "/ >

2. Create template SQL Server and template MySQL

650) this.width=650; "title=" clip_image004 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "Alt=" Clip_ image004 "src=" http://s3.51cto.com/wyfs02/M02/96/47/wKioL1keyszwpXvLAABjrzgxSWQ092.jpg "border=" 0 "height=" 302 "/ >

650) this.width=650; "title=" clip_image006 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "Alt=" Clip_ image006 "src=" http://s3.51cto.com/wyfs02/M00/96/46/wKiom1keys2zcmguAABN5qoZVqQ889.jpg "border=" 0 "height=" 191 "/ >

3. Install the UNIXODBC on the Zabbbix

shell> yum-y Install UnixODBC unixodbc-devel

4. Install the UNIXODBC driver for the corresponding database on the Zabbix

UNIXODBC has a supported database and driver list:

Http://www.unixodbc.org/drivers.html

For MySQL:

A) Installing the UNIXODBC Drive

shell> Yum Install Mysql-connector-odbc

b) Configuration Unixodbc

We do the ODBC configuration by editing the Odbcinst.ini and Odbc.ini files. First, verify the location of the configuration file with the following command:

Shell> Odbcinst-j

Odbcinst.ini is used to list the ODBC database drivers that have been installed:

[MySQL]

Description = ODBC for MySQL

Driver =/usr/lib/libmyodbc5.so

Detailed parameters:

Property

Describe

Mysql

Database driver name

Description

Database driver Description

Driver

Database Drive Library Location

You can use the following command to locate the ODBC-driven location:

shell> Find/-name ' lib*odbc*.so '

Odbc.ini is used to define the database source:

[SZLINUX01]

Description = MySQL Database szlinux01

Driver = MySQL

Server = 192.168.137.3

User = Zabbix

Password = [email protected] #123

Port = 3306

Database = DBAdmin

Detailed parameters:

Property

Describe

Test

Data source Name (DSN)

Description

Data source Description

Driver

Database-driven name specified in Odbcinst.ini

Server

Database Server Ip/dns

User

Database User for connection

Password

Database user Password

Port

Database connection Port

Database

Database name

c) Create a user on the monitored service area szlinux01 and authorize:

Mysql> Grant Usage,select on * * to ' Zabbix ' @ ' percent ' identified by ' [email protected] #123 ';mysql> flush privileges;

I've created a dbadmin library to store some custom performance and business monitoring data. For example, count the data size and the number of table rows for a business library.

SELECT table_name,data_length+index_length,table_rows from INFORMATION_SCHEMA. TABLES;

D) There is a isql tool in the Zabbix server UNIXODBC package that we use to verify the normal:

Shell> isql szlinux01

+---------------------------------------+

| connected! |

| |

| sql-statement |

| Help [TableName] |

| Quit |

| |

+---------------------------------------+

Sql>

e) Add a monitoring entry in Zabbix new template MySQL templates

650) this.width=650; "title=" clip_image008 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "Alt=" Clip_ image008 "src=" http://s3.51cto.com/wyfs02/M02/96/47/wKioL1keys6SHEhPAACgy8r6wSg543.jpg "border=" 0 "height=" 445 "/ >

You must specify the database monitoring entries:

Type

Select Database Monitoring here

Key value

Enter db.odbc.select[Unique_description,data_source_name], where the unique description is used to identify the monitoring item in the trigger.

The data source name must be set to Odbc.ini.

User name

Enter the database user name (if the user name is already set in Odbc.ini)

Password

Enter the database user password (if the password is already set in Odbc.ini)

SQL query

Enter SQL query

Type of information

To know the type of data returned by the query, select the correct type. If the incorrect information type is used, the monitoring item becomes unsupported.

f) Connect the monitor server szlinux01 to the template and view the data:

650) this.width=650; "title=" clip_image010 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "Alt=" Clip_ image010 "src=" http://s3.51cto.com/wyfs02/M01/96/46/wKiom1keys7Bz0KbAABX_ZBp-8k070.jpg "border=" 0 "height=" 250 "/ >


650) this.width=650; "title=" clip_image012 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;margin:0px;padding-right:0px; "Alt=" Clip_ image012 "src=" http://s3.51cto.com/wyfs02/M01/96/46/wKiom1keys_Q7kbRAAAdnFeEi3A331.jpg "border=" 0 "height=" 51 "/ >


Reference:

Https://www.zabbix.com/documentation/3.4/manual/config/items/itemtypes/odbc_checks



This article is from the SQL Server deep Dive blog, so be sure to keep this source http://ultrasql.blog.51cto.com/9591438/1927671

Monitor MySQL with Zabbix ODBC monitoring

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.