Get sql connection status using telegraf plugin

Team,
How to get sql connection status using telegraf plugin
I tried with inputs.sqlserver plugin. but unable to find the connection status metric in that.
please check and let me know the steps

Expected result:
“Displays the sql connection status for the instance.
0- Connected
1- Not connected”

Hi

I’m not familiar with this metric tbh, and I doubt there is something like that in the SQL Server plugin.
If the metric you are looking for answers the question “is the instance reachable?” then no, there is no such thing… you simply have no data and that suffices to raise an alert.

There is also the health_metric parameter that might help in this case

  ## Toggling this to true will emit an additional metric called "sqlserver_telegraf_health". 
  ## This metric tracks the count of attempted queries and successful queries for each SQL instance specified in "servers". 
  ## The purpose of this metric is to assist with identifying and diagnosing any connectivity or query issues. 
  ## This setting/metric is optional and is disabled by default.

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