Information:
Integration with MSSQL by ODBC DB Template
ubuntu 20.04 in Virtual BOX Mode Bridge
Microsoft ODBC Driver for SQL Server (Linux - Ubuntu) - ms odbc 18
zabbix 6.0 LTS
MSSQL server 2019 developer
I'm not able to get data from the DB in ZABBIX using the Template DB MSSQL by ODBC in my test environment and I can't find where I'm going wrong.
1 - I created the user zbx_monitor1 in MSSQL for Monitoring via graphical interface in MS SQL Server Management Studio.
2 - I gave Read (db_datareader) and Login permissions to the master, msbd and tempdb databases via GUI and other necessary permissions.
USE master;
GRANT VIEW SERVER STATE
,VIEW ANY DEFINITION
TO zbx_monitor1;
GO
use msdb;
GRANT SELECT ON OBJECT::msdb.dbo.sysjobs TO zbx_monitor1
GRANT SELECT ON OBJECT::msdb.dbo.sysjobsersers TO zbx_monitor1
GRANT SELECT ON OBJECT::msdb.dbo.sysjobactivity TO zbx_monitor1
GRANT EXECUTE ON OBJECT::msdb.dbo.agent_datetime TO zbx_monitor1
3 - I tested the login.
4 - I tested the read access to the tables with the user zbx_monitor1.
SELECT TOP (1000) *
FROM msdb.dbo.sysjobs
SELECT TOP (1000) *
FROM msdb.dbo.sysjobsersers
SELECT TOP (1000) *
FROM msdb.dbo.sysjobactivity
SELECT TOP (1000) *
FROM msdb.dbo.agent_datetime
5 - I installed the Microsoft ODBC Driver 18 on Ubuntu Server 20.04 according to the official website.
if ! [[ "18.04 20.04 21.04" == *"$(lsb_release -rs)"* ]];
then
echo "Ubuntu $(lsb_release -rs) is not currently supported.";
exit;
fi
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
Note: I also tested with msodbcsql17.
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo apt-get install -y unixodbc-dev
6 - I created the odbc.ini in /etc/odbc.ini
Note: I tested several configurations.
[D-TI-01\MSSQLSERVER01] #DSN: device name\MS SQL server name
#[MSSQLSERVER01]
#Driver = ODBC Driver 18 for SQL Server
Driver=/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.0.so.1.1
[HASHTAG="t988"]description[/HASHTAG] = 'Attempt number 342343'
#Trace = yes
#TraceFile = /tmp/odbc_sqlserver.log
Server = tcp:xx.x.xxx.xx,1433
[HASHTAG="t221"]server[/HASHTAG] = xx.x.xxx.xx
[HASHTAG="t1852"]port[/HASHTAG] = 1433
[HASHTAG="t479"]user[/HASHTAG] = zbx_monitor1
[HASHTAG="t2541"]password[/HASHTAG] = xxxxxxxxx
[HASHTAG="t245"]database[/HASHTAG] = msdb
TrustServerCertificate=YES
Encrypt=NO
7 - Include the macros on the host in Zabbix 6.0 LTS
Note: I tested several configurations.
8 - I performed ISQL test
odbcinst -q -s
[D-TI-01\MSSQLSERVER01]
root@ubusrvzbx01:/etc# odbcinst -q -d
[ODBC Driver 18 for SQL Server]
root@ubusrvzbx01:~# odbcinst -j
unixODBC 2.3.7
DRIVERS...............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size.......: 8
SQLSETPOSIROW Size.: 8
isql D-TI-01\MSSQLSERVER01 zbx_monitor1 xxxxxx
[ISQL]ERROR: Could not SQLConnect
isql D-TI-01\MSSQLSERVER01 'zbx_monitor1' 'xxxxxxx'
[ISQL]ERROR: Could not SQLConnect
isql -v "D-TI-01\MSSQLSERVER01" 'zbx_monitor1' 'zbx_monitor1'
[S1T00][unixODBC][Microsoft][ODBC Driver 18 for SQL Server]Login timeout expired
[08001][unixODBC][Microsoft][ODBC Driver 18 for SQL Server]TCP Provider: Error code 0x102
[08001][unixODBC][Microsoft][ODBC Driver 18 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server.
Server is not found or not accessible.
Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
[ISQL]ERROR: Could not SQLConnect
Clearly ODBC is not communicating with SQL Server, so I cannot identify the reason.
Sou relatively new not Zabbix. Sorry my English
Thank you for help


Problem: Database data is not being monitored. Any suggestion?
Integration with MSSQL by ODBC DB Template
ubuntu 20.04 in Virtual BOX Mode Bridge
Microsoft ODBC Driver for SQL Server (Linux - Ubuntu) - ms odbc 18
zabbix 6.0 LTS
MSSQL server 2019 developer
I'm not able to get data from the DB in ZABBIX using the Template DB MSSQL by ODBC in my test environment and I can't find where I'm going wrong.
1 - I created the user zbx_monitor1 in MSSQL for Monitoring via graphical interface in MS SQL Server Management Studio.
2 - I gave Read (db_datareader) and Login permissions to the master, msbd and tempdb databases via GUI and other necessary permissions.
USE master;
GRANT VIEW SERVER STATE
,VIEW ANY DEFINITION
TO zbx_monitor1;
GO
use msdb;
GRANT SELECT ON OBJECT::msdb.dbo.sysjobs TO zbx_monitor1
GRANT SELECT ON OBJECT::msdb.dbo.sysjobsersers TO zbx_monitor1
GRANT SELECT ON OBJECT::msdb.dbo.sysjobactivity TO zbx_monitor1
GRANT EXECUTE ON OBJECT::msdb.dbo.agent_datetime TO zbx_monitor1
3 - I tested the login.
4 - I tested the read access to the tables with the user zbx_monitor1.
SELECT TOP (1000) *
FROM msdb.dbo.sysjobs
SELECT TOP (1000) *
FROM msdb.dbo.sysjobsersers
SELECT TOP (1000) *
FROM msdb.dbo.sysjobactivity
SELECT TOP (1000) *
FROM msdb.dbo.agent_datetime
5 - I installed the Microsoft ODBC Driver 18 on Ubuntu Server 20.04 according to the official website.
if ! [[ "18.04 20.04 21.04" == *"$(lsb_release -rs)"* ]];
then
echo "Ubuntu $(lsb_release -rs) is not currently supported.";
exit;
fi
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18
Note: I also tested with msodbcsql17.
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools18
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
# optional: for unixODBC development headers
sudo apt-get install -y unixodbc-dev
6 - I created the odbc.ini in /etc/odbc.ini
Note: I tested several configurations.
[D-TI-01\MSSQLSERVER01] #DSN: device name\MS SQL server name
#[MSSQLSERVER01]
#Driver = ODBC Driver 18 for SQL Server
Driver=/opt/microsoft/msodbcsql18/lib64/libmsodbcsql-18.0.so.1.1
[HASHTAG="t988"]description[/HASHTAG] = 'Attempt number 342343'
#Trace = yes
#TraceFile = /tmp/odbc_sqlserver.log
Server = tcp:xx.x.xxx.xx,1433
[HASHTAG="t221"]server[/HASHTAG] = xx.x.xxx.xx
[HASHTAG="t1852"]port[/HASHTAG] = 1433
[HASHTAG="t479"]user[/HASHTAG] = zbx_monitor1
[HASHTAG="t2541"]password[/HASHTAG] = xxxxxxxxx
[HASHTAG="t245"]database[/HASHTAG] = msdb
TrustServerCertificate=YES
Encrypt=NO
7 - Include the macros on the host in Zabbix 6.0 LTS
Note: I tested several configurations.
8 - I performed ISQL test
odbcinst -q -s
[D-TI-01\MSSQLSERVER01]
root@ubusrvzbx01:/etc# odbcinst -q -d
[ODBC Driver 18 for SQL Server]
root@ubusrvzbx01:~# odbcinst -j
unixODBC 2.3.7
DRIVERS...............: /etc/odbcinst.ini
SYSTEM DATA SOURCES: /etc/odbc.ini
FILE DATA SOURCES..: /etc/ODBCDataSources
USER DATA SOURCES..: /root/.odbc.ini
SQLULEN Size.......: 8
SQLLEN Size.......: 8
SQLSETPOSIROW Size.: 8
isql D-TI-01\MSSQLSERVER01 zbx_monitor1 xxxxxx
[ISQL]ERROR: Could not SQLConnect
isql D-TI-01\MSSQLSERVER01 'zbx_monitor1' 'xxxxxxx'
[ISQL]ERROR: Could not SQLConnect
isql -v "D-TI-01\MSSQLSERVER01" 'zbx_monitor1' 'zbx_monitor1'
[S1T00][unixODBC][Microsoft][ODBC Driver 18 for SQL Server]Login timeout expired
[08001][unixODBC][Microsoft][ODBC Driver 18 for SQL Server]TCP Provider: Error code 0x102
[08001][unixODBC][Microsoft][ODBC Driver 18 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server.
Server is not found or not accessible.
Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
[ISQL]ERROR: Could not SQLConnect
Clearly ODBC is not communicating with SQL Server, so I cannot identify the reason.
Sou relatively new not Zabbix. Sorry my English
Thank you for help
Problem: Database data is not being monitored. Any suggestion?
Comment