Performance counters are fragile (localization, missing objects). For critical metrics, use db.odbc.select with custom T-SQL.
Example UserParameter in zabbix_agentd.conf:
UserParameter=mssql.connections,echo "SELECT cntr_value FROM sys.dm_os_performance_counters WHERE object_name='SQLServer:General Statistics' AND counter_name='User Connections'" | tsql -S localhost -U zabbix -P pass -D master -o /tmp/out -q
Or better (Windows):
UserParameter=mssql.connections,powershell -Command "& $conn=New-Object Data.Odbc.OdbcConnection('DSN=ZabbixSQL');$conn.Open();$cmd=$conn.CreateCommand();$cmd.CommandText='SELECT cntr_value FROM sys.dm_os_performance_counters WHERE object_name=''SQLServer:General Statistics'' AND counter_name=''User Connections''';$cmd.ExecuteScalar();$conn.Close() "
<!-- Item to track fetch failures --> <item name="MSSQL: Info fetch status" key="mssql.info.fetch.status"> <type>Zabbix agent</type> <key>perf.ms sql[fetch.status]</key> <value_type>Numeric (unsigned)</value_type> <units>status</units> <delay>60s</delay> <description>1 = fetch failed, 0 = fetch successful</description> </item>
<!-- Item with last value tracking --> <item name="MSSQL: Last successful fetch" key="msql.last.success.time"> <type>Zabbix agent</type> <key>perf.mssql[last_success]</key> <value_type>Numeric (unsigned)</value_type> <units>unixtime</units> <delay>60s</delay> </item>
The "No data for 30m" error in MSSQL monitoring is rarely a network outage and almost always a script execution failure. By increasing the Timeout parameter to accommodate heavy SQL queries and ensuring PowerShell Execution Policies allow the scripts to run, administrators can restore data flow and maintain visibility into their database infrastructure.
"MSSQL: Failed to fetch info data (or no data for 30m)" typically indicates a communication or permission breakdown between Zabbix and your SQL Server zabbix mssql failed to fetch info data -or no data for 30m-
. This usually occurs when using the "MSSQL by ODBC" or "MSSQL by Zabbix agent 2" templates. Common Solutions Trust Server Certificate (ODBC Driver 18+)
: If you recently upgraded to ODBC Driver 18, it forces encryption by default. If your SQL Server uses a self-signed certificate, you must add TrustServerCertificate=yes to your connection string or the file. Some users found reverting to ODBC Driver 17
resolved the issue immediately as it is more compatible with older configurations. Database Permissions
: Ensure the Zabbix monitoring user has the following permissions on the MSSQL instance: VIEW SERVER STATE (for 2017/2019) or VIEW SERVER PERFORMANCE STATE (for 2022). VIEW ANY DEFINITION Access to the database for job monitoring. Correct Connection Syntax
or Zabbix macros, the port must be specified after a comma, not a colon (e.g., Server = 192.168.1.50,1433 as a separate directive often fails. Macro Configuration : Verify that your host macros are correctly set: $MSSQL.USER $MSSQL.PASSWORD $MSSQL.DSN (must match the name in your /etc/odbc.ini on the Zabbix server/proxy). Agent 2 Configuration
: If using the Zabbix Agent 2 plugin, ensure you have configured the mssql.conf file (located in zabbix_agent2.d/plugins.d/ ) with the correct URI, username, and password. Diagnostic Steps Or better (Windows): UserParameter=mssql
MSSQL: Failed to fetch info data (or no data for 30m) - Zabbix
ybcnyc. Junior Member. Joined: Jun 2022. Posts: 1. MSSQL monitoring - MSSQL: Failed to fetch info data (or no data for 30m) 16-06-
Problem: MSSQL: Failed to fetch info data (or no data for 30m)
Troubleshooting Zabbix MSSQL: "Failed to fetch info data" or "No data for 30m" Errors
Zabbix is a popular monitoring tool used to track the performance and health of various systems, including Microsoft SQL Server (MSSQL) databases. However, users may sometimes encounter issues with Zabbix's MSSQL monitoring, such as "Failed to fetch info data" or "No data for 30m" errors. These errors can be frustrating and may indicate a problem with the database, the Zabbix agent, or the monitoring configuration. In this article, we'll explore the possible causes of these errors and provide step-by-step guides on how to troubleshoot and resolve them.
Understanding the Errors
The "Failed to fetch info data" error typically occurs when Zabbix's MSSQL monitoring item fails to retrieve data from the database. This can happen due to various reasons, such as:
On the other hand, the "No data for 30m" error usually indicates that Zabbix has not received any data from the MSSQL database for the past 30 minutes. This can be caused by:
Causes of the Errors
Before diving into the troubleshooting steps, it's essential to understand the possible causes of these errors. Some common causes include:
Troubleshooting Steps
To troubleshoot the "Failed to fetch info data" or "No data for 30m" errors, follow these steps: SQLServer:Databases after a service restart).
This error appears in the Zabbix Server logs or Item configuration preview. It means the Zabbix agent (or proxy) executed an item key—typically perf_instance["MSSQL$INSTANCE",...] or a custom UserParameter—and the SQL query returned no valid result set, a permissions error, or a malformed response.
Common triggers:
VIEW SERVER STATE or CONNECT SQL permissions.SQL2019\PROD) and the ODBC DSN is misconfigured.SQLServer:Databases after a service restart).