Getting started with Nagios core but no Web Page? Help!

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
markharrison
Posts: 13
Joined: Tue Sep 06, 2016 8:17 am

Getting started with Nagios core but no Web Page? Help!

Post by markharrison »

Hi,
I am testing Nagios for the first time and thought I would try Nagios Core as an introdcution for my company. However after installation I cannot see the web site after completing installation.
I am running RHEL 7.2 and have installed Nagios Core 4.2.0 and plugins 2.1.2
I followed the instructions for RHEL:- https://assets.nagios.com/downloads/nag ... Source.pdf

During the install the httpd start instruction failed saying it was not found. I found instructions else where that I needed to to start the httpd process by running systemctl httpd status and start, which I did successfully. However the Nagios web server failed to start when inserting http://server-address/nagios in my browser.

I then read that it could be due to SElinux and followed instructions to diable it as this might be a cause. setenforce 0 and then made it permenent by using sed -i 's/SELINUX=enforcing/SELINUX=disable/g' /etc/selinux/config

This still has not fixed it. I cannot see the web site. httpd is up and running. The server is not running iptables and not behind a firewall. TBH I'm a little stuck for ideas now. Could anybody help me please?
Thanks

Mark
markharrison
Posts: 13
Joined: Tue Sep 06, 2016 8:17 am

Re: Getting started with Nagios core but no Web Page? Help!

Post by markharrison »

OK! I have ran nmap against the host and it only reports that ssh is running, no port 80. However the server shows the Apache server running?

[root@rlwusit02 tmp]# service httpd status
Redirecting to /bin/systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Tue 2016-09-06 16:29:08 BST; 33min ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 1560 (httpd)
Status: "Total requests: 7; Current requests/sec: 0; Current traffic: 0 B/sec"
CGroup: /system.slice/httpd.service
├─1560 /usr/sbin/httpd -DFOREGROUND
├─2657 /usr/sbin/httpd -DFOREGROUND
├─2658 /usr/sbin/httpd -DFOREGROUND
├─2660 /usr/sbin/httpd -DFOREGROUND
├─2662 /usr/sbin/httpd -DFOREGROUND
└─2665 /usr/sbin/httpd -DFOREGROUND

Sep 06 16:29:07 rlwusit02 systemd[1]: Starting The Apache HTTP Server...
Sep 06 16:29:08 rlwusit02 systemd[1]: Started The Apache HTTP Server.
Last edited by markharrison on Wed Sep 07, 2016 11:43 am, edited 1 time in total.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Getting started with Nagios core but no Web Page? Help!

Post by eloyd »

Try "lsof -i:80" and if you don't have lsof installed, "yum -y install lsof" to install it (great tool). You can also "netstat -na | grep 80" to see if anything is listening on port 80.

If not, then your /etc/httpd/conf/httpd.conf file is not listening on port 80 and that's where you need to look.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
markharrison
Posts: 13
Joined: Tue Sep 06, 2016 8:17 am

Re: Getting started with Nagios core but no Web Page? Help!

Post by markharrison »

Hi eloyd, thanks for your reply.

Here is output from lsof:-

[root@rlwusit02 tmp]# lsof -i:80
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
httpd 1560 root 4u IPv6 8887 0t0 TCP *:http (LISTEN)
httpd 2657 apache 4u IPv6 8887 0t0 TCP *:http (LISTEN)
httpd 2658 apache 4u IPv6 8887 0t0 TCP *:http (LISTEN)
httpd 2660 apache 4u IPv6 8887 0t0 TCP *:http (LISTEN)
httpd 2662 apache 4u IPv6 8887 0t0 TCP *:http (LISTEN)
httpd 2665 apache 4u IPv6 8887 0t0 TCP *:http (LISTEN)
[root@rlwusit02 tmp]#

I don't have IPv6 configured? I thought that should read IPv4?

I also ran curl out put here:-

[root@rlwusit02 tmp]# curl http://localhost/nagios
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>401 Unauthorized</title>
</head><body>
<h1>Unauthorized</h1>
<p>This server could not verify that you
are authorized to access the document
requested. Either you supplied the wrong
credentials (e.g., bad password), or your
browser doesn't understand how to supply
the credentials required.</p>
</body></html>
[root@rlwusit02 tmp]# curl http://localhost/index.html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /index.html was not found on this server.</p>
</body></html>

The nagios seems to ask for authentication. Index.html doesn't exist? If I navigate to the URL http://serveraddress/nagios the page times out. I guess I should receive a login screen. I have tried IE, firefox and chrome.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Getting started with Nagios core but no Web Page? Help!

Post by eloyd »

Then you have one of two things going on:

1) There is a firewall
2) You are using a FQDN that does not translate.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Getting started with Nagios core but no Web Page? Help!

Post by tgriep »

Can you post the Nagios Apache config file?

Code: Select all

/etc/httpd/conf.d/nagios.conf
Then, run the following commands and post the output.

Code: Select all

ls -l /usr/local/nagios/share
ls -l /usr/local/nagios/etc/
I want to see if the config file is correct and that the folders where the files are exist.
Be sure to check out our Knowledgebase for helpful articles and solutions!
markharrison
Posts: 13
Joined: Tue Sep 06, 2016 8:17 am

Re: Getting started with Nagios core but no Web Page? Help!

Post by markharrison »

eloyd wrote:Then you have one of two things going on:

1) There is a firewall
2) You are using a FQDN that does not translate.

Hi eloyd.

I haven't got a firewall between the server and the client. IPTables aren't being used neither. I can ping the server and connect over ssh. httpd status says its running but a nmap scan does not show port 80 being used. The only port open is 22. *scratching my head*
markharrison
Posts: 13
Joined: Tue Sep 06, 2016 8:17 am

Re: Getting started with Nagios core but no Web Page? Help!

Post by markharrison »

tgriep wrote:Can you post the Nagios Apache config file?

Code: Select all

/etc/httpd/conf.d/nagios.conf
Then, run the following commands and post the output.

Code: Select all

ls -l /usr/local/nagios/share
ls -l /usr/local/nagios/etc/
I want to see if the config file is correct and that the folders where the files are exist.
Hi tgriep, thank you for your help

nagios.conf :-

# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER
#
# This file contains examples of entries that need
# to be incorporated into your Apache web server
# configuration file. Customize the paths, etc. as
# needed to fit your system.

ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"

<Directory "/usr/local/nagios/sbin">
# SSLRequireSSL
Options ExecCGI
AllowOverride None
<IfVersion >= 2.3>
<RequireAll>
Require all granted
# Require host 127.0.0.1

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</RequireAll>
</IfVersion>
<IfVersion < 2.3>
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</IfVersion>
</Directory>

Alias /nagios "/usr/local/nagios/share"

<Directory "/usr/local/nagios/share">
# SSLRequireSSL
Options None
AllowOverride None
<IfVersion >= 2.3>
<RequireAll>
Require all granted
# Require host 127.0.0.1

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</RequireAll>
</IfVersion>
<IfVersion < 2.3>
Order allow,deny
Allow from all
# Order deny,allow
# Deny from all
# Allow from 127.0.0.1

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
</IfVersion>
</Directory>



[root@rlwusit02 ~]# ls -l /usr/local/nagios/share
total 156
drwxrwxr-x. 4 nagios nagios 101 Sep 6 15:14 angularjs
drwxrwxr-x. 3 nagios nagios 24 Sep 6 15:14 bootstrap-3.3.0
-rw-rw-r--. 1 nagios nagios 576 Sep 6 15:14 config.inc.php
drwxrwxr-x. 2 nagios nagios 4096 Sep 6 15:14 contexthelp
drwxrwxr-x. 2 nagios nagios 30 Sep 6 15:14 d3
drwxrwxr-x. 3 nagios nagios 27 Sep 6 15:14 docs
-rw-rw-r--. 1 nagios nagios 879 Sep 6 15:14 graph-header.html
-rw-rw-r--. 1 nagios nagios 4136 Sep 6 15:14 histogram-form.html
-rw-rw-r--. 1 nagios nagios 5579 Sep 6 15:14 histogram-graph.html
-rw-rw-r--. 1 nagios nagios 2855 Sep 6 15:14 histogram.html
-rw-rw-r--. 1 nagios nagios 2372 Sep 6 15:14 histogram-links.html
drwxrwxr-x. 3 nagios nagios 4096 Sep 6 15:14 images
drwxrwxr-x. 3 nagios nagios 78 Sep 6 15:14 includes
-rw-rw-r--. 1 nagios nagios 1931 Sep 6 15:14 index.php
-rw-rw-r--. 1 nagios nagios 1660 Sep 6 15:14 infobox.html
drwxrwxr-x. 2 nagios nagios 4096 Sep 6 15:14 js
-rw-rw-r--. 1 nagios nagios 1177 Sep 6 15:14 jsonquery.html
drwxr-xr-x. 4 root root 36 Sep 6 15:25 locale
-rw-rw-r--. 1 nagios nagios 8745 Sep 6 15:14 main.php
-rw-rw-r--. 1 nagios nagios 2015 Sep 6 15:14 map-directive.html
-rw-rw-r--. 1 nagios nagios 3824 Sep 6 15:14 map-form.html
-rw-rw-r--. 1 nagios nagios 647 Sep 6 15:14 map-links.html
-rw-rw-r--. 1 nagios nagios 3298 Sep 6 15:14 map.php
-rw-rw-r--. 1 nagios nagios 1723 Sep 6 15:14 map-popup.html
drwxrwxr-x. 2 nagios nagios 10 Sep 6 15:14 media
-rw-rw-r--. 1 nagios nagios 26 Sep 6 15:14 robots.txt
-rw-rw-r--. 1 nagios nagios 657 Sep 6 15:14 rss-corebanner.php
-rw-rw-r--. 1 nagios nagios 1071 Sep 6 15:14 rss-corefeed.html
-rw-rw-r--. 1 nagios nagios 898 Sep 6 15:14 rss-corefeed.php
-rw-rw-r--. 1 nagios nagios 544 Sep 6 15:14 rss-newsfeed.html
-rw-rw-r--. 1 nagios nagios 1068 Sep 6 15:14 rss-newsfeed.php
-rw-rw-r--. 1 nagios nagios 6163 Sep 6 15:14 side.php
drwxrwxr-x. 2 nagios nagios 32 Sep 6 15:14 spin
drwxrwxr-x. 2 nagios nagios 10 Sep 6 15:14 ssi
drwxrwxr-x. 2 nagios nagios 4096 Sep 6 15:14 stylesheets
-rw-rw-r--. 1 nagios nagios 4243 Sep 6 15:14 trends-form.html
-rw-rw-r--. 1 nagios nagios 4256 Sep 6 15:14 trends-graph.html
-rw-rw-r--. 1 nagios nagios 852 Sep 6 15:14 trends-host-yaxis.html
-rw-rw-r--. 1 nagios nagios 2990 Sep 6 15:14 trends.html
-rw-rw-r--. 1 nagios nagios 3586 Sep 6 15:14 trends-links.html
-rw-rw-r--. 1 nagios nagios 1065 Sep 6 15:14 trends-service-yaxis.html
[root@rlwusit02 ~]#



[root@rlwusit02 ~]# [root@rlwusit02 ~]# ls -l /usr/local/nagios/etc
-rw-r--r--. 1 root root 50 Sep 6 15:52 htpasswd.users
-rw-rw-r--. 1 nagios nagios 44831 Sep 6 15:14 nagios.cfg
drwxrwxr-x. 2 nagios nagios 4096 Sep 6 15:14 objects
-rw-rw----. 1 nagios nagios 1312 Sep 6 15:14 resource.cfg
[root@rlwusit02 ~]#


Thank you again.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Getting started with Nagios core but no Web Page? Help!

Post by eloyd »

Earlier, you wrote:
markharrison wrote: [root@rlwusit02 tmp]# curl http://localhost/index.html
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /index.html was not found on this server.</p>
</body></html>
That tells me that you have a web server listening on port 80 of localhost. If you did not, then you would have gotten a timeout, not a 404 error. 404 errors are delivered by the web server.

Since you go on to say if you "navigate to the URL http://serveraddress/nagios the page times out" that tells me that you have a firewall somewhere that's preventing traffic, that your web server is not listening on the interface that's providing that address, or that you are using a name which does not translate to the correct IP address (or maybe it translates to no address at all). Those are really the only options that fit the facts as you've presented them, assuming that "localhost" and "serveraddress" are the same.

Try this and post the results:

Code: Select all

grep -r "Listen" /etc/httpd/conf*
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Getting started with Nagios core but no Web Page? Help!

Post by tgriep »

Try opening up a browser on a PC and try and connect to the server using the example below.

Code: Select all

http://xxx.xxx.xxx.xxx/nagios/
Replace xxx.xxx.xxx.xxx with the IP address or resolvable DNS name.
It should prompt you to enter in the username and password to login in.
Try that and let me know.

The 401 error from the first post is showing that that Nagios is running on the server and that it is expecting login credentials.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked