Page 6 of 9
Re: MSSQL using NSClient++
Posted: Mon Jul 01, 2013 11:41 am
by ofadl
ok i edited that line, saved and restarted. Then checked again with :
/usr/lib/nagios/plugins/check_mssql_sproc.pl -H $HOSTADDRESS$ -p "sp_CheckCoreLastDeliveredBusHours" -u sa -P "dusT#Controle" -w $ARG1$ -c $ARG2$
and still got the same error as previous:
DBI connect('DRIVER={SQL Server};SERVER=10.200.50.176','sa',...) failed: [unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002) at /usr/lib/nagios/plugins/check_mssql_sproc.pl line 68
Error: Unable to connect to MS-SQL database!
[unixODBC][Driver Manager]Data source name not found, and no default driver specified (SQL-IM002)
Re: MSSQL using NSClient++
Posted: Mon Jul 01, 2013 1:43 pm
by abrist
What is the output of:
Code: Select all
sed -n '60,80p' /usr/lib/nagios/plugins/check_mssql_sproc.pl
Re: MSSQL using NSClient++
Posted: Mon Jul 01, 2013 2:19 pm
by ofadl
as follows:
}
my $conn;
$conn{"username"} = $opt_user;
$conn{"server"} = $opt_host;
$conn{"password"} = $opt_pw;
$conn{"dsn"} = "dbi:ODBC:DRIVER={SQL Server};SERVER=" . $conn{"server"};
$conn{"dbh"} = DBI-> connect( $conn{"dsn"}, $conn{"username"}, $conn{"password"} )
or die "Error: Unable to connect to MS-SQL database!\n", $DBI::errstr,"\ n";
my $sql = qq{ use $opt_db exec $opt_proc };
my $sth = $conn{"dbh"}->prepare( $sql );
$sth->execute();
my( $result );
$sth->bind_columns( undef, \$results );
while( $sth->fetch() ) {
process_results($results);
Re: MSSQL using NSClient++
Posted: Mon Jul 01, 2013 2:27 pm
by abrist
Lets check the ini for ODBC
Code: Select all
find / -name odbcinst.ini
grep Driver /path/from/find/command
Re: MSSQL using NSClient++
Posted: Mon Jul 01, 2013 2:35 pm
by ofadl
ok i found it in :
/etc/odbcinst.ini
then did:
grep Driver /etc/odbcinst.ini
what do i do next?
Re: MSSQL using NSClient++
Posted: Mon Jul 01, 2013 2:37 pm
by abrist
You should have a had some output from that command. Could you post the contents of the file:
Re: MSSQL using NSClient++
Posted: Mon Jul 01, 2013 2:41 pm
by ofadl
its empty, there's nothing in it
Re: MSSQL using NSClient++
Posted: Mon Jul 01, 2013 4:14 pm
by abrist
That's not good. I can show you what is in one of my test boxes, but your mileage may vary (due to possible distro differences):
Code: Select all
# Example driver definitions
# Driver from the postgresql-odbc package
# Setup from the unixODBC package
[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib/psqlodbc.so
Setup = /usr/lib/libodbcpsqlS.so
Driver64 = /usr/lib64/psqlodbc.so
Setup64 = /usr/lib64/libodbcpsqlS.so
FileUsage = 1
# Driver from the mysql-connector-odbc package
# Setup from the unixODBC package
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc5.so
Setup = /usr/lib/libodbcmyS.so
Driver64 = /usr/lib64/libmyodbc5.so
Setup64 = /usr/lib64/libodbcmyS.so
FileUsage = 1
Re: MSSQL using NSClient++
Posted: Tue Jul 02, 2013 7:57 am
by ofadl
maybe i downloaded the wrong thing? I dont understand why the file is empty
Re: MSSQL using NSClient++
Posted: Tue Jul 02, 2013 1:07 pm
by sreinhardt
Do you have any of the files listed in abrists config? If not can you do a "locate psqlodbc.so" and so on for the rest of the files? If you have them, you likely can replicate the same config as shows with your own paths.