Page 1 of 3

Stumped - check_mssql_server

Posted: Fri Apr 05, 2013 5:17 am
by Pilly170
Hi,

I am stumped using check_mssql_server. Everything I do I get

CRITICAL:Unable to access SQL Server.

I've tried various flavours of

/usr/local/nagios/libexec/check_mssql_database.py -H "10.4.2.20" -U "sa" -P "password" -T "databasename" -p 1433 -I "LIVE" --datasize

on the console/commandline.

Ive tried ' around fields, Ive tried dynamic ports, variations on the instance. Some with instance, sometimes without. But nothing.


Can someone point me in the right direction?

Re: Stumped - check_mssql_server

Posted: Fri Apr 05, 2013 7:35 am
by scottwilkerson
If the DB is using instances you would need to remove the port

Code: Select all

/usr/local/nagios/libexec/check_mssql_database.py -H "10.4.2.20" -U "sa" -P "password" -T "databasename" -I "LIVE" --datasize

Re: Stumped - check_mssql_server

Posted: Fri Apr 05, 2013 8:14 am
by Pilly170
I got via putty session

/usr/local/nagios/libexec/check_mssql_database.py -H "10.4.2.20" -U 'sa' -P 'password' -T 'SQLdmNewsRepository' -I LIVE --activetrans --warning 10 --critical 20
CRITICAL:Unable to access SQL Server.


(Service Check Timed Out) via the GUI... created from the MSSQL config wizard.

Re: Stumped - check_mssql_server

Posted: Fri Apr 05, 2013 9:30 am
by slansing
Are you sure that the following are valid beyond a doubt?:

Username is actually

Code: Select all

sa
Password is actually

Code: Select all

password
The table name is

Code: Select all

SQLdmNewsRepository
And that lastly you need to have a valid instance name, and it's name is

Code: Select all

LIVE
The checks are case sensitive so be sure of that as well.

Re: Stumped - check_mssql_server

Posted: Mon Apr 08, 2013 3:26 am
by Pilly170
Yes, the username, password and database are correct as they are all written down on our Keepass Server Passwords List when we create the servers.

The instance is "live", I got the instance name using the SQL query on the server
select @@ServerName
Resulted in SQL3\Live (server\instance)


I've also tried
MSSQL$LIVE
MSSQLSERVER$LIVE
SQL3\LIVE
LIVE


* This is a clustered SQL server by the way.

Re: Stumped - check_mssql_server

Posted: Mon Apr 08, 2013 2:04 pm
by slansing
If "Live" is the actual instance name, I believe it is case sensitive, have you tried it with the correct case set for each character?

Re: Stumped - check_mssql_server

Posted: Tue Apr 09, 2013 9:47 am
by Pilly170
Just checked.
Still no luck with this.

Ive also tried creating a new user, assigned db reader role to the database. still says
CRITICAL:Unable to access SQL Server.

I think its a permissions issue, is there anyway I can easily check?

Re: Stumped - check_mssql_server

Posted: Tue Apr 09, 2013 1:05 pm
by abrist
Check the remote database systems logs. Do you see any "connection refused", "timeout" or access denied type errors?

Re: Stumped - check_mssql_server

Posted: Tue Apr 09, 2013 1:15 pm
by lmiltchev
If you are sure that the username and the password are correct, you need to check the firewall settings next. Make sure port 1433 (unless you use a different one) is open. Can you telnet to port 1433 from your nagios server?

Code: Select all

telnet <mssql server IP> 1433

Re: Stumped - check_mssql_server

Posted: Fri Apr 12, 2013 7:44 am
by Pilly170
Used putty, set IP and port to 1433

Screen went black, no text appeared