Monitoring SQL Server 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/wKiom1kezB3hyiELAABgHo84rPc364.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/M01/96/47/wKiom1kezB7AZMPnAABjrzgxSWQ854.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/M01/96/47/wKioL1kezB7RtAsNAABN5qoZVqQ322.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 SQL Server:
A) Installing the UNIXODBC Drive
shell> Yum Install FreeTDS
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
You can use the following command to locate the ODBC-driven location:
shell> Find/-name ' libtdsodbc* '
Add SQL Server Driver FreeTDS in/etc/odbcinst.ini:
Shell> Vim/etc/odbcinst.ini
[FreeTDS]
Description = ODBC for SQL Server
Driver =/usr/lib64/libtdsodbc.so.0
Setup =/usr/lib64/libtdss.so
FileUsage = 1
FreeTDS driver has a command-line tool TSQL can also connect SQL Server, it can also be a file/etc/freetds.conf can be configured to connect to the DSN of SQL Server.
The TDS protocol version corresponding to the editions of SQL Server:
Http://www.freetds.org/userguide/choosingtdsprotocol.htm
To configure ODBC connection information:
Shell> Vim/etc/odbc.ini
[SZSQL01]
Driver = FreeTDS
Server = 192.168.137.6
Port = 1433
Database = DBAdmin
Tds_version = 8.0
This time, we do not set the user name password in the file, but in the page setup.
To check if the drive sees your data source:
Shell> Odbcinst-q–s
c) Create the user and authorize on the monitored SQL Server 2016 server szsql01.
d) Connect the database test on the Zabbix.
shell> isql-v szsql01 Database user name password
650) this.width=650; "title=" clip_image013 "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_ image013 "src=" http://s3.51cto.com/wyfs02/M02/96/47/wKiom1kezB6y04hDAAAOLZFs4Cg645.png "border=" 0 "height=" 154 "/ >
e) Install the Zabbix 3.2 agent on the szsql01.
Open PowerShell as an administrator and download the installation package.
650) this.width=650; "title=" clip_image015 "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_ image015 "src=" http://s3.51cto.com/wyfs02/M02/96/47/wKioL1kezB_BxK2DAACX3oqOZ1I344.jpg "border=" 0 "height=" 264 "/ >
After decompression, rename the Zabbix_agents_3.2.0.win to Zabbix, copy the configuration file under the Conf directory to the parent directory, rename it to zabbix_agentd.conf, and edit and update the following values.
#Server =[zabbix Server IP]
#Hostname =[hostname of client system]
server=192.168.137.5
serveractive=192.168.137.5
hostname=192.168.137.6
Note: Hostname is the same as when you created host.
Install the Zabbix agent as a service and start the service:
650) this.width=650; "title=" clip_image017 "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_ image017 "src=" http://s3.51cto.com/wyfs02/M00/96/47/wKiom1kezCCyygHDAADezpevss4323.jpg "border=" 0 "height=" 326 "/ >
650) this.width=650; "title=" clip_image018 "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_ image018 "src=" http://s3.51cto.com/wyfs02/M00/96/47/wKioL1kezCHz1_6OAAA3wJmBtK8237.png "border=" 0 "height=" 467 "/ >
Check the agent-initiated error log c:\zabbix_agentd.log to see if it is normal.
f) Add a monitoring entry in Zabbix new template SQL Server templates
650) this.width=650; "title=" clip_image019 "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_ image019 "src=" http://s3.51cto.com/wyfs02/M01/96/47/wKiom1kezCHzI5DlAAA98vR22Yw544.png "border=" 0 "height=" 416 "/ >
g) Connect the template to the monitored server szlinux01 and view the data:
650) this.width=650; "title=" clip_image021 "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_ image021 "src=" http://s3.51cto.com/wyfs02/M00/96/47/wKiom1kezCLg2mvvAABbGbiKnGQ189.jpg "border=" 0 "height=" 251 "/ >
650) this.width=650; "title=" clip_image023 "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_ image023 "src=" http://s3.51cto.com/wyfs02/M00/96/47/wKioL1kezCbSi5YkAAAhBjXm218814.jpg "border=" 0 "height=" 73 "/ >
650) this.width=650; "title=" clip_image025 "style=" border-top:0px;border-right:0px;background-image:none; border-bottom:0px;padding-top:0px;padding-left:0px;border-left:0px;padding-right:0px, "alt=" clip_image025 "src=" Http://s3.51cto.com/wyfs02/M02/96/47/wKioL1kezCbjAjEiAACGAazbjJw191.jpg "border=" 0 "height=" 338 "/>
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/1927672
Monitoring SQL Server with Zabbix ODBC monitoring