MSSQL Plugin: Handle non-readable secondary replicas in Always On Availability Groups gracefully

11 votes

In an Always On (Active/Passive) setup with non-readable secondary replicas, the MSSQL plugin still executes database queries (e.g., size checks) on secondary nodes.

This causes:
-Services going to UNKNOWN/CRIT in Checkmk
-Failed queries generating log spam on the SQL Server

Since secondary replicas can become primary at any time, the plugin must still run on them, but database access is not possible in this configuration.

Root cause:
The plugin does not distinguish between primary replicas and non-readable secondary replicas.

Why this is problematic:
- Secondary replicas must still be monitored (failover scenarios)
- It is often not possible to enable read-only access on secondary replicas
- This behavior impacts monitoring quality and pollutes SQL Server logs

https://forum.checkmk.com/t/mssql-plugin-secondary-replica-database-sizes/50340

Under consideration Checks&Agents Suggested by: Jerome Rieger Upvoted: 09 Apr Comments: 0

Comments: 0