Hello. I wanted to share with those Azure customers who have SQL Managed Instances how I began monitoring the databases with Zabbix. My environment consists of both on-premise, SQL on Azure VM, Azure SQL, and Azure SQL Managed Instance. I was able to utilize both the Template/Databases - MSSQL by ODBC and an Azure plugin for Zabbix to monitor everything except SQL Managed Instances. After looking at the results of the queries and the system views from which MSSQL by ODBC was attempting, I figured out an easy fix to begin monitoring managed instances
1. Perform a full clone of the template MSSQL by ODBC. I called mine MSSQL Managed Instance by ODBC
2. Add your instance to the ODBC configuration utilized on your server. Mine is running on CentOS
3. Go to Configuration - Templates and select the new template
4. Select the Item "MSSQL: Get performance counters"
5. Change the first SELECT of the unions from
OLD
SELECT object_name,counter_name,instance_name,cntr_value
FROM sys.dm_os_performance_counters
NEW
SELECT c.object_name,c.counter_name,d.name as instance_name,c.cntr_value
FROM sys.dm_os_performance_counters c
JOIN sys.databases d ON c.instance_name = d.physical_database_name
6. Click on Update to save your change
7. Add your host and assign the new Template to the host
8. Set a macro of "{$MSSQL.INSTANCE}" and set the value to what is returned by "SELECT DISTINCT SUBSTRING(object_name,1,18) FROM sys.dm_os_performance_counters WHERE object_name like 'MSSQL%"
9. Set a macro of "{$MSSQL.DSN}" to the friendly server name that you use for the Managed Instance.
10. Set the other macros as required by ODBC (username and password)
It will then autodisover the databases and gather performance metrics
1. Perform a full clone of the template MSSQL by ODBC. I called mine MSSQL Managed Instance by ODBC
2. Add your instance to the ODBC configuration utilized on your server. Mine is running on CentOS
3. Go to Configuration - Templates and select the new template
4. Select the Item "MSSQL: Get performance counters"
5. Change the first SELECT of the unions from
OLD
SELECT object_name,counter_name,instance_name,cntr_value
FROM sys.dm_os_performance_counters
NEW
SELECT c.object_name,c.counter_name,d.name as instance_name,c.cntr_value
FROM sys.dm_os_performance_counters c
JOIN sys.databases d ON c.instance_name = d.physical_database_name
6. Click on Update to save your change
7. Add your host and assign the new Template to the host
8. Set a macro of "{$MSSQL.INSTANCE}" and set the value to what is returned by "SELECT DISTINCT SUBSTRING(object_name,1,18) FROM sys.dm_os_performance_counters WHERE object_name like 'MSSQL%"
9. Set a macro of "{$MSSQL.DSN}" to the friendly server name that you use for the Managed Instance.
10. Set the other macros as required by ODBC (username and password)
It will then autodisover the databases and gather performance metrics
atabases' as object_name,'State' as counter_name,name as instance_name,state as cntr_value
Comment