Page 1 of 2

Error update nagios 5.10.0

Posted: Fri May 26, 2023 5:16 am
by igae1
Good morning,

We have made an update from nagios 5.8.9 to 5.10.0. It is observed that the following error is observed in the ssl_error_log file:

[Fri May 26 12:14:26.429061 2023] [:error] [pid 13463] [client 10.8.198.61:57125] PHP Notice: DB is not connected in /usr/local/nagiosxi/html/includes/db.inc.php on line 397, referer: https://guardian01.central.sepg.minhac. ... en/noc.php

[Fri May 26 12:14:26.349491 2023] [:error] [pid 1863] [client 10.8.198.61:57121] PHP Notice: DB is not connected in /usr/local/nagiosxi/html/includes/db.inc.php on line 397, referer: https://guardian01.central.sepg.minhac. ... /index.php

We have the old version of PHP (5.4.16), we don't know where the error could come from. Could you tell us how to proceed?

Re: Error update nagios 5.10.0

Posted: Fri May 26, 2023 1:29 pm
by dawgo
You could try updating 1 at a time to see if that resolves your upgrading issue. So you'd upgrade from 5.8.9 to 5.8.10 then keep going from there. 5.8.10 to 5.9.0, 5.9.0 to 5.9.1. Keep going till you upgrade to the latest.

Re: Error update nagios 5.10.0

Posted: Sun May 28, 2023 10:48 pm
by Misa9x
igae1 wrote: Fri May 26, 2023 5:16 am Good morning,

We have made an update from nagios 5.8.9 to 5.10.0. It is observed that the following error is observed in the ssl_error_log file:

[Fri May 26 12:14:26.429061 2023] [:error] [pid 13463] [client 10.8.198.61:57125] PHP Notice: DB is not connected in /usr/local/nagiosxi/html/includes/db.inc.php on line 397, referer: https://guardian01.central.sepg.minhac. ... en/noc.php incredibox

[Fri May 26 12:14:26.349491 2023] [:error] [pid 1863] [client 10.8.198.61:57121] PHP Notice: DB is not connected in /usr/local/nagiosxi/html/includes/db.inc.php on line 397, referer: https://guardian01.central.sepg.minhac. ... /index.php

We have the old version of PHP (5.4.16), we don't know where the error could come from. Could you tell us how to proceed?
The error message you provided indicates that the Nagios system is encountering an issue with the database connection after upgrading to version 5.10.0. The PHP notice suggests that the database is not connected at line 397 of the file "/usr/local/nagiosxi/html/includes/db.inc.php."

Re: Error update nagios 5.10.0

Posted: Tue Jun 20, 2023 2:36 am
by andyb4u
Hi.

I'm just wondering if you got this resolved? I am experiencing the same thing after upgrading for XI 5.9.1 to 5.10.0.

Databases are online and can confirm access via mysql commandline. XI GUI seems to be responsive and checks are updating etc

Re: Error update nagios 5.10.0

Posted: Sat Jul 01, 2023 11:42 pm
by bekean23
igae1 wrote: Fri May 26, 2023 5:16 am Good morning,

We have made an update from nagios 5.8.9 to 5.10.0. It is observed that the following error is observed in the ssl_error_log file:

[Fri May 26 12:14:26.429061 2023] [:error] [pid 13463] [client 10.8.198.61:57125] PHP Notice: DB is not connected in /usr/local/nagiosxi/html/includes/db.inc.php on line 397, referer: https://guardian01.central.sepg.minhac. ... en/noc.php fnf

[Fri May 26 12:14:26.349491 2023] [:error] [pid 1863] [client 10.8.198.61:57121] PHP Notice: DB is not connected in /usr/local/nagiosxi/html/includes/db.inc.php on line 397, referer: https://guardian01.central.sepg.minhac. ... /index.php

We have the old version of PHP (5.4.16), we don't know where the error could come from. Could you tell us how to proceed?
I think you should review the configuration settings for the database connection in the "db.inc.php" file. Ensure that the database credentials (such as hostname, username, password, and database name) are correct. Also, verify that the database server is running and accessible.

Re: Error update nagios 5.10.0

Posted: Wed Jul 05, 2023 1:09 pm
by vornado
I have this issue after upgrading to 5.11.1. The DR server has this line over 50,000 times, all at the end of the nom.log file:

Code: Select all

PHP Notice:  DB is not connected in /usr/local/nagiosxi/html/includes/db.inc.php on line 399
line 399 mentioned in the error message above is simply the code to display the error message.

PHP version is 7.3.33. I don't see any database connection credentials in db.inc.php, not sure where else to look.

Nagios XI seems to be working, so I'm at a loss as to how the "DB is not connected". Any assistance with this would be appreciated.

Thanks and best regards,

Steve

Re: Error update nagios 5.10.0

Posted: Wed Sep 06, 2023 8:11 am
by maxnuk
Does your Database password contain special characters such as $?

Re: Error update nagios 5.10.0

Posted: Wed Sep 06, 2023 8:13 am
by andyb4u
There are no special characters used in the passwords.

Re: Error update nagios 5.10.0

Posted: Wed Sep 06, 2023 8:50 am
by maxnuk
Change db.inc.php in line 399 to, and put the result?

Code: Select all

trigger_error("DB is not connected for $dbh [$in]", E_USER_NOTICE);

Re: Error update nagios 5.10.0

Posted: Wed Sep 06, 2023 8:55 am
by maxnuk

Code: Select all

function escape_sql_param($in, $dbh, $quote = false)
{
    global $cfg;
    global $DB;

    $escaped = "";

    if ($in === null) {
        $escaped = "NULL";
        $quote = false;
    } else if (is_bool($in)) {
        $quote = false;
    } else {
        switch ($dbh) {
            case DB_NAGIOSXI:
            case DB_NDOUTILS:
            case DB_NAGIOSQL:
                if (@isset($DB[$dbh])) {
                    $escaped = $DB[$dbh]->escape($in);
                } else {
                    // Get the call stack for debugging
                    $call_stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
                    // Get the function that was called before this function
                    $caller_function = $call_stack[1]['function'];
                    // DB is not connected for $dbh
                    $db_name = get_db_name($dbh);
                    trigger_error("DB is not connected for $db_name in $caller_function for [$in]", E_USER_NOTICE);
                }
                break;
            default:
                trigger_error("DB not specified in escape_sql_param", E_USER_NOTICE);
                break;
        }
    }
}