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

Zabbix monitors SQL Server database

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Principle: Connect SQL Server through ODBC, and send the data queried by SQL statement to zabbix server for analysis.

Brief description of configuration steps:

1. Install Freetds, unixODBC, unixODBC-devel on zabbix server to enable it to access SQL Server database.

2. Configure ODBC to access Sql Server database.

3. Custom SQL statements

4. Add item of monitoring database in zabbix management interface.

Operation process:

1, Install Freetds, unixODBC, unixODBC-devel on zabbix server

#yum install unixODBC unixODBC-devel

Note: freetds usually does not exist in yum source, need to download, compile and install

Baidu Cloud Address: pan.baidu.com/s/1cb09tW

#wget http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz

#tar -zxvf freetds-stable.tgz

#cd freetds-0.91/

#./ configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib

#make

#make install

2. Configure ODBC to access SQL Server database

a. Find the location of the libtdsodbc.so.0 driver

#locate libtdsodbc.so.0

If there is no locate command, install mlocate to execute

#yum install mlocate && updatedb

Find the file libtdsodbc.so.0 and copy its path to make a soft connection

#ln -s /usr/local/freetds/lib/libtdsodbc.so.0 /usr/lib64/libtdsodbc.so.0

b. Modify/etc/odbcinst.ini to add a line

#vim /etc/odbcinst.ini

[FreeTDS]

Driver = /usr/lib64/libtdsodbc.so.0

c. Configure odbc connection information

#vim/etc/odbc.ini #Write the following configuration file

[DBNAME] #defines an identifier name

Driver = FreeTDS

Server = [SQL Server IP]

PORT = 1433

TDS_Version = 8.0

d. Connection database test

#isql -v DBNAME (defined in odbc.ini) Database Account Database Password

Connect to the database and execute SQL tests

Custom SQL statements vary according to requirements.

4. Add item of monitoring database in zabbix management interface.

Find the SQL Server main sentence being monitored and add item

Data collected by zabbix. This is consistent with the SQL query above.

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