check_mssql_server.php error

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
Jenkins
Posts: 10
Joined: Tue Sep 23, 2014 12:10 pm

check_mssql_server.php error

Post by Jenkins »

Trying to connect to MSSQL --mode time2connect

/usr/local/nagios/libexec/check_mssql_server.php -H etc...

ERROR: [run_check] CRITICAL: Could not connect to odbc:Driver=FreeTDS;S

(Exception: SQLSTATE[01000] SQLDriverConnect: 0 [unixODBC][Driver Manager]Can't open lib 'FreeTDS' : file not found).

[root@nagiosxiorcl ~]# yum info php-mssql
Last metadata expiration check: 2:55:21 ago on Wed 08 May 2024 03:05:37 AM PDT.
Error: No matching Packages to list


cat /etc/oracle-release
Oracle Linux Server release 8.9


[root@nagiosxiorcl libexec]# pip3 list|grep sql
pymssql (2.2.5)
User avatar
swolf
Developer
Posts: 315
Joined: Tue Jun 06, 2017 9:48 am

Re: check_mssql_server.php error

Post by swolf »

Hi @Jenkins, thanks for reaching out.

It looks to me like you don't have the database driver installed for the database you're trying to monitor. Have you seen this StackOverflow question? The results won't be directly applicable (the user is trying to use python on a Macintosh, whereas you're on RPM-based Linux), but I think I'd start there and see where it gets you. Basically, to use the freetds driver, you'll need to install a package for it, and then modify your ODBC configuration so that it loads that library.

Please let us know how that works out and whether you have any additional questions or concerns.
-Sebastian
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy
Jenkins
Posts: 10
Joined: Tue Sep 23, 2014 12:10 pm

Re: check_mssql_server.php error

Post by Jenkins »

I have these installed

[root@nagiosxiorcl etc]# rpm -qa | grep -i freetds
freetds-libs-1.3.3-1.el8.x86_64
freetds-1.3.3-1.el8.x86_64
freetds-devel-1.3.3-1.el8.x86_64

[root@nagiosxiorcl etc]# locate libtdsodbc
/usr/lib64/libtdsodbc.so
/usr/lib64/libtdsodbc.so.0
/usr/lib64/libtdsodbc.so.0.0.0


I am not able to install
php-mssql
No matching Packages to list

Can you point me to a document for:
"and then modify your ODBC configuration so that it loads that library."
Jenkins
Posts: 10
Joined: Tue Sep 23, 2014 12:10 pm

Re: check_mssql_server.php error

Post by Jenkins »

I have updated odbcinst.ini from
/usr/share/doc/freetds-libs/samples-odbc/unixodbc.freetds.driver.template-64

[FreeTDS]
Description = FreeTDS unixODBC Driver
Driver = /usr/lib64/libtdsodbc.so
Setup = /usr/lib64/libtdsodbc.so

Still getting same error

ERROR: [run_check] CRITICAL: Could not connect to odbc:Driver=FreeTDS;Server=ipremoved;Port=1433;dbname=master;charset=UTF8 as usernameremoved (Exception: SQLSTATE[42000] SQLDriverConnect: 18456 [FreeTDS][SQL Server]Login failed for user 'usernameremoved'.)
CRITICAL: Could not connect to odbc:Driver=FreeTDS;Server=ipremoved;Port=1433;dbname=master;charset=UTF8 as usernameremoved (Exception: SQLSTATE[42000] SQLDriverConnect: 18456 [FreeTDS][SQL Server]Login failed for user 'usernameremoved'.).
Post Reply