Zabbix主机:CentOS Stream 8
Zabbix版本6.0
SQL Server版本:Microsoft SQL Server 2008 R2
Zabbix主机上配置:
wget http://mirrors.ibiblio.org/freetds/stable/freetds-stable.tgz
tar -zxvf freetds-stable.tgz
cd freetds-0.91/
./configure
make
make install
修改/usr/local/etc/freetds.conf全局配置版本号tds version为8.0
#vim /usr/local/etc/freetds.conf
[global]
# TDS protocol version
; tds version = 4.2
tds version = 8.0
连接测试
tsql -H 10.199.18.122 -p 1433 -U sa -P 123456
安装unixODBC unixODBC-devel
yum -y install unixODBC unixODBC-devel
修改配置
#vim /etc/odbcinst.ini
[FreeTDS]
Description = Free Sybase & MS SQL Driver
Driver = /usr/local/lib/libtdsodbc.so
Setup = /usr/lib64/libtdsS.so
Driver64 = /usr/local/lib/libtdsodbc.so
Setup64 = /usr/lib64/libtdsS.so
Port = 1433
#vim /etc/odbc.ini
[mssql1]###名称自定义,zabbix监控界面填入的DSN名称
Driver = FreeTDS
Server = 10.199.18.122
PORT = 1433
TDS_Version = 8.0
[mssql2]
Driver = FreeTDS
Server = 10.199.18.123
PORT = 1433
TDS_Version = 8.0
测试连接
[root@zabbix ~]# isql -v mssql1 sa 123456
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> quit
Zabbix添加主机,选择模板MSSQL by ODBC