Page 1 of 1

Help with MSSQL_Health_Check

PostPosted: Tue Aug 13, 2019 8:47 pm
by Katkota
Hello folks;
I'm trying to get mssql_health_check plugin to work on my CentOS 7 server and installed the plugin as well as freetds.conf but no matter what i do every time i run the command it returns the following:
Code: Select all
./check_mssql_health -v --mode cpu-busy --hostname servername --username nagios --password xxxxxx

CRITICAL - connection could not be established within 15 seconds

I tried to change from servername to hostname and also used IP address and no matter what i do it always gives the same critical error with no explanation of what's going on.

i added the following to freetds.conf:

# A typical Microsoft server
Code: Select all
[servername]
        host=server IP
        port = 1433
        tds version = 8.0


Any idea or help would be greatly appreciated

Re: Help with MSSQL_Health_Check

PostPosted: Wed Aug 14, 2019 9:34 am
by mbellerue
Katkota wrote:
Code: Select all
./check_mssql_health -v --mode cpu-busy --hostname servername --username nagios --password xxxxxx

CRITICAL - connection could not be established within 15 seconds


Does the command actually take about 15 seconds to run, or does it just return immediately? If it just returns immediately, there may be something preventing it from connecting, though I would expect a different error message if that were the case. If it's taking about 15 seconds to run, then it's just timing out when connecting to the database.

Re: Help with MSSQL_Health_Check

PostPosted: Thu Aug 15, 2019 1:00 am
by Katkota
It actually takes 15 seconds before it responds

Re: Help with MSSQL_Health_Check

PostPosted: Thu Aug 15, 2019 9:14 am
by mbellerue
One thing that you could try is providing a known wrong password. That should kick you out almost immediately. That would tell me that the plugin is actually reaching SQL Server, and SQL Server is processing the login properly. If it still takes 15 seconds to try to process, then is it possible that SQL Server is busy enough that processing logins is backed up 15+ seconds? Unfortunately it doesn't look like there's a verbose option or a timeout option on this plugin.

What about the SQL Server side? Do the logs in SQL Server show any sign of the plugin's connection attempt?

Re: Help with MSSQL_Health_Check

PostPosted: Thu Aug 15, 2019 11:25 pm
by Katkota
I did try that already by typing the wrong password but the command still took 15 seconds to give the same error so i don't think it's getting that far.
i have not looked on the SQL server side because i did not honestly think the command is even making it to the SQL server.

Any other ideas? this is going on for a while now and i'm hoping anyone can help

Re: Help with MSSQL_Health_Check

PostPosted: Fri Aug 16, 2019 10:14 am
by mbellerue
If presenting the wrong password also takes 15 seconds, then I completely agree, it's probably not making it to the SQL Server. Is your Nagios install monitoring anything else on the same host where SQL Server is running? Can you ping that host from your Nagios server?

Do you know if SQL Server is running on the default port of 1433?
The next hiccup I could see would be a firewall running on the Windows host. Could it be set to allow access to SQL Server only from specific hosts, or a subnet that your Nagios install is not part of?

Also, you say this has been going on for a while. Was it working previously and just stopped?