简体   繁体   中英

Nagios check_mssql_health with perl DBD::Sybase without FreeTds

I usually ask for help on forums as a last resort, and I am well and truly stuck...

BTW: I don't know if this should go on StackOverflow or ServerFault... Anyhoo

I have been working on this problem for about 18 hours... straight...

I have a production Nagios 3.2.0 box that I inherited with no documentation and not to mention the config files are a complete dog's breakfast So, the time has come for me to update it.

I have installed Nagios 3.5.1 (final) with NConf 1.3.0 (final). It works a treat.

Current box has:

Red Hat Linux release 4 
check_mssql_health (1.5.3)
perl v5.8.8 built for i386-linux-thread-multi
DBD::Sybase 1.10

Current box does NOT seem to use:

freetds or unixODBC

I say this because is seems to have been installed at one stage (trial and error? (Just like me??)) because the corresponding config files do not contain any relevant configurations for the production system; just sample data. In the production system, I can specify any sql server in our environment and it just works.

./check_mssql_health --server SERVER --username USER --password PASS --mode free-list-stalls
OK - 0.00 free list stalls per second | free_list_stalls_per_sec=0.00;4;10

The new box has:

CentOS 6.7 (final)
check_mssql_health (1.6.2)
perl v5.10.1 (*) built for x86_64-linux-thread-multi
DBD::Sybase 1.10

And this is what I get every time:

./check_mssql_health --server SERVER --username USER --password PASS --mode free-list-stalls
CRITICAL - cannot connect to SERVER. DBI connect(';server=SERVER','USER',...) failed: (no error string) at ./check_mssql_health line 3280

I have tried so many different ways to configure a 'config-less' DBD::Sybase connection, but have had zero luck.

Here are the links to the things I have tried...

https://labs.consol.de/nagios/check_mssql_health

http://www.freetds.org/userguide/perl.htm

http://www.freetds.org/userguide/config.htm

http://www.freetds.org/userguide/dsnless.htm

http://www.unixodbc.org/doc/FreeTDS.html

https://msdn.microsoft.com/en-us/library/hh568451%28v=sql.110%29.aspx

Not to mention all the time I've spent compiling, re-compiling, and troubleshooting all the compile errors/dependencies. What a headache.

It appears this OP is along the same lines as what I am trying to accomplish. But his question is 11 months old and viewed only 33 times.

FreeTds without freetds.conf

How do I get my new server to use check_mssql_health?

Or even more so, a small sqltest.pl

#! /usr/bin/perl -w

use DBI;
use strict;

my $username = "USER";
my $password = "PASS";
my $dsn = "DBI:Sybase:;host=SERVER;port=1433";
if (my $dbh = DBI->connect(
    $dsn, $username, $password,
    { RaiseError => 1, AutoCommit => 0, PrintError => 1 })) {
  printf "connection succeeded\n";
} else {
  printf "connection failed\n";
}

New box fails. Current prod box succeeds.

To take it another step further, I have even done an strace on both boxes!

Works:

connect(3, {sa_family=AF_INET, sin_port=htons(1433), sin_addr=inet_addr("10.2.23.2")}, 16) = -1 EINPROGRESS (Operation now in progress)
open("/usr/share/locale/locale.alias", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=2528, ...}) = 0
...
write(1, "connection succeeded\n", 21connection succeeded

Fails:

connect(5, {sa_family=AF_INET, sin_port=htons(1433), sin_addr=inet_addr("10.2.23.2")}, 16) = -1 EINPROGRESS (Operation now in progress)
poll([{fd=5, events=POLLOUT}, {fd=4, events=POLLIN}], 2, 90000000) = 1 ([{fd=5, revents=POLLOUT}])
getsockopt(5, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
...
write(2, "DBI connect(';host=insyd2ft01;po"..., 239DBI connect(';host=SERVER;port=1433','USER',...) failed: OpenClient message: LAYER = (0) ORIGIN = (0) SEVERITY = (78) NUMBER = (44)
Server , database
Message String: Server name not found in configuration files.
at ./sqltest.pl line 9
) = 239

I don't want to use the configuration files!

Full pastebin strace output of working server: http://pastebin.com/Ek7sVeGD

Full pastebin strace output of failing server: http://pastebin.com/QK3BgVhp

They are very different from eachother, but I am so exausted, my brain is shutting down on me...

Does anyone have any suggestions?

Cheers.

can you please run this and give output?

perl -MDBI -e 'DBI->installed_versions;'

find / -name freetds.conf

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM