Is it possible to add commands in check_mssql_health plugin?

Hello :),

I am trying to configure the plugin check_mssql and what I am looking for is that at the time of setting the parameter “mssql_health_hostname” there is a command that runs a command and this automatically detects the “hostname” of the server and thus not having to configure the service for each server.

If someone knows the way to do it I appreciate your comments and support.

I am using icinga2 web.

Translated with DeepL Translate: The world's most accurate translator (free version)

You can use other variables, for example you can set $$ in the mssql_health_hostname variable.
This will the resolve to the hostname of the host the service is applied to.
would resolve to
when the check is executed

I would do this by assigning some custom variable to each machine which runs

For example:

object Host “SQLserver1” {
address = “your.sql.ser.ver”
vars.sql = true

and then applying the service check to every machine which has that variable

apply Service “SQLcheck” {
check_command = “mssql”
assign where host.vars.sql

(The above is typed from memory and not actually tested, but should be close
enough to point you in a useful direction.)