Page 3 of 4

Re: check_mssql_health issues

Posted: Fri Sep 04, 2015 1:20 pm
by hsmith
cchinicz wrote:I've checked that link but could not find anything new. Answering your question, yes, I've opened both tcp port 1433 and udp 1434. Also, following the link you sent, I've also opened windows firewall outbound rules for any port/ip that communicates with the sql server.

After creating that rule, I've issued a netstat command. Below are the results of netstat after I've openend outbound rules for tcp protocol at the windows firewall:

C:\Users\Administrator>netstat -ano | find /i "600"
TCP 0.0.0.0:1433 0.0.0.0:0 LISTENING 600
TCP 10.0.0.29:1433 10.0.0.29:49382 ESTABLISHED 600
TCP 10.0.0.29:1433 10.0.0.29:49387 ESTABLISHED 600
TCP [::]:1433 [::]:0 LISTENING 600

C:\Users\Administrator>

600 is the PID of my SQL Server. Any clue of what is going on?

Thanks
Can you post the exact command you're trying to use, with any passwords or whatnot edited out.

Re: check_mssql_health issues

Posted: Fri Sep 04, 2015 1:31 pm
by hsmith
I was able to find this link from this thread from a previous user experiencing these issues, I hope these can be of use to you.

Re: check_mssql_health issues

Posted: Fri Sep 04, 2015 2:42 pm
by cchinicz
I checked the link and the problem is really very similar. I checked the freetds.conf (I have two of them, one on /usr/local/etc and the other on /etc/freetds) and it is as posted:

# TDS protocol version
; tds version = 8 (MINE WAS 4.2 and I edited it to 8..)


[sqlhost1]
server = 10.0.0.29
port = 1433
tds version = 8.0

but it did not work for me. Answering your question, the command Nagios is issuing is

define command{
command_name check_mssql_health
command_line /usr/local/nagios/libexec/check_mssql_health --hostname=10.0.0.29 --username=sa --password=xxxxxx --port=1433 --mode=$ARG1$
}

and my service is

define service{
use generic-service,nagiosgraph
host_name SAP-GBG
service_description SAP MS-SQL database-free space
check_interval 1
check_command check_mssql_health!database-free
}

Any clue?

Thanks

Re: check_mssql_health issues

Posted: Sun Sep 06, 2015 8:17 pm
by Box293
Try the --server argument instead of --hostname

Code: Select all

define command{
command_name check_mssql_health
command_line /usr/local/nagios/libexec/check_mssql_health --server=10.0.0.29 --username=sa --password=xxxxxx --port=1433 --mode=$ARG1$
}
Try testing from the command line:

Code: Select all

/usr/local/nagios/libexec/check_mssql_health --server=10.0.0.29 --username=sa --password=xxxxxx --port=1433 --mode=database-free

Re: check_mssql_health issues

Posted: Sun Sep 06, 2015 8:51 pm
by cchinicz
Hi,

I've just tried and got the same result from Nagios and from command line:

Status Information: CRITICAL - cannot connect to 10.0.0.29. DBI connect(':server=10.0.0.29','sa',...) failed: OpenClient message: LAYER = (0) ORIGIN = (0) SEVERITY = (78) NUMBER = (41)
Server 10.0.0.29, database
Message String: Unable to connect: Adaptive Server is unavailable or does not exist
at /usr/local/nagios/libexec/check_mssql_health line 3280

ubuntu@ip-10-0-0-10:/usr/local/etc$ sudo /usr/local/nagios/libexec/check_mssql_health --server=10.0.0.29 -username=sa --password=xxxxxxxx --port=1433 --mode=connection-time
CRITICAL - cannot connect to 10.0.0.29. DBI connect(';server=10.0.0.29','sa',...) failed: OpenClient message: LAYER = (0) ORIGIN = (0) SEVERITY = (78) NUMBER = (41)
Server 10.0.0.29, database
Message String: Unable to connect: Adaptive Server is unavailable or does not exist
at /usr/local/nagios/libexec/check_mssql_health line 3280

ubuntu@ip-10-0-0-10:/usr/local/etc$

Actually, before I got this result, I had gotten a time out (after replacing hotsname by server) and than disabled windows firewall, getting the above result.

Thanks for your help!

Re: check_mssql_health issues

Posted: Sun Sep 06, 2015 10:01 pm
by Box293
Does this help:
http://www.perlmonks.org/?node_id=1100606

And this one:
https://github.com/lausser/check_mssql_health/issues/10


They seem to indicate needing to define it in freetds.conf

Re: check_mssql_health issues

Posted: Mon Sep 07, 2015 11:11 am
by cchinicz
Now it works!!! Thanks a lot to everybody who helped me through this issue. I will record here what I did on this last step so other people facing the same situation can benefit from this post.

I defined the name of the "server" at /etc/freetds/freetds.conf:

[my_server]
host = 10.0.0.29
port = 1433
tds version = 8.0
database = my_database
user = my_user
password = my_password

and the command on the Nagios command.cfg file became:

define command{
command_name check_mssql_health
command_line /usr/local/nagios/libexec/check_mssql_health --server=sap_gbg --username=sa --password=Xxxxxx --port=1433 --mode=$ARG1$
}

All the best!

Re: check_mssql_health issues

Posted: Mon Sep 07, 2015 6:51 pm
by Box293
Excellent, glad you got it working.

Can you confirm for me, so I can understand:

Is --server=sap_gbg supposed to match the name in the square brackets [my_server] ?

Re: check_mssql_health issues

Posted: Tue Sep 08, 2015 5:39 am
by cchinicz
Yes, I should have put sap_gbg instead of my_server in the brackets. Thanks again.

Re: check_mssql_health issues

Posted: Tue Sep 08, 2015 9:10 am
by tmcdonald
It sounds like we are all good to close this thread?