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 - mysql_error out of range value for column
Viewed 384 times since Tue, Aug 14, 2018
Nagios XI - Installing Latest SourceGuardian Loaders
Viewed 423 times since Mon, Jun 18, 2018
Nagios XI - WMI Troubleshooting
Viewed 2061 times since Mon, Apr 24, 2017
Disabling Port 113 IDENT Requests
Viewed 459 times since Tue, Mar 12, 2019
Installation errors on customized corporate builds of CentOS or RHEL
Viewed 909 times since Tue, Jan 26, 2016
Nagios XI - Issues with mod_gearman and Performance Data Newlines: "\n"
Viewed 301 times since Tue, Feb 2, 2016
NDOUtils - Message Queue Exceeded
Viewed 1506 times since Thu, Jan 21, 2016
Nagios XI - Crashed Database Tables
Viewed 2808 times since Tue, Jan 27, 2015
Nagios XI - Warning: Duplicate definition found for contact ’xi_default_contact’
Viewed 424 times since Tue, Jan 26, 2016
Nagios XI - Last Check Time Not Updating
Viewed 2614 times since Tue, Jan 6, 2015