Hello, Need help with Nagios Core 4.4.6

Where did you install nagios from and can you share the output of the following commands.
Code:
ls /usr/local/nagios/share
ls /usr/share/nagios/html
rpm -ql nagios
yum info nagios
 


Where did you install nagios from and can you share the output of the following commands.
Code:
ls /usr/local/nagios/share
ls /usr/share/nagios/html
rpm -ql nagios
yum info nagios


1.I was using some article from google, don't remember the link right now.
2.
ls /usr/local/nagios/share
angularjs d3 histogram-graph.html includes jsonquery.html map-form.html media ssi trends-host-yaxis.html
bootstrap-3.3.7 docs histogram.html index.php locale map-links.html robots.txt stylesheets trends.html
config.inc.php graph-header.html histogram-links.html infobox.html main.php map.php side.php trends-form.html trends-links.html
contexthelp histogram-form.html images js map-directive.html map-popup.html spin trends-graph.html trends-service-yaxis.html

3.
ls /usr/share/nagios/html
ls: cannot access /usr/share/nagios/html: No such file or directory

4.
ls /usr/share/nagios/html
ls: cannot access /usr/share/nagios/html: No such file or directory
[root@nagios aadmin_arybev]# rpm -ql nagios
package nagios is not installed

5.
yum info nagios
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: centos-distro.cavecreek.net
* epel: mirrors.kernel.org
* extras: mirror.fileplanet.com
* updates: sjc.edge.kernel.org
Available Packages
Name : nagios
Arch : x86_64
Version : 4.4.6
Release : 4.el7
Size : 1.8 M
Repo : epel/x86_64
Summary : Host/service/network monitoring program
URL : https://www.nagios.org/projects/nagios-core/
License : GPLv2
Description : Nagios is a program that will monitor hosts and services on your
: network. It has the ability to send email or page alerts when a
: problem arises and when a problem is resolved. Nagios is written
: in C and is designed to run under Linux (and some other *NIX
: variants) as a background process, intermittently running checks
: on various services that you specify.
:
: The actual service checks are performed by separate "plugin" programs
: which return the status of the checks to Nagios. The plugins are
: available at https://github.com/nagios-plugins/nagios-plugins
:
: This package provides the core program, web interface, and documentation
: files for Nagios. Development files are built as a separate package.
 
Can you also share the output of the following?
Code:
rpm -ql nagios
 
Okay seems you have not installed nagios from EPEL, where did you install nagios from and can you share the output of the following?
Code:
rpm -qa | grep nagios
yum list installed | grep nagios
 
Last edited:
Okay seems you have not installed nagios from EPEL, where did you install nagios from and can you share the output of the following?
Code:
rpm -qa | grep nagios
yum list installed | grep nagios


Hi,
I am sorry for the late reply. I am wondering if the Issue could be with the httpd.conf file. Could you please post your httpd.cong file I can compare with mine. I have Server version: Apache/2.4.6 (CentOS) installed. I think you have the same version installed on the nagios server.
 
Hi,
I am sorry for the late reply. I am wondering if the Issue could be with the httpd.conf file. Could you please post your httpd.cong file I can compare with mine. I have Server version: Apache/2.4.6 (CentOS) installed. I think you have the same version installed on the nagios server.
I left my httpd.conf as default, didn't touch it, the problem isn't the httpd.conf config but you installed from a different source.
1.I was using some article from google, don't remember the link right now.
2.
ls /usr/local/nagios/share
angularjs d3 histogram-graph.html includes jsonquery.html map-form.html media ssi trends-host-yaxis.html
bootstrap-3.3.7 docs histogram.html index.php locale map-links.html robots.txt stylesheets trends.html
config.inc.php graph-header.html histogram-links.html infobox.html main.php map.php side.php trends-form.html trends-links.html
contexthelp histogram-form.html images js map-directive.html map-popup.html spin trends-graph.html trends-service-yaxis.html

3.
ls /usr/share/nagios/html
ls: cannot access /usr/share/nagios/html: No such file or directory

4.
ls /usr/share/nagios/html
ls: cannot access /usr/share/nagios/html: No such file or directory
[root@nagios aadmin_arybev]# rpm -ql nagios
package nagios is not installed
Mine is installed from EPEL, if we were using the same source/package we would get the same results in the output your posted. I suggest you remove your version of nagios, remove /etc/httpd/conf.d/nagios.conf and install it from EPEL, if I remember correctly you can install EPEL in CentOS from a package: yum install epel-release.
 
I left my httpd.conf as default, didn't touch it, the problem isn't the httpd.conf config but you installed from a different source.

Mine is installed from EPEL, if we were using the same source/package we would get the same results in the output your posted. I suggest you remove your version of nagios, remove /etc/httpd/conf.d/nagios.conf and install it from EPEL, if I remember correctly you can install EPEL in CentOS from a package: yum install epel-release.


HI !
Do you have the link on the EPEL nagios installation you have used to install the nagios ? I want to try to use it to install a new nagios from scratch.
 
EPEL is a repository not a howto guide, you can do the the following.
1. Remove your current nagios installation: rpm -qa | grep ^nagios | xargs yum remove -y
2. Install the EPEL repository: yum install epel-release -y
3. Install nagios: yum install nagios -y
4. Enable and start nagios and apache: systemctl enable httpd nagios ; systemctl start httpd nagios
5. Edit de nagios apache configuration file, /etc/httpd/conf.d/nagios.conf.
a. Change this line from:
Code:
      Alias /nagios "/usr/share/nagios/html"
b. To this:
Code:
       Alias / "/usr/share/nagios/htm/"
6. Reload the apache configuration: apachectl graceful
7. Change nagiosadmin password: htpasswd /etc/nagios/passwd nagiosadmin (Then enter a password)
8. Go to the hostname or cname you have for your nagios:
a. First try this: http://nagios.example.com
b. If that doesn't work try this: http://nagios.example.com/
 
EPEL is a repository not a howto guide, you can do the the following.
1. Remove your current nagios installation: rpm -qa | grep ^nagios | xargs yum remove -y
2. Install the EPEL repository: yum install epel-release -y
3. Install nagios: yum install nagios -y
4. Enable and start nagios and apache: systemctl enable httpd nagios ; systemctl start httpd nagios
5. Edit de nagios apache configuration file, /etc/httpd/conf.d/nagios.conf.
a. Change this line from:
Code:
      Alias /nagios "/usr/share/nagios/html"
b. To this:
Code:
       Alias / "/usr/share/nagios/htm/"
6. Reload the apache configuration: apachectl graceful
7. Change nagiosadmin password: htpasswd /etc/nagios/passwd nagiosadmin (Then enter a password)
8. Go to the hostname or cname you have for your nagios:
a. First try this: http://nagios.example.com
b. If that doesn't work try this: http://nagios.example.com/


I just followed all your steps and installed nagios from EPEL. I just used my ip address for url I did not add the hostname to DNS. But I still have the same error:

Forbidden
You don't have permission to access / on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Maybe file permissions Issue or name or group name ? This is weird why this is worked for you but does not work for me.

I also, verified logs for errors and found this information: ( the same errors I had on my previous nagios server)


[Tue Jun 15 12:08:50.878213 2021] [authz_core:error] [pid 8781] [client 10.0.7.246:1030] AH01630: client denied by server configuration: /usr/share/nagios/htmlindex.html
[Tue Jun 15 12:08:50.878328 2021] [authz_core:error] [pid 8781] [client 10.0.7.246:1030] AH01630: client denied by server configuration: /usr/share/nagios/htmlindex.php
[Tue Jun 15 12:08:50.878365 2021] [authz_core:error] [pid 8781] [client 10.0.7.246:1030] AH01630: client denied by server configuration: /usr/share/nagios/htmlindex.php
[Tue Jun 15 12:08:50.878409 2021] [authz_core:error] [pid 8781] [client 10.0.7.246:1030] AH01630: client denied by server configuration: /usr/share/nagios/html.noindex.html
 
Last edited:
I just followed all your steps and installed nagios from EPEL. I just used my ip address for url I did not add the hostname to DNS. But I still have the same error:

Forbidden
You don't have permission to access / on this server.

Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.

Maybe file permissions Issue or name or group name ? This is weird why this is worked for you but does not work for me.

I also, verified logs for errors and found this information: ( the same errors I had on my previous nagios server)


[Tue Jun 15 12:08:50.878213 2021] [authz_core:error] [pid 8781] [client 10.0.7.246:1030] AH01630: client denied by server configuration: /usr/share/nagios/htmlindex.html
[Tue Jun 15 12:08:50.878328 2021] [authz_core:error] [pid 8781] [client 10.0.7.246:1030] AH01630: client denied by server configuration: /usr/share/nagios/htmlindex.php
[Tue Jun 15 12:08:50.878365 2021] [authz_core:error] [pid 8781] [client 10.0.7.246:1030] AH01630: client denied by server configuration: /usr/share/nagios/htmlindex.php
[Tue Jun 15 12:08:50.878409 2021] [authz_core:error] [pid 8781] [client 10.0.7.246:1030] AH01630: client denied by server configuration: /usr/share/nagios/html.noindex.html

So, I am not sure where to look for the Issue. I verified the /usr/share/nagios/html directory and index.php file is there but index.html is missing.
 
Can you share what your apache nagios file looks like now, so this file: /etc/httpd/conf.d/nagios.conf ?
 
Last edited:
Can you share what your apache nagios file looks like now, so this file: /etc/httpd/conf.d/nagios.conf ?

Hi !
Here is:

# 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/lib64/nagios/cgi-bin/"

<Directory "/usr/lib64/nagios/cgi-bin/">
# SSLRequireSSL
Options ExecCGI
AllowOverride None
<IfVersion >= 2.3>
<RequireAll>
Require all granted
# Require host 127.0.0.1

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/passwd
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 /etc/nagios/passwd
Require valid-user
</IfVersion>
</Directory>

#Alias /nagios "/usr/share/nagios/html"
Alias / "/usr/share/nagios/html"

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

AuthName "Nagios Access"
AuthType Basic
AuthUserFile /etc/nagios/passwd
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 /etc/nagios/passwd
Require valid-user
</IfVersion>
</Directory>
 
Change this.
Alias / "/usr/share/nagios/html"
To this.
Alias / "/usr/share/nagios/html/"
Then reload apache: apachectl graceful, afterwards it should work with either:
- ip-adress or ip adress/
- hostname.example.com or hostname.example.com/
I think it has to be with the last slash so these two probably won't work:
- ip-adress
- hostname.example.com
And these probably will:
- ip-adress/
- hostname.example.com/
 
Last edited:
Change this.

To this.

Then reload apache: apachectl graceful, afterwards it should work with either:
- ip-adress or ip adress/
- hostname.example.com or hostname.example.com/
I think it has to be with the last slash so these two probably won't work:
- ip-adress
- hostname.example.com
And these probably will:
- ip-adress/
- hostname.example.com/


HI !
Looks like this is resolved the Issue partially. I am able to go straight to Nagios home page now. But if I click on any pages from Nagios home page , looks like the pages showing up not correctly I attached a screenshot .
 

Attachments

  • Error-nagios.jpg
    Error-nagios.jpg
    294.1 KB · Views: 263
In this file: /etc/nagios/cgi.cfg
Change this line:
Code:
url_html_path=/nagios
To this:
Code:
url_html_path=/
Restart nagios(systemctl restart nagios), then it should load the page content correctly.
 
In this file: /etc/nagios/cgi.cfg
Change this line:
Code:
url_html_path=/nagios
To this:
Code:
url_html_path=/
Restart nagios(systemctl restart nagios), then it should load the page content correctly.


THANK YOU SO MUCH !!!
It's worked ! and I did the same tricks on the first nagios I installed not from EPEL and these tricks worked too !!!
Thank you again , I really appreciate your help !!! :)
 
THANK YOU SO MUCH !!!
It's worked ! and I did the same tricks on the first nagios I installed not from EPEL and these tricks worked too !!!
Thank you again , I really appreciate your help !!! :)
Do you remember now from where you installed the nagios you first had installed from? If I were you I would use the one from the EPEL repo since that way you will get automatic updates as well because I'm getting the idea the one you originally installed was installed from a downloaded rpm and not a repo.
 
Do you remember now from where you installed the nagios you first had installed from? If I were you I would use the one from the EPEL repo since that way you will get automatic updates as well because I'm getting the idea the one you originally installed was installed from a downloaded rpm and not a repo.

HI !
Sorry for bothering you again. After your fix everything is working fine except for pnp4nagios , I am not able to view the graphs in the nagios. I am receiving the error bellow. I believe there is should a simple fix but I am not sure where to fix that. Maybe you can help with this thing as well, if it's possible ? I would really appreciate that.


Not Found
The requested URL /pnp4nagios/index.php/graph was not found on this server.

Here is the output from the pnp4nagios.conf file:

# SAMPLE CONFIG SNIPPETS FOR APACHE WEB SERVER

Alias /pnp4nagios "/usr/local/pnp4nagios/share"

<Directory "/usr/local/pnp4nagios/share">
AllowOverride None
Order allow,deny
Allow from all
#
# Use the same value as defined in nagios.conf
#
AuthName "Nagios Access"
AuthType Basic
AuthUserFile /usr/local/nagios/etc/htpasswd.users
Require valid-user
<IfModule mod_rewrite.c>
# Turn on URL rewriting
RewriteEngine On
Options symLinksIfOwnerMatch
# Installation directory
RewriteBase /pnp4nagios/
# Protect application and system files from being viewed
RewriteRule "^(?:application|modules|system)/" - [F]
# Allow any files or directories that exist to be displayed directly
RewriteCond "%{REQUEST_FILENAME}" !-f
RewriteCond "%{REQUEST_FILENAME}" !-d
# Rewrite all other URLs to index.php/URL
RewriteRule "^.*$" "index.php/$0" [PT]
</IfModule>
</Directory>
 
I have never heard of pnp4nagios, that's not part of the default nagios. How did you install pnp4nagios?
 

Members online


Top