Error update nagios 5.10.0

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
igae1
Posts: 33
Joined: Thu May 25, 2017 6:35 am

Error update nagios 5.10.0

Post 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?
dawgo
Posts: 15
Joined: Thu Apr 13, 2023 9:48 am

Re: Error update nagios 5.10.0

Post 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.
Misa9x
Posts: 2
Joined: Sun May 28, 2023 10:41 pm

Re: Error update nagios 5.10.0

Post 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."
andyb4u
Posts: 114
Joined: Tue Aug 15, 2017 1:58 am

Re: Error update nagios 5.10.0

Post 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
bekean23
Posts: 7
Joined: Sat Jul 01, 2023 11:39 pm

Re: Error update nagios 5.10.0

Post 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.
vornado
Posts: 79
Joined: Wed Jun 13, 2018 9:17 am

Re: Error update nagios 5.10.0

Post 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
User avatar
maxnuk
Posts: 3
Joined: Wed Jan 09, 2019 7:29 am

Re: Error update nagios 5.10.0

Post by maxnuk »

Does your Database password contain special characters such as $?
andyb4u
Posts: 114
Joined: Tue Aug 15, 2017 1:58 am

Re: Error update nagios 5.10.0

Post by andyb4u »

There are no special characters used in the passwords.
User avatar
maxnuk
Posts: 3
Joined: Wed Jan 09, 2019 7:29 am

Re: Error update nagios 5.10.0

Post 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);
User avatar
maxnuk
Posts: 3
Joined: Wed Jan 09, 2019 7:29 am

Re: Error update nagios 5.10.0

Post 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;
        }
    }
}
Post Reply