lausser / check_mssql_health

Wenn du dich für Plugins (oder OMD oder allgemein Monitoring) interessierst oder von deiner Installation erzählen willst...die Tradition der deutschsprachigen Monitoring-Workshops wird wiederbelebt: https://discord.gg/jDfPZ63FcJ A plugin, which checks various parameters of Microsoft SQL database servers.
http://labs.consol.de/nagios/check_mssql_health
GNU General Public License v2.0
38 stars 27 forks source link

"Server name not found in configuration files" when using --hostname #10

Open rchekaluk opened 10 years ago

rchekaluk commented 10 years ago

I'm unable to connect to MS SQL when using the --hostname switch:

$ check_mssql_health -v --hostname=redacted --username=redacted --password=redacted --mode=connection-time
CRITICAL - cannot connect to redacted. DBI connect(';host=redacted;port=1433','redacted',...) failed: OpenClient message: LAYER = (0) ORIGIN = (0) SEVERITY = (78) NUMBER = (44)
Server , database
Message String: Server name not found in configuration files.
OpenClient message: LAYER = (0) ORIGIN = (0) SEVERITY = (78) NUMBER = (45)
Server , database
Message String: Unknown host machine name.
 at /usr/local/bin/check_mssql_health line 3192.

Tue Aug 12 12:51:54 2014: disconnecting DBD without handle

However, I am able to connect when using the --server switch:

$ check_mssql_health --server=redacted --username=redacted --password=redacted --mode=connection-time
OK - 0.06 seconds to connect as redacted | connection_time=0.06;1;5

tsql successfully connects using both the -H and -S switches:

$ TDSVER=8.0 tsql -H redacted -U redacted -P redacted -p 1433
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1> quit

$ TDSVER=8.0 tsql -S redacted -U redacted -P redacted
locale is "en_US.UTF-8"
locale charset is "UTF-8"
using default charset "UTF-8"
1> quit

mssql_miniscript.pl fails in the same manner as reported here.

Versions

rchekaluk commented 10 years ago

A possibly relevant clue from https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/issues/168#issuecomment-4204268:

You are using dataserver and host, one trumps the other.

historicbruno commented 9 years ago

I have similarly found that the script can't connect to a MS SQL server using IP and port. However I don't receive that error, in fact there is nothing more helpful than "(no error string)", even enabling full DBI trace adds little. I tried many variations of the connection string to no avail. I thought it might be that the TDS version is incorrect or a bug in one of the libraries.

The only way it works for me is using server name with matching entries in freetds.conf, which is kind of annoying as more servers are involved.

gitmopp commented 8 years ago

I can confirm the problem Tested with DBD::Sybase: 1.15 freetds: 0.95.67 It looks like the work on DBD::Sybase has stopped.

use DBI;
use strict;

my $username = "sa";
my $password = "password";
my $dsn = "DBI:Sybase:;host=myhost.com;port=61234";
if (my $dbh = DBI->connect(
    $dsn, $username, $password,
    { RaiseError => 1, AutoCommit => 0, PrintError => 1 })) {
  printf "connection succeeded\n";
} else {
  printf "connection failed\n";
}

Error message:

DBI connect(';host=myhost.com;port=61234','sa',...) failed: OpenClient message: LAYER = (0) ORIGIN = (0) SEVERITY = (78) NUMBER = (44)
Server , database
Message String: Server name not found in configuration files.
OpenClient message: LAYER = (0) ORIGIN = (0) SEVERITY = (78) NUMBER = (45)
Server , database
Message String: Unknown host machine name.
gitmopp commented 8 years ago

Problem solved in freetds https://github.com/FreeTDS/freetds/commit/49333d5b35190ca27c0d53d3648276b012887812