MSSQL using NSClient++

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: MSSQL using NSClient++

Post by abrist »

ofadl wrote:[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified
[ISQL]ERROR: Could not SQLConnect
ODBC is still not finding the Driver line in the ini file.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: MSSQL using NSClient++

Post by ofadl »

hmm any idea of what to do next?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: MSSQL using NSClient++

Post by abrist »

Well, not really Lets check the linking on your driver:

Code: Select all

ldd /usr/local/lib/libtdsodbc.so
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: MSSQL using NSClient++

Post by ofadl »

ok so that file is located in here:

/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so

and i ran:

ldd /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so

and got this as a result:

linux-vdso.so.1 => (0x00007fff64fec000)
libodbcinst.so.1 => /usr/lib/x86_64-linux-gnu/libodbcinst.so.1 (0x00007f 525ff1f000)
libgnutls.so.26 => /usr/lib/x86_64-linux-gnu/libgnutls.so.26 (0x00007f52 5fc63000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f525fa5a000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f525f83 d000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f525f47e000)
libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f525f2730 00)
libtasn1.so.3 => /usr/lib/x86_64-linux-gnu/libtasn1.so.3 (0x00007f525f06 2000)
libgcrypt.so.11 => /lib/x86_64-linux-gnu/libgcrypt.so.11 (0x00007f525ede 4000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f525ebcc000)
libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007f52 5e9ba000)
/lib64/ld-linux-x86-64.so.2 (0x00007f526039d000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f525e7b6000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f52 5e5b1000)
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: MSSQL using NSClient++

Post by abrist »

ofadl wrote:ok so that file is located in here:

/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Change the paths in the file /usr/local/etc/odbcinst.ini to match the above path. Additionally, change the path for /usr/lib/odbc/libtdsS.so to where ever your is as well.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: MSSQL using NSClient++

Post by ofadl »

ok, so i just figured out i have TWO odbcinst.ini files:

/etc/odbcinst.ini
/usr/share/tdsodbc/odbcinst.ini


In which i have this step:

Then, finally, set up the DSN within ODBC in the odbc.ini file here
/usr/local/etc/odbc.ini
By adding this bit to the file:
[MSSQL]
Description = MS SQL Server
Driver = /usr/local/lib/libtdsodbc.so
Server = 192.168.2.3
UID = devuser
PWD = devpass
ReadOnly = No
Port = 1433

set up in :
/usr/share/tdsodbc/odbcinst.ini

which looks like :

[FreeTDS]
Description = TDS driver (Sybase/MS SQL)
Driver = libtdsodbc.so
Setup = libtdsS.so
CPTimeout =
CPReuse =



[FreeTDS]
Description = FreeTDS driver
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
Setup=/usr/lib/x86_64-linux-gnu/odbc/libtdsS.so
FileUsage = 1
UsageCount = 1
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: MSSQL using NSClient++

Post by ofadl »

woops, my mistake, i didint do the last step of the guide. Its working fine and connecting now. Any ideas on how to set up a check/command for this?
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: MSSQL using NSClient++

Post by sreinhardt »

Have you gone back to attempting the commands from before, I thought we had already been testing a plugin and command?
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
ofadl
Posts: 201
Joined: Mon Jun 03, 2013 8:57 am

Re: MSSQL using NSClient++

Post by ofadl »

i have not, i just followed this guide thoroughly and now i can connect to the database. I am not sure about what check command to define, dont want to get more lost
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: MSSQL using NSClient++

Post by slansing »

The -h function of most nagios plugins can be very helpful and will show you how to format your command, to view the help section run the plugin with a -h after the scripts name:

Code: Select all

/usr/local/nagios/libexec/check_pluginname -h
If you share the output we can help as best as we can from here.
Locked