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/



Special Offer For Knowledgebase Visitors! Get a huge discount on Nagios Log Server by clicking below.

Get 60% Off Nagios Log Server!

Did you know? Nagios provides complete monitoring of: Windows, Linux, UNIX, Servers, Websites, SNMP, DHCP, DNS, Email, Storage, Files, Apache, IIS, EC2, and more!

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 - Crashed Database Tables
Viewed 62656 times since Tue, Jan 27, 2015
Nagios XI - WMI Authentication Problems
Viewed 7612 times since Thu, Feb 25, 2016
Turning Off PHP Notices and Deprecated Messages
Viewed 4394 times since Wed, Oct 20, 2021
Nagios XI - Best Practices - NWC15
Viewed 8755 times since Thu, Feb 4, 2016
Nagios XI - NSP: Sorry Dave, I can’t let you do that
Viewed 22876 times since Tue, Jan 27, 2015
Installation errors on customized corporate builds of CentOS or RHEL
Viewed 13198 times since Tue, Jan 26, 2016
Nagios XI - Configuration Applies, but still get "Configuration File Is Out Of Date" Error
Viewed 5345 times since Tue, Jan 26, 2016
Nagios XI - Unable to Delete Host
Viewed 24231 times since Tue, Dec 16, 2014
Nagios XI - Event Data Is Stale
Viewed 5931 times since Wed, Jan 27, 2016
Nagios XI - Disabling Database UTF8 Connectivity
Viewed 5469 times since Thu, Mar 8, 2018