Page 1 of 2

MSSQL monitoring problem

Posted: Sat Jan 06, 2024 4:21 pm
by amintay
Hello,

I'd like to share with you a problem I've encountered with nagiox XI when supervising MSSQL. If anyone can help me solve it, please let me know.
thank you in advance

ERROR: [run_check] CRITICAL: Could not connect to odbc:Driver=FreeTDS:Server=192.168.xx.xx\SQLSERVER:dbname=DataBase1:charset=UTF8 as nagxi (Exception: SQLSTATE[08001] SQLDriverConnect: 0 [FreeTDS][SQL Server]Unable to connect to data source)

Re: MSSQL monitoring problem

Posted: Mon Jan 08, 2024 10:20 am
by lgute
Hi @amintay, thanks for reaching out.

You can run the plugins from the command line, to make it easier to debug.

First make sure the check_ping plugin works.

Code: Select all

/usr/local/nagios/libexec/check_ping -H <sqlname.domain.local> -w 10,2% -c 20,5%

If you get output like this...

Code: Select all

CRITICAL - Host Unreachable (<sqlname.domain.local>)
There is a network/firewall/Windows firewall issue.

If you get output like this...

Code: Select all

PING OK - Packet loss = 0%, RTA = 0.08 ms|rta=0.078000ms;10.000000;20.000000;0.000000 pl=0%;2;5;0
Try running the MSSQL plugin.

Code: Select all

/usr/local/nagios/libexec/check_mssql_server.php -H <sqlhostname_or_ip> --checktype 'server' -U 'sa' -P '<your_password>' --perftype default -p 1433 --mode autoparamattempts --warning 100 --critical 200
If you get a response like this...

Code: Select all

ERROR: [run_check] CRITICAL: Could not connect to odbc:Driver=FreeTDS;Server=192.168.255.251;Port=1433;dbname=master;charset=UTF8 as xi_sql_user (Exception: SQLSTATE[08S01] SQLDriverConnect: 20009 [FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist)
CRITICAL: Could not connect to odbc:Driver=FreeTDS;Server=192.168.255.251;Port=1433;dbname=master;charset=UTF8 as xi_sql_user (Exception: SQLSTATE[08S01] SQLDriverConnect: 20009 [FreeTDS][SQL Server]Unable to connect: Adaptive Server is unavailable or does not exist).
There is likely a SQLServer or Firewall configuration issue. For instance, is the TCP/IP protocol Enabled in the SQL Server Network Configuration | Protocols for MSSQLSERVER | TCP/IP?

This post may give you some ideas where to look for issues. viewtopic.php?p=345316#p345316

You should get a response like this, if the XI server can connect to your SQL Server.

Code: Select all

OK: Auto-Param Attempts/sec is 0.008914/sec|autoparam_attempts=0.008914;100;200;;

Re: MSSQL monitoring problem

Posted: Mon Jan 08, 2024 4:28 pm
by amintay
Hi Laura ,

thank you for your reply,

I ran the check_ping plugin and here's the result
Capture1.PNG
and I ran the MSSQL plugin and here's the result
Capture2.PNG
for firewall settings they are well added
Capture3.PNG
do you have any other ideas for solving this problem?

thank you.

Re: MSSQL monitoring problem

Posted: Tue Jan 09, 2024 4:04 am
by kg2857
If you can ping the host and the port is open you have an odbc connection issue. Often a uname/pasword issue.

Re: MSSQL monitoring problem

Posted: Tue Jan 09, 2024 4:34 pm
by amintay
hi,
Hello, I assure you that the user name and the password are correct.

Re: MSSQL monitoring problem

Posted: Thu Jan 11, 2024 9:27 am
by lgute
Hi @amintay,

How about enabling TCP/IP for SQL Server?

Enable TCP/IP in the SQL Server Configuration Manager
Image

Re: MSSQL monitoring problem

Posted: Thu Jan 11, 2024 4:23 pm
by amintay
Hi Laura,

it's enable
Capture1.PNG
do I need to configure my centos server (nagios XI)?

thank you.

Re: MSSQL monitoring problem

Posted: Thu Jan 11, 2024 5:16 pm
by amintay
hello again laura,


I wanted to share something with you still about this MSSQL problem. I searched on the internet for a plugin to check mssql developed in python and I think it worked.while monitoring using config wizard does not work ?????
Capture1.PNG

Re: MSSQL monitoring problem

Posted: Fri Jan 12, 2024 8:14 am
by lgute
Hi @amintay,

That is a very interesting result. It seems like something may not be setup correctly for the PHP plugin, since the Python one is working.
What version of CentOS are you using, what version of PHP, and what version of XI?

If you are willing to contact our support team directly, they could get to the bottom of this issue quickly. To contact support, open a ticket (case) at the Nagios Answer Hub.

Re: MSSQL monitoring problem

Posted: Fri Jan 12, 2024 3:21 pm
by amintay
Hi laura,

the centos version is CentOS Stream release 9
the php version is PHP 8.0.30 (cli) (built : Aug 3 2023 17:13:08) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.30, Copyright (c) Zend Technologies
with Zend OPcache v8.0.30, Copyright (c), by Zend Technologies
mssql version is 2017
version XI is full=5.11.3
I want to dig even deeper before opening a support ticket.

thanks.