check_mssql_health issues

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: check_mssql_health issues

Post 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.
Former Nagios Employee.
me.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: check_mssql_health issues

Post 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.
Former Nagios Employee.
me.
cchinicz
Posts: 17
Joined: Sun Dec 28, 2014 12:15 pm

Re: check_mssql_health issues

Post 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
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_mssql_health issues

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
cchinicz
Posts: 17
Joined: Sun Dec 28, 2014 12:15 pm

Re: check_mssql_health issues

Post 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!
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_mssql_health issues

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
cchinicz
Posts: 17
Joined: Sun Dec 28, 2014 12:15 pm

Re: check_mssql_health issues

Post 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!
Last edited by cchinicz on Tue Sep 08, 2015 5:42 am, edited 1 time in total.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_mssql_health issues

Post 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] ?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
cchinicz
Posts: 17
Joined: Sun Dec 28, 2014 12:15 pm

Re: check_mssql_health issues

Post by cchinicz »

Yes, I should have put sap_gbg instead of my_server in the brackets. Thanks again.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: check_mssql_health issues

Post by tmcdonald »

It sounds like we are all good to close this thread?
Former Nagios employee
Locked