MSSQL using NSClient++
Re: MSSQL using NSClient++
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)
/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++
What is the output of:
Code: Select all
sed -n '60,80p' /usr/lib/nagios/plugins/check_mssql_sproc.pl 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.
"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.
Re: MSSQL using NSClient++
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);
}
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++
Lets check the ini for ODBC
Code: Select all
find / -name odbcinst.ini
grep Driver /path/from/find/commandFormer 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.
"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.
Re: MSSQL using NSClient++
ok i found it in :
/etc/odbcinst.ini
then did:
grep Driver /etc/odbcinst.ini
what do i do next?
/etc/odbcinst.ini
then did:
grep Driver /etc/odbcinst.ini
what do i do next?
Re: MSSQL using NSClient++
You should have a had some output from that command. Could you post the contents of the file:
Code: Select all
/etc/odbcinst.iniFormer 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.
"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.
Re: MSSQL using NSClient++
its empty, there's nothing in it
Re: MSSQL using NSClient++
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 = 1Former 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.
"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.
Re: MSSQL using NSClient++
maybe i downloaded the wrong thing? I dont understand why the file is empty
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: MSSQL using NSClient++
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.
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.