简体   繁体   English

带有Perl DBD :: Sybase的Nagios check_mssql_health(无FreeTds)

[英]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 顺便说一句:我不知道这是否应该继续StackOverflow或ServerFault ...

I have been working on this problem for about 18 hours... straight... 我已经在这个问题上工作了大约18个小时...一直...

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. 我有一个生产Nagios 3.2.0盒子,我没有任何文献资料就继承了它,更不用说配置文件了。这是我更新它的时候了。

I have installed Nagios 3.5.1 (final) with NConf 1.3.0 (final). 我已经用NConf 1.3.0(最终版)安装了Nagios 3.5.1(最终版)。 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 freetdsunixODBC

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. 在生产系统中,我可以在我们的环境中指定任何sql服务器,并且它可以正常工作。

./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. 我尝试了许多不同的方法来配置“无需配置”的DBD :: Sybase连接,但运气为零。

Here are the links to the things I have tried... 这是我尝试过的事情的链接...

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

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

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

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

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

https://msdn.microsoft.com/en-us/library/hh568451%28v=sql.110%29.aspx 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. 看来此OP与我要完成的目标相同。 But his question is 11 months old and viewed only 33 times. 但是他的问题是11个月大,仅被浏览了33次。

FreeTds without freetds.conf 没有freetds.conf的FreeTds

How do I get my new server to use check_mssql_health? 我如何使新服务器使用check_mssql_health?

Or even more so, a small sqltest.pl 甚至更小的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 工作服务器的完整pastebin strace输出: http : //pastebin.com/Ek7sVeGD

Full pastebin strace output of failing server: http://pastebin.com/QK3BgVhp 发生故障的服务器的完整pastebin strace输出: 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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