Page 3 of 3

Re: Upgrade is Failing

Posted: Fri Aug 09, 2019 12:38 pm
by scottwilkerson
Can you show what command/plugin these checks are using?

Re: Upgrade is Failing

Posted: Fri Aug 09, 2019 12:45 pm
by scottwilkerson
Also, are you 100% sure the correct IP for the Ubuntu server is whitelisted and added to the user permissions for the user you are connecting as on the MSSQL server?

I ask because this is the exact error you would receive if a connection could not be made

Re: Upgrade is Failing

Posted: Fri Aug 09, 2019 1:07 pm
by nelsonw
Hi Scott,

The command that is being run is

/usr/local/nagios/libexec/check_mssql -H <HOST> --username <USERNAME> --password <PWD> --database <DATABASE> --port 1433 --query "$QUERY" --result "$RESULT" --decode --warning $W_DURATION --critical $C_DURATION --querywarning $WARNING --querycritical $CRITICAL --result $RESULT

Reading online, it appears php7.2 can no longer be used to connect to MSSQL database (see link https://www.php.net/manual/en/function. ... onnect.php). Are there any alternative solutions?




FYI - check_mssql is failing at
$db_dsn = "dblib:{$db_dsn_host};dbname={$db_name}";
try {
$connection = new PDO($db_dsn, $db_user, $db_pass);
} catch (PDOException $e) {
$exit_code = 2;
$output_msg = "CRITICAL: Could not connect to $db_dsn as $db_user (Exception: " . $e->getMessage() . ").\n";
display_output($exit_code, $output_msg);
}

Re: Upgrade is Failing

Posted: Fri Aug 09, 2019 1:15 pm
by scottwilkerson
nelsonw wrote:Reading online, it appears php7.2 can no longer be used to connect to MSSQL database (see link https://www.php.net/manual/en/function. ... onnect.php). Are there any alternative solutions?
I believe this is for sybase_connect
nelsonw wrote:FYI - check_mssql is failing at
$db_dsn = "dblib:{$db_dsn_host};dbname={$db_name}";
try {
$connection = new PDO($db_dsn, $db_user, $db_pass);
} catch (PDOException $e) {
$exit_code = 2;
$output_msg = "CRITICAL: Could not connect to $db_dsn as $db_user (Exception: " . $e->getMessage() . ").\n";
display_output($exit_code, $output_msg);
}
I was doing some research and you may need to change this

Code: Select all

$db_dsn = "dblib:{$db_dsn_host};dbname={$db_name}";
to this

Code: Select all

$db_dsn = "sqlsrv:{$db_dsn_host};dbname={$db_name}";
or

Code: Select all

$db_dsn = "mssql:{$db_dsn_host};dbname={$db_name}";

Re: Upgrade is Failing

Posted: Fri Aug 09, 2019 1:21 pm
by scottwilkerson
We just tested this on on an Ubuntu 18.04 machine with php 7.2 without any modifications and it worked as expected.

Can you show the output of the following:

Code: Select all

dpkg -l | grep tds
I'm looking to see if you have the package freetds-common

Re: Upgrade is Failing

Posted: Fri Aug 09, 2019 1:58 pm
by nelsonw
Thanks Scott, I think I have got to the bottom of the issue. As you suspected, the database I am connecting to is not visible from my Ubuntu host.

BTW - I sent you a PM. I obviously tried a full install on an existing NagiosXI install (and also attempted restore_xi.ksh) in an attempt to fix this Ubuntu upgrade issue. Would this failed full install and failed restore_xi.ksh have corrupted by existing Nagios XI set up on the Ubuntu server.

I provided log files for the full_install. Please let me know if you need log files for the restore_xi.ksh attempt


Regards,
Nelson

Re: Upgrade is Failing

Posted: Fri Aug 09, 2019 2:00 pm
by nelsonw
FYI -

dpkg -l | grep tds
ii freetds-bin 1.00.82-2 amd64 FreeTDS command-line utilities
ii freetds-common 1.00.82-2 all configuration files for FreeTDS SQL client libraries

Re: Upgrade is Failing

Posted: Fri Aug 09, 2019 3:02 pm
by scottwilkerson
What error are you getting when trying to run the restore_xi.sh ?