Hello, Need help with Nagios Core 4.4.6



stan

Well-Known Member
Credits
6,591
Just make a bookmark in your browser to the exact page you want. After that you won't have to type anything at all, just click on the bookmark. You can edit the Properties of the bookmark to name it whatever you like, like just "Nagios" for example.

Most browers will offer a "bookmark bar" that is just below the URL address input where you type the URL. The "bookmark bar" may not be active by default. This is a great place to store the bookmarks you visit most often. Check your browser settings for "Customize" (in Firefox) if you don't have the "bookmark bar" enabled already.
 

sash2003

New Member
Credits
206
Just make a bookmark in your browser to the exact page you want. After that you won't have to type anything at all, just click on the bookmark. You can edit the Properties of the bookmark to name it whatever you like, like just "Nagios" for example.

Most browers will offer a "bookmark bar" that is just below the URL address input where you type the URL. The "bookmark bar" may not be active by default. This is a great place to store the bookmarks you visit most often. Check your browser settings for "Customize" (in Firefox) if you don't have the "bookmark bar" enabled already.
Just make a bookmark in your browser to the exact page you want. After that you won't have to type anything at all, just click on the bookmark. You can edit the Properties of the bookmark to name it whatever you like, like just "Nagios" for example.

Most browers will offer a "bookmark bar" that is just below the URL address input where you type the URL. The "bookmark bar" may not be active by default. This is a great place to store the bookmarks you visit most often. Check your browser settings for "Customize" (in Firefox) if you don't have the "bookmark bar" enabled already.
Hi Stan,
Thank you for the answer. Yes, this could be one of the good solutions but I am wondering if this is possible to change something on the nagios side to make the link shorter to open the nagios home page.
 

stan

Well-Known Member
Credits
6,591
I am wondering if this is possible to change something on the nagios side to make the link shorter to open the nagios home page.
No, you can't change anything on their website... unless you're the webmaster of that site, or otherwise have access and permission to change it.
 

sash2003

New Member
Credits
206
Stan, I have full access to our Nagios-Core 4.4.6 I created this from scratch. Our System engineer is wondering if this is possible to do it so I am wondering too. I just don't know what should be changed I guess something in the php configuration files but I am not good with php.
 

stan

Well-Known Member
Credits
6,591
Well, then, yes.... you can do it. It may be a lot of work, depending on how your pages are coded with HTML and PHP. I don't know anything about PHP, so I can't help with that. Basically, all of your files and folders in https://nagios.companyname.com/nagios/ would have to be moved "up one level". But you would need to check each HTML/PHP file to watch for "links" to your content... other pages, photos, videos, etc... and possibly correct each link.
 

sash2003

New Member
Credits
206
Well, then, yes.... you can do it. It may be a lot of work, depending on how your pages are coded with HTML and PHP. I don't know anything about PHP, so I can't help with that. Basically, all of your files and folders in https://nagios.companyname.com/nagios/ would have to be moved "up one level". But you would need to check each HTML/PHP file to watch for "links" to your content... other pages, photos, videos, etc... and possibly correct each link.
So, I guess there is a lot of work should be done. Probably this is not worth it.
 

dos2unix

Well-Known Member
Credits
4,118
You could also make your default DocumentRoot /path/to/nagios
in your httpd.conf
 

stan

Well-Known Member
Credits
6,591
You could also make your default DocumentRoot /path/to/nagios
in your httpd.conf
Is httpd.conf standard, or Apache only? I don't do corporate servers... just my simple personal websites using nginx shared server space, so I don't have access to those configs.
 

dos2unix

Well-Known Member
Credits
4,118
Is httpd.conf standard, or Apache only? I don't do corporate servers... just my simple personal websites using nginx shared server space, so I don't have access to those configs.
Good point, but there is also a nginx.conf and you set the webdirectory root in here as well.
 

sash2003

New Member
Credits
206
You could also make your default DocumentRoot /path/to/nagios
in your httpd.conf
HI !
I tried to add nagios path to httpd.conf looks like it did not work.
I did : DocumentRoot "/usr/local/nagios"
I am wondering if I put the right path but this is the default path for nagios.
 

dos2unix

Well-Known Member
Credits
4,118
I tried to add nagios path to httpd.conf looks like it did not work.
I did : DocumentRoot "/usr/local/nagios"
I am wondering if I put the right path but this is the default path for nagios.
I should have been more specific.
Not the path to nagios. But rather the path to your nagios website.
 

f33dm3bits

Gold Member
Gold Supporter
Credits
18,785
You could also just setup a redirect from short name to the long name.
short name: https://nagios.companyname.com/
redirect to: long name: https://nagios.companyname.com/nagios/
It would show up like this when going to the short url.
Code:
curl -I https://nagios.companyname.com/             
HTTP/1.1 301 Moved Permanently
Location: https://nagios.companyname.com/nagios/
 

f33dm3bits

Gold Member
Gold Supporter
Credits
18,785
I found the solution of the result you are actually wanting, I installed nagios on a Rhel8 system from EPEL. It comes installed with apache and has a pre-configured apache configuration file, nagios.conf, that contains an alias in it.
Change this:
Code:
Alias /nagios "/usr/share/nagios/html"
To this:
Code:
Alias / "/usr/share/nagios/html/"
I'm assuming you are running Rhel7 or Rhel8 or something similar as well and have nagios installed from EPEL since the nagios version I installed is the same as the version you are running. So this should it should most likely be the same change for you as well in the /etc/httpd/conf.d/nagios.conf.
 
Last edited:

sash2003

New Member
Credits
206
I found the solution of the result you are actually wanting, I installed nagios on a Rhel8 system from EPEL. It comes installed with apache and has a pre-configured apache configuration file, nagios.conf, that contains an alias in it.
Change this:
Code:
Alias /nagios "/usr/share/nagios/html"
To this:
Code:
Alias / "/usr/share/nagios/html/"
I'm assuming you are running Rhel7 or Rhel8 or something similar as well and have nagios installed from EPEL since the nagios version I installed is the same as the version you are running. So this should it should most likely be the same change for you as well in the /etc/httpd/conf.d/nagios.conf.
OK, I changed the line in the /etc/httpd/conf.d/nagios.conf but I received 403 Forbiden, I don't have permission to view it.
Anyway I found another simple solution and it worked. All what I did I updated httpd.conf file with the following:

<VirtualHost *:80>
ServerName companyname.com
Redirect "/" "https:/nagios/nagios"
</VirtualHost>
 

f33dm3bits

Gold Member
Gold Supporter
Credits
18,785
OK, I changed the line in the /etc/httpd/conf.d/nagios.conf but I received 403 Forbiden, I don't have permission to view it.
Anyway I found another simple solution and it worked. All what I did I updated httpd.conf file with the following:

<VirtualHost *:80>
ServerName companyname.com
Redirect "/" "https:/nagios/nagios"
</VirtualHost>
What distribution and version are you running, that way I can try and recreate your situation in my virtual lab? Can you share what this file looks like: /etc/httpd/conf.d/nagios.conf ?
 

sash2003

New Member
Credits
206
What distribution and version are you running, that way I can try and recreate your situation in my virtual lab? Can you share what this file looks like: /etc/httpd/conf.d/nagios.conf ?
I have Centos 7.9 Core

ok, this is the output from the file:

# 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>
 

f33dm3bits

Gold Member
Gold Supporter
Credits
18,785
Change this:
Code:
Alias /nagios "/usr/share/nagios/html"
To this:
Code:
Alias / "/usr/share/nagios/html/"
Then give apache a graceful and you should be able to access nagios here: http{s}://companyname.com. That works for me on my Rhel7 system. Where did you install nagios from, EPEL?
2021-06-11_23_07_28.jpg


Here's my full configuration.
Code:
# 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>
 
Last edited:

sash2003

New Member
Credits
206
Change this:
Code:
Alias /nagios "/usr/share/nagios/html"
To this:
Code:
Alias / "/usr/share/nagios/html/"
Then give apache a graceful and you should be able to access nagios here: http{s}://companyname.com. That works for me on my Rhel7 system. Where did you install nagios from, EPEL?View attachment 9512

Here's my full configuration.
Code:
# 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>
ok, I have changed the line from Alias /nagios "/usr/local/nagios/share"
to
Alias / "/usr/local/nagios/share"

then I typed https://companyname.com It asked me to type a user name and password when I done it I received 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.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Staff online

Members online


Top