No Nagios site only Apache2 Ubuntu Default Page

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.
Locked
michaelpn@get2net.dk
Posts: 3
Joined: Wed Apr 19, 2017 5:59 am

No Nagios site only Apache2 Ubuntu Default Page

Post by michaelpn@get2net.dk »

Hi,

Problem:
I only get the welcome page from Apache2

Use http:// http://nagios-server-ip/

If I use:  http://nagios-server-ip/nagios => get this message=> Not Found

The requested URL /nagios was not found on this server.
Apache/2.4.7 (Ubuntu) Server at xxx.xx.x.xxx Port 80

Done until now:

Configured:

Nagios Server:
Operativt system : Ubuntu 14.04 LTS Server

Create nagcmd group.
sudo groupadd nagcmd
sudo usermod –a –G nagcmd nagios
sudo usermod –a –G nagcmd www-data

Download Nagios and Plugins:
wget https://assets.nagios.com/downloads/nag ... 8.0.tar.gz
and Download nagios plugins.
wget http://nagios-plugins.org/download/nagi ... 0.3.tar.gz


Install Nagios:

tar xzf nagios-4.0.8.tar.gz

chmod -R 777

Cd nagios-4.0.8
Sudo ./configure –with-command-group=nagcmd
Sudo make all
Sudo make install
Sudo make install-init
Sudo make install-config
Sudo make install-commandmode


Install Nagios Web interface:

Sudo make install-webconf
sudo /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/apache2/sites-enabled/nagios.conf
Tjek derefter om filen er blevet opretttet følgende sted.
sudo ls -l /etc/apache2/sites-enabled/


output:
lrwxrwxrwx 1 root root  18 april 17 17:59 000-default.conf
-> ../sites-available/000-default.conf
-rw-r—r—1 root root 982 juli 24 11:00 nagios conf


nagiosadmin:

sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
sudo service apache2 restart


Install Nagios Plugins:

tar xzf nagios-plugins-2.0.3.tar.gz
cd nagios-plugins-2.0.3
Kør følgende command en efter en for at udføre og installerer det.
sudo ./configure --with-nagios-user=nagios --with-nagios-group=nagios
sudo make
sudo make install


Configured files=> /usr/local/nagios/etc directory



Email ID used for Email alerts:

sudo vim /usr/local/nagios/etc/objects/contacts.cfg

[...]
define contact{
        contact_name                    nagiosadmin             ; Short name of user
        use                             generic-contact         ; Inherit default values from generic-contact template (defined above)
        alias                           Nagios Admin            ; Full name of user

        email                           xxx@xxxxx.com  ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
        }
[...]

Saved file and closed


Then, Edit file /etc/apache2/sites-enabled/nagios.conf,

[...]
## Comment the following lines ##
#   Order allow,deny
#   Allow from all

## Uncomment and Change lines as shown below ##
Order deny,allow
Deny from all
Allow from 127.0.0.1 xxx.xx.x.xxx
[...]

Then I'm little bit confused because this file was empty at the beginning now I have configured this above.
Is that correct ?

The last I have done is follwing:


Enable Apache’s rewrite and cgi modul:
sudo a2enmod rewrite
sudo a2enmod cgi
Restart apache services:
sudo service apache2 restart

Check Nagios conf for syntax failure:
sudo /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

sudo service nagios start
sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios

sudo ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios and press Enter
sudo iptables -I INPUT -p tcp --destination-port 80 -j ACCEPT and press Enter
sudo apt-get install -y iptables-persistent and press Enter

Press Enter on Yes to save current IPv4 rules

sudo a2enmod rewrite and press Enter
sudo a2enmod cgi and press Enter
sudo service apache2 restart and press Enter


I think I mist be very close to solve this above. But what do I miss or have done wrong to login in to Nagios site?
I do use a static ip - I have disabled firewall
User avatar
rhassing
Posts: 412
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: No Nagios site only Apache2 Ubuntu Default Page

Post by rhassing »

Rob Hassing
Image
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: No Nagios site only Apache2 Ubuntu Default Page

Post by dwhitfield »

Thanks @rhassing!

michaelpn@get2net.dk, did that resolve your issue?

Also, is there a reason you are compiling old versions of Nagios and plugins? We see old versions from repos a lot, but if you are compiling, you might as well get the latest version (unless some policy prevents it).
michaelpn@get2net.dk
Posts: 3
Joined: Wed Apr 19, 2017 5:59 am

Re: No Nagios site only Apache2 Ubuntu Default Page

Post by michaelpn@get2net.dk »

rhassing wrote:What if you type /nagios after http://nagios-server-ip/
http://nagios-server-ip/nagios/
HI Hassing :)

If I do that ----(http://nagios-server-ip/nagios/) I keep this message: =>

"Not Found
The requested URL /nagios was not found on this server.
Apache/2.4.7 (Ubuntu) Server at xxx.xx.x.xxx Port 80"

If I do this-----(http://nagios-server-ip/) I keep this message: =>
I only get the welcome page from Apache2 which says this is default welcome page used to test the............................if you can see this page it means that the Apache work properly.
michaelpn@get2net.dk
Posts: 3
Joined: Wed Apr 19, 2017 5:59 am

Re: No Nagios site only Apache2 Ubuntu Default Page

Post by michaelpn@get2net.dk »

dwhitfield wrote:Thanks @rhassing!

michaelpn@get2net.dk, did that resolve your issue?

Also, is there a reason you are compiling old versions of Nagios and plugins? We see old versions from repos a lot, but if you are compiling, you might as well get the latest version (unless some policy prevents it).
Hi :)

what version is the best to use ? the latest or do you have some version you particular like or have experience with ? Is it possible to update from the I have now to a newer one ?

Michael :)
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: No Nagios site only Apache2 Ubuntu Default Page

Post by dwhitfield »

At the very least, I'd go with 4.2.4, but the latest is 4.3.1. Instructions at https://support.nagios.com/kb/article.php?id=96

That said, if you want to go with 4.0.8 when can help with the Apache situation.

This is likely a separate issue, but is Nagios running? ps -aef | grep nagios.cfg
Locked