Error Related to MSSQL Wizard

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
fawzankhaizuran
Posts: 4
Joined: Mon Sep 09, 2024 4:32 am

Error Related to MSSQL Wizard

Post by fawzankhaizuran »

Hi, I am trying to a database using MSSQL Wizard. Followed the instructions carefully.
However, in the end I received an Error Message:

ERROR: [run_check] CRITICAL: Could not connect to odbc:Driver=FreeTDS:Server=172.17.117.32:Port=1433:dbname=CensorshipDB:charset=UTF8 as nagios (Exception: SQLSTATE[08001] SQLDriverConnect: 0 [FreeTDS][SQL Server]Unable to connect to data source) CRITICAL: Could not connect to odbc:Driver=FreeTDS;Server=172.17.117.32;Port=1433;dbname=CensorshipDB;charset=UTF8 as nagios (Exception: SQLSTATE[08001] SQLDriverConnect: 0 [FreeTDS][SQL Server]Unable to connect to data source).

Hence may I know the workaround on this.

As below are the configurations that has been done:

Firewall Config:
Screenshot 2024-09-23 203026.png

SQL Server Config:
Screenshot 2024-09-23 203309.png

NagiosXI can detect the Server 172.17.117.32:
Screenshot 2024-09-23 203541.png

But cannot detect the SQL Server:
Screenshot 2024-09-23 203823.png
Your assistance is highly appreciated

Thank you very much and have a nice day!
You do not have the required permissions to view the files attached to this post.
jsimon
Posts: 343
Joined: Wed Aug 23, 2023 11:27 am

Re: Error Related to MSSQL Wizard

Post by jsimon »

Hi @fawzankhaizuran,

I think the next step is to try testing the command that the wizard is running on your CLI and see if it works there. From the error message it looks like there's a connection error with the MSSQL server you're trying to connect to, so my guess is that this will work the same. Assuming it does, you'll want to make sure you have the correct credentials and configuration for your MSSQL server. You may need to talk to your database team about the credentials you're using, and ensure that you have your XI server whitelisted to contact it. You could also try running nmap, to see if the mssql port looks available to your XI server.

Let us know if you have any questions about any of this, or if you need further assistance with any of the XI-related steps!
cnorell
Developer
Posts: 141
Joined: Mon Nov 27, 2017 3:08 pm

Re: Error Related to MSSQL Wizard

Post by cnorell »

fawzankhaizuran,

I suspect the plugin for MSSQL - and thus the driver (FreeTDS) - is leveraging a TDS version that is incompatible with your version of MSSQL. To verify, you can run the check command on the command line after setting the TDSDUMP environment variable:

Code: Select all

export TDSDUMP=/tmp/freetds.log
You should a line in the log that states a packet with an unsupported version was used in the TLS handshake, or something of the kind.

We will be releasing an updated plugin soon that lets you specify a TDS version in the check command's parameters. Until then, you could always set the environment variable in the plugin yourself with a line of PHP:

Code: Select all

putenv("TDSVER=X.X");
The plugin is located at:

Code: Select all

/usr/local/nagios/libexec/check_mssql_server.php
Ensure you put it in a piece of the code that will be ran. I would recommend at the top of the function run_check(), or in main().

As for which TDS version, you will have to look up the documentation from either FreeTDS or Microsoft to verify the correct version. You could always just run the gamut: 7.0, 7.2, 7.4, 8.0, etc. Note that the format is always X.X.

I hope something here gets you further down the road to resolution.

Best Regards,

Cory Norell
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
fawzankhaizuran
Posts: 4
Joined: Mon Sep 09, 2024 4:32 am

Re: Error Related to MSSQL Wizard

Post by fawzankhaizuran »

Hi @cnorell @jsimon,

Thank you very much for both of your assistances. We highly appreciate it. It looks like the problem has been solved.

The root cause:
The MSSQL version used is 2012 while the current FreeTDS version set in the script is AUTO.

Rectification:
We amend the script by changing the FreeTDS_Version=AUTO to FreeTDS_Version=7.0 due to we suspect the AUTO will select the highest available version of FreeTDS version instead the most compatible version of the MSSQL. This is just a suspicion. The amendment is shown as below:
freetds edit.PNG
As for now, Nagios can communicate with MSSQL2012 normally.
Screenshot 2024-09-24 230648.png
Thank you very much and have a nice day!
You do not have the required permissions to view the files attached to this post.
Locked