Hi,
We are trying to run MS SQL query using check_mssql plugin, but we were not able to connect database using below command
[nagios@XXXXX ~]$ /usr/local/nagios/libexec/check_mssql -H XXXX --username 'XXXX' --password 'XXXX' --database TEST --port 1433 --query "SELECT COUNT(*) FROM test_view" --result 0
CRITICAL: Could not connect to XXXX:1433 as XXXX.
[nagios@XXXXX ~]$
[nagios@XXXX ~]$ /usr/local/nagios/libexec/check_mssql -V
0.7.8
[nagios@XXXX ~]$
Kindly advice on the issue ?
Check_mssql - Could not connect to database
Check_mssql - Could not connect to database
Last edited by bsivavani on Thu Jan 31, 2019 12:53 pm, edited 1 time in total.
Re: Check_mssql - Could not connect to database
Is this using Windows authentication or SQL Server authentication? I believe that plugin only supports SQL Server authentication.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Check_mssql - Could not connect to database
We are using SQL server authentication.
Re: Check_mssql - Could not connect to database
Can you verify that the server running the check can connect to the sql server on port 1433 ? Test this by running telnet SQL_SERVER_IP 1433.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Check_mssql - Could not connect to database
We are able to connect to SQL server using telnet.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Check_mssql - Could not connect to database
And authenticate with the username and password you provided to the check_mssql command?bsivavani wrote:We are able to connect to SQL server using telnet.
Re: Check_mssql - Could not connect to database
With the below command we were not able to execute.
[nagios@XXXXX ~]$ /usr/local/nagios/libexec/check_mssql -H XXXX --username 'XXXX' --password 'XXXX' --database TEST --port 1433 --query "SELECT COUNT(*) FROM test_view" --result 0
CRITICAL: Could not connect to XXXX:1433 as XXXX.
[nagios@XXXXX ~]$
We were able to connect to database from SQL server end.
We are using MS SQL Server 2012.
[nagios@XXXXX ~]$ /usr/local/nagios/libexec/check_mssql -H XXXX --username 'XXXX' --password 'XXXX' --database TEST --port 1433 --query "SELECT COUNT(*) FROM test_view" --result 0
CRITICAL: Could not connect to XXXX:1433 as XXXX.
[nagios@XXXXX ~]$
We were able to connect to database from SQL server end.
We are using MS SQL Server 2012.
Last edited by bsivavani on Fri Feb 01, 2019 10:21 am, edited 1 time in total.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Check_mssql - Could not connect to database
I guess my question was related to connecting with the same port, username and password, and doing do from the nagios server.
The server you test from matters because there could be firewalls that block IP's or ports
The server you test from matters because there could be firewalls that block IP's or ports
Re: Check_mssql - Could not connect to database
I am able to connect to SQL Server (Version 2016).. Please find below output
[nagios@XXXX ~]$ curl -v telnet://SQLServer:2056
* About to connect() to SQLServer port 2056 (#0)
* Trying SQLServer... connected
* Connected to SQLServer (SQLServer) port 2056 (#0)
^]
^C
[nagios@XXXX ~]$
[nagios@XXXX ~]$ curl -v telnet://SQLServer:2056
* About to connect() to SQLServer port 2056 (#0)
* Trying SQLServer... connected
* Connected to SQLServer (SQLServer) port 2056 (#0)
^]
^C
[nagios@XXXX ~]$
-
kyang
Re: Check_mssql - Could not connect to database
Can you connect using port 1433 and post the results. Instead of connecting to port 2056?
telnet SQL_SERVER_IP 1433
curl -v telnet://SQLServer:1433
telnet SQL_SERVER_IP 1433
curl -v telnet://SQLServer:1433
Did you do as @scottwilkerson suggested?I guess my question was related to connecting with the same port, username and password, and doing do from the nagios server.
The server you test from matters because there could be firewalls that block IP's or ports