[ZBX-24390] MSSQL by Zabbix agent2 Template Update Created: 2024 Apr 23  Updated: 2025 Jun 12  Resolved: 2025 Jun 12

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Templates (T)
Affects Version/s: 6.4.14
Fix Version/s: None

Type: Patch request Priority: Trivial
Reporter: Sivan Koren Assignee: Oleksii Zagorskyi
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Steps to reproduce:

  1. Install Zabbix Agent2 on Zabbix Host
  2. Install Zabbix MSSQL Plugin on Zabbix Host
  3. Add a SQL Server host
  4. Add the MSSQL by Zabbix agent2 Template
  5. Fill out the SQL Server host specific Macros

Result:
The TCP port monitoring item check always fails.

Expected:
The TCP port item check should not fail, as the agent is successfully connecting and polling the database.

SOLUTION:

1. The template needs an additional macro:
{$MSSQL.HOSTNAME}

2. The item in the template should use the following key instead:
net.tcp.service[tcp,\{$MSSQL.HOSTNAME},\{$MSSQL.PORT}]



 Comments   
Comment by Sivan Koren [ 2024 Apr 24 ]

It looks like I forgot to specify. The check always fails for REMOTE SQL Servers. It would work if the agent2 is on the SQL Server host, because the existing item resolves the server path to 127.0.0.1.

The recommended solution allows for monitoring a remote server.

Comment by Christophe BARBIER [ 2024 Aug 23 ]

I have the same problem but in my case, the agent is installed on the sql server itself. 

After some investigation, it seems that this check is made from the Zabbix server regardless where the agent and plugin are installed. 

 

Can you confirm that point ? 

Comment by Sivan Koren [ 2024 Aug 23 ]

I believe if the Agent2, and Zabbix Server, and SQL Server are all on the same host then it would work without my recommended fix because the SQL Server does exist at the loopback address in such a configuration.

If that's not the case then I would expect it to fail without the configuration I've recommended above.

For my configuration, I have Zabbix Server and Agent2 on one machine, and SQL Server on another. No agent is installed on the SQL Server host. The recommended fix I've offered works for this configuration. I believe it is the intended configuration for Agent2.

I hope that helps.

Comment by Oleksii Zagorskyi [ 2025 Jun 12 ]

Current version of the template is using key:

net.tcp.service[tcp,{$MSSQL.HOST},{$MSSQL.PORT}]

Both macros are defined in the template and have default values localhost:1433

Comment by Oleksii Zagorskyi [ 2025 Jun 12 ]

Closing as outdated and cannot reproduce.

Generated at Wed Jul 16 09:41:07 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.