Check_mssql_health with on LibreNMS

Hello,
I installed check_mssql_health on LibreNMS running with Ubuntu 16.04 and I have a little problem.
With the commande line the plugin works fine, I get the correct result. Exemple testing conncetion.

I get this result :

root@srv-loki:/usr/lib/nagios/plugins# ./check_mssql_health --server MSSQLSERVER --username ‘USER’ --password ‘PASS’ --mode connection-time --commit

OK - 0.01 seconds to connect as USER | ‘connection_time’=0.01;1;5;;

I tried different --mode like list all databases or current users and have the correct result.

But when I try to use the check_mssql_health on LibreNMS I get the instructions info.

I also used check_mssql_server.py and check_mssql_database.py and they both run fine via terminal command and LibreNMS, but I’m having issues with this one.

Thanks

This will be because we automatically append -H HOSTNAME to the call which is the typical flag for service checks in nagios.

To fix that a new service check file will be needed similar to: https://github.com/librenms/librenms/blob/master/includes/services/check_domain.inc.php (won’t be just a copy paste job). Give that a try (file should be called check_mssql_health.inc.php)

1 Like

Hello Laf,
thanks for the reply

Does this looks like correct code since the command’s parameters are :

–server=MSSQLSERVER --username=‘premtim\root’ --password=‘Super2010’ --mode connected-users --commit

<?php

$check_cmd = $config['nagios_plugins'] . "/check_mssql_health --server ";

if ($service['service_ip']) {
    $check_cmd .= $service['service_ip'];
} else {
    $check_cmd .= $service['server'];
}
$check_cmd .= " ".$service['service_param'];

Thank you

I’ve edited the above, try that.

Sorry it was --server and not --servername

I created the check_mssql_health.inc.php and now I get an error with “untrusted domain”

This is what i get :

And this is what i get via terminal command :

That’s all I can help with I’m afraid.

Finally got it working. In parameters I used --server=server --username=“domain\user” --password=“password”
Instead of
–server=server --username=‘domain\user’ --password=‘password’

It was the ’ ’ thing.

Thanks again Laf :slight_smile:

No problem, please submit this new file as a pull request so others can also make use of it.

It is done.