zabbix监控sqlserver
zabbix监控sqlserver
下载安装freetds
wget -c 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 && makeinstall
FreeTDS默认安装在/usr/local/freetds目录当中,库文件在相应的lib目录下。
#vim /etc/ld.so.conf
/usr/local/freetds/lib
配置生效
#ldconfig
修改/usr/local/freetds/etc/freetds.conf
全局配置版本号tds version为8.0
#vim /usr/local/freetds/etc/freetds.conf
[global]
# TDS protocol version
; tds version = 4.2
tds version = 8.0
连接测试
/usr/local/freetds/bin/tsql -H 192.168.31.158 -p 1433 -U sa -P 12345678
安装unixODBC unixODBC-devel
yum -y install unixODBC unixODBC-devel
修改配置
#vim /etc/odbcinst.ini
[FreeTDS]
Driver = /usr/local/freetds/lib/libtdsodbc.so.0
#vim /etc/odbc.ini
[sql1]
Driver = FreeTDS
Server = 192.168.31.158
PORT = 1433
TDS_Version = 8.0
[sql2]
Driver = FreeTDS
Server = 192.168.31.159
PORT = 1433
TDS_Version = 8.0
测试连接
#isql -v sql1 sa 12345678
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
选择模板