Page 1 of 1

Nagios Core - Web UI on Centos 7

Posted: Wed Mar 18, 2020 6:52 am
by mattcrum
Hi all - I am trying to get Nagios Core installed on a Centos 7 64-bit minimal install VM using the following instructions:

https://support.nagios.com/kb/article/n ... tml#CentOS

The make processes seem to run OK apart from a couple of errors with "make all":
avail.c: In function ‘write_log_entries’:
avail.c:3544:35: warning: comparison between pointer and integer [enabled by default]
if ((t2 - temp_as->time_stamp) > end_date_time) {
^
avail.c:3545:5: warning: zero-length gnu_printf format string [-Wformat-zero-length]
snprintf(duration, sizeof(duration), "");
^
avail.c:3545:5: warning: zero-length gnu_printf format string [-Wformat-zero-length]
When I start the services up, no errors are displayed:

systemctl status httpd.service:
Mar 18 11:30:41 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
Mar 18 11:30:41 localhost.localdomain httpd[12928]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain...is message
Mar 18 11:30:41 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.
systemctl status nagios.service:
Mar 18 11:30:35 localhost.localdomain nagios[12910]: qh: Socket '/usr/local/nagios/var/rw/nagios.qh' successfully initialized
Mar 18 11:30:35 localhost.localdomain nagios[12910]: qh: core query handler registered
Mar 18 11:30:35 localhost.localdomain nagios[12910]: qh: echo service query handler registered
Mar 18 11:30:35 localhost.localdomain nagios[12910]: qh: help for the query handler registered
Mar 18 11:30:35 localhost.localdomain nagios[12910]: wproc: Successfully registered manager as @wproc with query handler
Mar 18 11:30:35 localhost.localdomain nagios[12910]: wproc: Registry request: name=Core Worker 12915;pid=12915
Mar 18 11:30:35 localhost.localdomain nagios[12910]: wproc: Registry request: name=Core Worker 12912;pid=12912
Mar 18 11:30:35 localhost.localdomain nagios[12910]: wproc: Registry request: name=Core Worker 12913;pid=12913
Mar 18 11:30:35 localhost.localdomain nagios[12910]: wproc: Registry request: name=Core Worker 12914;pid=12914
Mar 18 11:30:35 localhost.localdomain nagios[12910]: Successfully launched command file worker with pid 12916
Navigating to URL in a web browser loads the following HTML at a.b.c.d/nagios, but the main.php and side.php files are never loaded (I just see a blank page, the GET requests hang indefinitely).
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

<html>
<head>
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
<title>Nagios: 172.26.116.195</title>
<link rel="shortcut icon" href="images/favicon.ico" type="image/ico">

<script LANGUAGE="javascript">
var n = Math.round(Math.random() * 10000000000);
document.cookie = "NagFormId=" + n.toString(16);
</script>
</head>

<frameset cols="180,*" style="border: 0px; framespacing: 0px">
<frame src="side.php" name="side" frameborder="0" style="">
<frame src="main.php" name="main" frameborder="0" style="">

<noframes>
<!-- This page requires a web browser which supports frames. -->
<h2>Nagios Core</h2>
<p align="center">
<a href="https://www.nagios.org/">www.nagios.org</a><br>
Copyright © 2010-2019 Nagios Core Development Team and Community Contributors.
Copyright © 1999-2010 Ethan Galstad<br>
</p>
<p>
<i>Note: These pages require a browser which supports frames</i>
</p>
</noframes>
</frameset>

</html>
There is an error in the web console "Unknown property 'framespacing'. Declaration Dropped", but nothing else which suggests an issue.

This isn't a firewalld / connectivity problem - port 80 is open on the server and we're receiving the HTML above.

It looks like PHP / interpretation is where it is breaking, so I tried running the main.php file as apache (which is what httpd is running as) on the server to see if it could interpret it - it works fine and outputs HTML:
sudo -u apache php -f /usr/local/nagios/share/main.php

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>

<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
<title>Nagios Core</title>
<link rel="stylesheet" type="text/css" href="stylesheets/common.css?4.4.5" />
<link rel="stylesheet" type="text/css" href="stylesheets/nag_funcs.css?4.4.5" />
<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="js/nag_funcs.js"></script>

<script type='text/javascript'>
var cookie;
var vbox;
var vBoxId = "main";
var vboxText = "<a href=https://www.nagios.com/tours target=_blank> " +
"Click here to watch the entire Nagios Core 4 Tour!</a>";
$(document).ready(function() {
var user = "PHP Notice: Undefined index: REMOTE_USER in /usr/local/nagios/share/main.php on line 29
";

/snip
Not sure where to look next - any suggestions? Please let me know if you need any more information.

Re: Nagios Core - Web UI on Centos 7

Posted: Thu Mar 19, 2020 7:30 am
by scottwilkerson
If you try to load the page, do you see errors here?

Code: Select all

tail -f /var/log/httpd/error_log