Unable to Access Nagios Web Interface After Updating Nagios Core to 4.5.9
-
ssxitoperations
- Posts: 4
- Joined: Mon Jan 20, 2025 10:31 am
Unable to Access Nagios Web Interface After Updating Nagios Core to 4.5.9
I updated Nagios Core from version 4.5.7 to 4.5.9 by following the instructions at https://assets.nagios.com/downloads/nag ... ading.html.
However, after the update, I cannot access the Nagios web interface. It returns an HTTP Error 500 "This page isn't working and currently unable to handle this request".
Anyone experienced something similar and how to go about resolving?
However, after the update, I cannot access the Nagios web interface. It returns an HTTP Error 500 "This page isn't working and currently unable to handle this request".
Anyone experienced something similar and how to go about resolving?
- jmichaelson
- Posts: 375
- Joined: Wed Aug 23, 2023 1:02 pm
Re: Unable to Access Nagios Web Interface After Updating Nagios Core to 4.5.9
When something like that happens, your best bet is to have a look at the web server error logs. On RHEL/CentOS/Oracle distributions they're most likely under /var/log/php-fpm. On Debian and Ubunto they're most likely under /var/log/apache2. If you attach a snippet of the end of the error log, we'll be able to take a deeper look at it!
Please let us know if you have any other questions or concerns.
-Jason
-Jason
-
ssxitoperations
- Posts: 4
- Joined: Mon Jan 20, 2025 10:31 am
Re: Unable to Access Nagios Web Interface After Updating Nagios Core to 4.5.9
I don't have a /var/log/php-fpm nor do I have a /var/log/apache2 file or folder but I do have a /var/log/httpd/error_log file.jmichaelson wrote: ↑Mon Jan 20, 2025 3:57 pm When something like that happens, your best bet is to have a look at the web server error logs. On RHEL/CentOS/Oracle distributions they're most likely under /var/log/php-fpm. On Debian and Ubunto they're most likely under /var/log/apache2. If you attach a snippet of the end of the error log, we'll be able to take a deeper look at it!
Here are the contents of the error_log (the IP address of the Nagios server is 10.0.0.100):
[Sun Jan 19 03:37:02.366012 2025] [lbmethod_heartbeat:notice] [pid 1148] AH02282: No slotmem from mod_heartmonitor
[Sun Jan 19 03:37:02.412876 2025] [mpm_prefork:notice] [pid 1148] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 configured -- resuming normal operations
[Sun Jan 19 03:37:02.412896 2025] [core:notice] [pid 1148] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Mon Jan 20 09:39:32.751043 2025] [:error] [pid 29188] [client 10.0.10.82:50509] PHP Parse error: syntax error, unexpected '?' in /usr/local/nagios/share/index.php on line 32, referer: http://10.0.0.100/
[Mon Jan 20 09:39:38.110856 2025] [:error] [pid 20384] [client 10.0.10.82:50510] PHP Parse error: syntax error, unexpected '?' in /usr/local/nagios/share/index.php on line 32, referer: http://10.0.0.100/
[Mon Jan 20 09:40:42.447060 2025] [mpm_prefork:notice] [pid 1148] AH00170: caught SIGWINCH, shutting down gracefully
[Mon Jan 20 09:41:08.896502 2025] [suexec:notice] [pid 1154] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Mon Jan 20 09:41:08.953146 2025] [lbmethod_heartbeat:notice] [pid 1154] AH02282: No slotmem from mod_heartmonitor
[Mon Jan 20 09:41:09.163911 2025] [mpm_prefork:notice] [pid 1154] AH00163: Apache/2.4.6 (CentOS) PHP/5.4.16 configured -- resuming normal operations
[Mon Jan 20 09:41:09.163951 2025] [core:notice] [pid 1154] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'
[Mon Jan 20 09:43:17.096856 2025] [:error] [pid 1472] [client 10.0.10.82:50663] PHP Parse error: syntax error, unexpected '?' in /usr/local/nagios/share/index.php on line 32, referer: http://10.0.0.100/
-
MortenSickel
- Posts: 4
- Joined: Tue Jan 21, 2025 7:07 am
Re: Unable to Access Nagios Web Interface After Updating Nagios Core to 4.5.9
I had the same problem the other day. The php code demands a newer version of php than what your server is running. It is using the Null coalescing ?? operator
I.e. if $cfg['theme'] is set. $theme is set to that value, if it is not set, $theme is set to 'dark'
I did a quite ugly hack,
This is hardcoding theme to dark. I could have written a few lines to get the same function as originally, but I didn't bother. The same operator is used a few other places in the code base to do exactly the same thing, so expect the same error to pop up a few more things or grep for ?? (ie grep \?\? *php) to correct them all.
Code: Select all
$theme = $cfg['theme'] ?? 'dark';
if ($theme != 'dark' && $theme != 'light') {
$theme = 'dark';
}I did a quite ugly hack,
Code: Select all
//$theme = $cfg['theme'] ?? 'dark';
$theme = '';
if ($theme != 'dark' && $theme != 'light') {
$theme = 'dark';
}
Last edited by MortenSickel on Tue Jan 21, 2025 8:16 am, edited 1 time in total.
-
ssxitoperations
- Posts: 4
- Joined: Mon Jan 20, 2025 10:31 am
Re: Unable to Access Nagios Web Interface After Updating Nagios Core to 4.5.9
Thanks @MortenSickel !
Your solution fixed it. There are still some quirks, for instance the "Home" page is completely blank, but the rest of the webpages "Services", "Hosts", etc. all are accessible again.
Your solution fixed it. There are still some quirks, for instance the "Home" page is completely blank, but the rest of the webpages "Services", "Hosts", etc. all are accessible again.
-
danderson
Re: Unable to Access Nagios Web Interface After Updating Nagios Core to 4.5.9
The null coalescing operator was added to PHP 7, which released around 9 years ago. Which distribution are you using that's using PHP 5?
-
MortenSickel
- Posts: 4
- Joined: Tue Jan 21, 2025 7:07 am
Re: Unable to Access Nagios Web Interface After Updating Nagios Core to 4.5.9
For my case, it is centOS7, we are in the process of replacing it, but those things take time.
-
ssxitoperations
- Posts: 4
- Joined: Mon Jan 20, 2025 10:31 am
Re: Unable to Access Nagios Web Interface After Updating Nagios Core to 4.5.9
We also have CentOS 7. I need to find some time to migrate away.
-
danderson
Re: Unable to Access Nagios Web Interface After Updating Nagios Core to 4.5.9
The null coalescing operator is some syntactic sugar added in PHP 7. From https://www.php.net/manual/en/migration ... atures.php
So you the fix is as follows
I'll make this change into Core
Code: Select all
<?php
// Fetches the value of $_GET['user'] and returns 'nobody'
// if it does not exist.
$username = $_GET['user'] ?? 'nobody';
// This is equivalent to:
$username = isset($_GET['user']) ? $_GET['user'] : 'nobody';
Code: Select all
//$theme = $cfg['theme'] ?? 'dark';
$them = isset($cfg['theme]) ? $cfg['theme'] : 'dark';
-
danderson