Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Zabbix ODBC monitoring Monitoring MySQL

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following content mainly brings you the use of Zabbix ODBC monitoring monitoring MySQL. The knowledge mentioned here, which is slightly different from books, is summed up by professional and technical personnel in the process of contact with users, and has a certain value of experience sharing. I hope to bring help to the majority of readers.

1. Create a group ODBC Templates

two。 Create Template SQL Server and Template MySQL

3. Install unixODBC on Zabbbix

Shell > yum-y install unixODBC unixODBC-devel

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

UnixODBC has a list of supported databases and drivers:

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

For MySQL:

A) install the unixODBC driver

Shell > yum install mysql-connector-odbc

B) configure unixODBC

We complete the configuration of ODBC 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 installed ODBC database drivers:

[mysql]

Description = ODBC for MySQL

Driver = / usr/lib/libmyodbc5.so

Detailed description of parameters:

Attribute

Description

Mysql

Database driver name

Description

Database driver description

Driver

Database driver library location

You can use the following command to find the location of the ODBC driver:

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 = ABCabctomy 123

Port = 3306

Database = DBAdmin

Detailed description of parameters:

Attribute

Description

Test

Data source name (DSN)

Description

Data source description

Driver

Database driver name specified in odbcinst.ini

Server

Database CVM 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'@'%' identified by' ABCabceflower than MySQL > flush privileges

I have created a DBAdmin library here 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 an isql tool in the Zabbix server unixODBC package that we use to verify that it is working:

Shell > isql szlinux01

+-+

| | Connected! |

| | |

| | sql-statement |

| | help [tablename] |

| | quit |

| | |

+-+

SQL >

E) add monitoring items to the new Template MySQL template created by Zabbix

The database monitoring items that you must specify:

Types

Database monitoring is selected here

Key value

Enter db.odbc.Select [unique _ description,data_source_name], where the only description is used to identify the monitor item in the trigger.

The data source name must be set to in odbc.ini.

User name

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

Password

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

SQL query

Enter SQL for query

Information type

To know the type of data returned by the query, choose the correct type. If an incorrect information type is used, the monitoring item will become unsupported.

F) the monitored server szlinux01 will connect to the template and view the data:

For the above use of Zabbix ODBC monitoring monitoring MySQL, if you need to know more, you can continue to pay attention to the innovation of our industry. If you need professional answers, you can contact the pre-sales and after-sales on the official website. I hope this article can bring you some knowledge updates.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report