Home » Categories » Products » Nagios XI » Troubleshooting » Common Problems

Nagios XI - MSSQL Wizards - Adaptive Server connection failed

Problem Description

After running the MSSQL wizards your new service has a CRITICAL or UNKNOWN state with the following error:

CRITICAL: Could not connect to dblib:host=mssql01.box293.local:1433;dbname=Sample as BOX293nagios
(Exception: SQLSTATE[01002] Adaptive Server connection failed (mssql01.box293.local:1433) (severity 9)).

OR

CRITICAL: Could not connect to dblib:host=mssql01.box293.local:1433;dbname=Sample as BOX293\nagios
(Exception: SQLSTATE[01002] Adaptive Server connection failed (severity 9)).

OR

DB-Lib error message 20002, severity 9:
Adaptive Server connection failed

 

In the first two errors above the first line is almost identical except for the username in the output, this is the key to identifying the problem as there are two separate solutions to this problem. The last two errors have the same solution.

A similar error is generated for a separate issue:

PHP Notice: Undefined variable: db_connstr in /usr/local/nagios/libexec/check_mssql on line 416
CRITICAL: Could not connect to as nagios (Exception: SQLSTATE[01002] Adaptive Server connection failed (severity 9)).

Please refer to the Custom Port solution in this KB article to resolve this issue.

 

 

Username Not Enclosed In Quotes

This addresses the following error:

CRITICAL: Could not connect to dblib:host=mssql01.box293.local:1433;dbname=Sample as BOX293nagios
(Exception: SQLSTATE[01002] Adaptive Server connection failed (mssql01.box293.local:1433) (severity 9)).

 

The service in Nagios XI has the username in the domain\user format however it is NOT enclosed in quotes. This screenshot of the service in Core Configuration Manager shows without the quotes:

 

 

This screenshot shows the service after quotes have been added (this is required to fix the problem):

 

 

After making this change save the service and Apply Configuration. Then go and force an immediate check of the service to test that it is working correctly.

 

 

 

System Configuration File Change

This addresses the following error:

CRITICAL: Could not connect to dblib:host=mssql01.box293.local:1433;dbname=Sample as BOX293\nagios
(Exception: SQLSTATE[01002] Adaptive Server connection failed (severity 9)).

OR

DB-Lib error message 20002, severity 9:
Adaptive Server connection failed

 

The plugins require a change to the /etc/freetds.conf configuration file to allow them to work with Windows Authentication.

 

Execute the following command to open the /etc/freetds.conf file in vi:

vi /etc/freetds.conf

When using the vi editor, to make changes press i on the keyboard first to enter insert mode. Press Esc to exit insert mode.

 

Under the [global] section find the following:

[global]
        # TDS protocol version
;       tds version = 4.2

 

Remove the semi-colon (;) at the beginning of the tds version line and change the value to 7.2as follows:

[global]
        # TDS protocol version
       tds version = 7.2

 

When you have finished, save the changes in vi by typing:

:wq

and press Enter.

 

After making these changes go back into the XI web interface and force an immediate check of the service to test that it is working correctly.

 

 

 

Custom Port

This addresses the following error:

PHP Notice: Undefined variable: db_connstr in /usr/local/nagios/libexec/check_mssql on line 416
CRITICAL: Could not connect to as nagios (Exception: SQLSTATE[01002] Adaptive Server connection failed (severity 9)).

 

Notice this:

Could not connect to as nagios

 

See how the server name is not shown. The problem here is that the check_mssql plugin has a bug, it is not using the custom TCP port you defined when running the wizard (instead of the default 1433). This problem has been resolved in version 1.6.1 of the MSSQL Query wizard. To update to the latest version of the wizard navigate to Admin > System Extensions > Manage Config Wizards. On this page you can check for updates and install the latest available version.

 

 

Final Thoughts

For any support related questions please visit the Nagios Support Forums at:

http://support.nagios.com/forum/

0 (0)
Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
Upgrading to NDO 3 after having been downgraded in newer versions of Nagios XI
Viewed 3041 times since Fri, Jan 15, 2021
Nagios XI - Best Practices - NWC15
Viewed 7435 times since Thu, Feb 4, 2016
Nagios XI - Bandwidth Graphs Showing 0Mb/s in Non-English Systems
Viewed 6079 times since Fri, Dec 19, 2014
Nagios XI - Hosts Pending/Gray
Viewed 10329 times since Tue, Jan 6, 2015
Nagios XI - Reset Upgrade Status In Web Interface
Viewed 9546 times since Tue, May 7, 2019
Disabling Outdated Versions of SSL/TLS
Viewed 6938 times since Thu, Aug 6, 2020
Nagios XI - Installing XI Fails To Install Dependency pymssql
Viewed 5591 times since Mon, Oct 17, 2016
Nagios XI - Schedulded Backups No Longer Working
Viewed 6898 times since Fri, Jun 3, 2016
PHPMailer - Troubleshooting Using Debug Logging
Viewed 31325 times since Tue, Aug 14, 2018
Nagios XI - Problems Using Nagios XI With Proxies
Viewed 11824 times since Mon, Jan 25, 2016