I currently using Nagios 2b3 running on Fedora Core 3 fully updated.
I am trying to write a NEB Module that will allow Nagios to connect to a MS SQL Server 2000 database. I am using unixODBC and have confirmed that my tds driver is installed and working as well as my DSN is properly configured. I have used isql to confirm that everything is working as far as unixODBC is concerned. The first thing I did was write a standalone program that used unixODBC and did a simple query. I compiled with gcc, logged in as root, with the following command: gcc odbctest.c -o odbctest.o -lodbc. I ran the odbctest file and it worked like a charm. I was able to connect to the database and insert records. It then took the odbctest.c and integrated it in with the example helloworld NEB module. I then complied with gcc, logged in as root, with the following: gcc -shared helloodbc.c -o SQL.o -lodbc. I then properly configured nagios to look for the SQL.o module file and then restarted Nagios. Nagios starts up, but when it actually gets to the point of running my Code I get this recorded in the log file:
helloodbc: Start try_some_sql
Caught SIGSEGV, shutting down
I am not sure where to go from here, but here is the code that I am using is in the attached zip file. Any help would be appreciated.