ListenerState status in MSSQL Server


How to check ListenerState status in MSSQL server using telegraf plugin,
I tried the below code in primary and secondary setup servers, enabled always on option. too, but not able to get the ListenerState value
Please check and let us know the steps.

servers = [“Server=localhost;Port=1001;User Id=telegraf;Password=pass1234;app name=telegraf;log=1;”]
database_type = “SQLServer”
query_version = 2
include_query = [“SQLServerAvailabilityReplicaStates”,“SQLServerDatabaseReplicaStates”


you can’t change the behavior of the SQL Server plugin “as you wish”, behind it there is a fixed query that fetches some data. If that column is not gathered you can’t really change that “out of the box”.

If you need more you can:

  • open a feature request on Github, or make a PR yourself
  • do the changes you need and make your own build of Telegraf.

I suggest you have a look at the queries behind telegraf, you can find them here: