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
Nagios XI - MSSQL Query Wizard - Invalid characters in the username
Viewed 4721 times since Thu, Aug 3, 2017
Nagios XI - Configuration Verification Failed
Viewed 17436 times since Mon, Jan 25, 2016
Upgrading to NDO 3 after having been downgraded in newer versions of Nagios XI
Viewed 3041 times since Fri, Jan 15, 2021
Nagios XI - Configuration Applies, No Changes Take Place
Viewed 7365 times since Tue, Jan 27, 2015
Nagios XI - Problems Using Nagios XI With Proxies
Viewed 11825 times since Mon, Jan 25, 2016
Nagios XI - SourceGuardian Errors 2009R1.2C
Viewed 3975 times since Tue, Feb 2, 2016
Nagios XI - Windows Memory Usage - Physical
Viewed 14971 times since Tue, Jan 26, 2016
Nagios XI - MRTG Reports SNMP_Session Errors
Viewed 4364 times since Wed, Jul 27, 2016
Nagios XI - Event Data Is Stale
Viewed 4781 times since Wed, Jan 27, 2016
Nagios XI - How To Use CA Certificates With check_ldaps Plugin
Viewed 10003 times since Tue, Jul 26, 2016