Nagios setup failing connect via web Error 403

I have a clean OS install of Leap 15 with KDE desktop with the addition of apache2 and php.

After first boot, I install 4 updates. After that, I get prompted to install another 297 updates followed by reboot.

After all that is done, I configure the box name and IP address. Followed by a reboot for no reason other than I feel better about it.

At which point, I log in to GUI via KDE as root, open YaST2, and goto Software Management where I search for Nagios, and install all that is returned. At which point a bunch of extra stuff is added as well such as additional php stuff.

Once install of nagios is complete, I set the the apache2 and nagios service to On Boot in Yast2 Service Manager.

Run the following command;
htpasswd2 -c /etc/nagios/htpasswd.users nagiosadmin

Then reboot.

And that is as far as I get to feeling like I am making progress.

Upon reboot. I can connect to http://localhost/manual which shows all the apache2 documents. This allows me to believe (probably falsely) that apache is working correctly.
When I try connecting to http://localhost/nagios, I am prompted with a authentication box where I give it the nagios admin creds I added to the nagios htpasswd file above, and upon hitting enter I get the following…

Access Forbidden
You dont have permission to access the requested directory. There is no Index document or the Directory is read only.

Error 403
Localhost
Apache

I have looked thru out all the config files I could find. Looked at and try changing the destination directories permissions. And looked at group membership.

What am I missing?

Thanks,
John

Hi
Read the docs :wink: Generally you will find a SUSE Readme file…

https://build.opensuse.org/package/view_file/server:monitoring/nagios/nagios-README.SuSE?expand=1

Yeah, that was about not helpful. That is the first time I have seen that page any any searches via google or suse pages. Please dont treat me like a noob. I have spent some time RTFM and looking over the MAN files along with what few addition threads are on the topic related to SuSE and Nagios. And lets not get started on the documentation found in the config files them self.

And many of the other threads are from installation from source. With running suse, and being able to install from Yast Software Manager, I shouldnt have to do that. Just search, add, install. It should work.

The big bonus from it was this…
chmod 640 SYSCONFDIR/htpasswd.users
chown --no-dereference root:www SYSCONFDIR/htpasswd.users

Apparently a quickstart.html file is suppose to have all the answers and after doing a locate, was no where to be found. As such, I go back to this thread to say I could use some assistance.

John

Hi
Don’t shoot the messenger, just pointing it out… I’ll leave you to it…

Oh come on. You thought you could be smart by saying read the doc’s and that was going to be helpful. Telling me to read the doc’s is no more help to me than what i started with. Did you even read the link, or just search, copy, and paste?

To anyone (Including Malcomlewis here) interested in assisting me in sorting out whats going on. Please, feel free to ask me for any logs or command outputs. I am more than willing to provide. Sadly, my short comings is with apache and sql. 2 items I know could be blocking this from working. As I recall my SLES 9 and 10 setup, MYSQL was needed as the backend of Nagios in the pre core days.

Assuming this is a installation issue, how do I go about collecting the proper information to submit a bug on this? Since this is installable from Software Manager, it should be safe to assume that after installed, a user on the localhost should be able to connect to http://localhost/nagios. There was no instructions to add user to htpasswd file, google help me find that.

Short info on me.
I am an almost 20 yr IT career professional working in windows bases cloud platform. And been using suse in my home since the early 2000’s with SuSE 6.4. I may not be a expert at linux, but I am not a noob. Just dont use linux enough day to day to have this information memorized. And suse with its gui based tools such as YaST makes any one look like a linux pro… :slight_smile:

Hi
Not at all, seems a pertinent clue and from my openSUSE/SUSE experience there is generally a SUSE readme down in /usr/share/doc/packages directory.

Looking at the spec file, the nagios systemd service should have applied those changes in the readme, I’m assuming the service is up and running without error?


systemctl status nagios

Short of an install of Leap 15 (which am happy to do) and install the nagios package, can you confirm if it’s the default Leap version or did you grab the later version from the server:monitoring repo?

Anything of interest in the logs /var/log/nagios directory?

I don’t really do the experience thing, but have had a number of years experience with Solaris and Linux running nagios :wink:

So I grabbed the full ISO (roughly just under 4GB). The image was only downloaded a few weeks ago.
If I am not mistaken, its Build 267.2 as found in the media file found in the media.1 folder.

I have installed this on a fullvirt VM on a XEN server on a Dell R710 2U server with.

systemctl status nagios reports the following…
● nagios.service - Network Monitor Nagios
Loaded: loaded (/usr/lib/systemd/system/nagios.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2018-12-03 18:07:03 PST; 2h 39min ago
Process: 1492 ExecStartPre=/usr/sbin/nagios -v /etc/nagios/nagios.cfg (code=exited, status=0/SUCCESS)
Process: 1388 ExecStartPre=/usr/lib/nagios/nagios-exec-start-pre (code=exited, status=0/SUCCESS)
Main PID: 1499 (nagios)
Tasks: 6 (limit: 4915)
CGroup: /system.slice/nagios.service
├─1499 /usr/sbin/nagios /etc/nagios/nagios.cfg
├─1501 /usr/sbin/nagios --worker /var/lib/nagios/nagios.qh
├─1502 /usr/sbin/nagios --worker /var/lib/nagios/nagios.qh
├─1503 /usr/sbin/nagios --worker /var/lib/nagios/nagios.qh
├─1504 /usr/sbin/nagios --worker /var/lib/nagios/nagios.qh
└─1507 /usr/sbin/nagios /etc/nagios/nagios.cfg

Dec 03 18:07:03 nagios nagios[1499]: nerd: Fully initialized and ready to rock!
Dec 03 18:07:03 nagios nagios[1499]: wproc: Successfully registered manager as @wproc with query handler
Dec 03 18:07:03 nagios nagios[1499]: wproc: Registry request: name=Core Worker 1504;pid=1504
Dec 03 18:07:03 nagios nagios[1499]: wproc: Registry request: name=Core Worker 1503;pid=1503
Dec 03 18:07:03 nagios nagios[1499]: wproc: Registry request: name=Core Worker 1502;pid=1502
Dec 03 18:07:03 nagios nagios[1499]: wproc: Registry request: name=Core Worker 1501;pid=1501
Dec 03 18:07:03 nagios nagios[1499]: Successfully launched command file worker with pid 1507
Dec 03 18:07:03 nagios nagios[1499]: Successfully launched command file worker with pid 1507
Dec 03 19:07:03 nagios nagios[1499]: Auto-save of retention data completed successfully.
Dec 03 20:07:03 nagios nagios[1499]: Auto-save of retention data completed successfully.

The last couple of log entries show the following clean starts…

[1543889223] Nagios 4.3.4 starting… (PID=1499)
[1543889223] Local time is Mon Dec 03 18:07:03 PST 2018
[1543889223] LOG VERSION: 2.0
[1543889223] qh: Socket ‘/var/lib/nagios/nagios.qh’ successfully initialized
[1543889223] qh: core query handler registered
[1543889223] nerd: Channel hostchecks registered successfully
[1543889223] nerd: Channel servicechecks registered successfully
[1543889223] nerd: Channel opathchecks registered successfully
[1543889223] nerd: Fully initialized and ready to rock!
[1543889223] wproc: Successfully registered manager as @wproc with query handler
[1543889223] wproc: Registry request: name=Core Worker 1504;pid=1504
[1543889223] wproc: Registry request: name=Core Worker 1503;pid=1503
[1543889223] wproc: Registry request: name=Core Worker 1502;pid=1502
[1543889223] wproc: Registry request: name=Core Worker 1501;pid=1501
[1543889223] Successfully launched command file worker with pid 1507
[1543892823] Auto-save of retention data completed successfully.
[1543896423] Auto-save of retention data completed successfully.

there were log entries of missing plug in such as check_ping, check_http, and check_ssh. As those will be things I need to resolve. I had installed the 4 monitoring plugin packages. But this would be something which I will need to research but shouldnt block the service or the connecting to the web portal.

According to the NAGIOS.SUSE file…
A quickstart installation guide can now be found in the
package nagios-www. You can find the quickstart guide
(quickstart.html) in the following subdirectory:

/usr/share/nagios/docs/

When I look in that folder I dont see the quickstart.html file.

To minimize the files to only those starting with “Q”

nagios:~ # ls /usr/share/nagios/docs/q*
/usr/share/nagios/docs/qh.html

I would apprechiate if you could test a install. This is for my home setup and am in no rush. My son is going to college for IT and in a linux class now with a advanced linux class next quarter. And I am just trying to put together my old college lab environment back online for him. Like I said, no rush.

and when I use locate command…

nagios:~ # locate -i quickstart.html
nagios:~ #

Something that should never be done!

Read also: SDB:Login as root - openSUSE Wiki

As much as I know your right and I agree with the stance in a corporate environment, this is my home setup. And I have no problems using the root account. Frankly, the system has no other accounts as I plan on getting LDAP setup again where I will store all user account information.

In my next thread I start, I will dig into what it takes to setup LDAP. SLES 9 and 10 were cake and i had it setup with no real effort. But with SLES 11 and beyond I never could get it setup. And Open SuSE has almost no automation expecting you to know everything.

malcolmlewis, I am at the office today and wont be home for 12hrs from the time of this post which means responses will be slow. I may create a VM at work for testing on time permitting.

Hi
OK, so php7 is not enabled by default…


a2enmod php7
systemctl restart apache2 nagios

My post was not posted with the intention to change your ideas about this. This is a forums where all sorts of openSUSE users are reading and none of them, whatever their level of Unix/Linux experience, should get the idea that it is a clever thing to log in in the GUI as root. It is more a warning to others then to you.

As I didnt know what a2enmod was used for or that it existed until you suggested I try it. So I looked it up.
a2enmod is a script that enables the specified module within the apache2 configuration. It does this by creating symlinks within /etc/apache2/mods-enabled. Likewise, a2dismod disables a module by removing those symlinks.

Malcolmlewis, as soon as i get home, I will give this a try.

If you’re setting up a brand new Nagios and not upgrading,
I’d strongly recommend that you take a look at and consider alternatives.

Natios is first of all the first, most widely used Enterprise network monitoring system, and as such will probably forever set standards and interfaces that all other later network monitoring systems must continue to support.

But, IMO it has always been a shoe-horned design which never incorporated “Best design” even in its early years.
And, especially in its default form is an incredibly difficult and time-consuming beast to build out without proper tools to configure and validate plugins, and without a structure that enforces proper customization.
I have also never seen a regular Nagios set up by anyone who did it right, observing the possible layers of “manged by groups,” I’ve only seen what people create that’s expedient (If it works, then that’s good enough."

There are many more modern network monitoring systems that have been created in the years since, some FOSS and some commercial, or some kind of hybrid combination of both. One particular improvement most have is to store data and configurations in a database instead of text files with all the benefits like better security and performance. One solution I used (doesn’t exist anymore) enabled me to configure, validate and deploy plugins and clients in minutes… Compare that with possibly up to a week (Yes, multiple days) which wouldn’t be uncommon doing the same in Nagios.

I recommend Icinga which can be found in the OSS
Others I’ve used include ZenOSS. I have not used Solarwinds, but have heard great things about it.
Take your time and build a few VMs running different solutions, you’ll probably find about 20 alternatives out there today with maybe a half dozen you can strongly consider for your purposes.

Nagios is still important for some situations, but it’s really the last option I’d choose over practically all others.
And, that’s from someone who’d like to think is reasonably expert in the app.

HTH,
TSU

Thanks for the thought. My experience with Enterprise Network monitoring is locked down to Microsoft SCOM due to where I work. I stumbled across Nagios back with SLES 9 I believe. And though it was a beast to setup, I was able to do it as compared to now… lol

The only reason I was going to use nagios is as its something I am familiar with and its searchable in Software Manager. I will take your advice and do some looking. As I understand your idea about having a sql back end, its something I dont have much experience in and there is no YaST module to manage it with (to my knowledge). So SQL becomes a deal breaker for me.

Since you called out Icinga, I will start my research there while I continue setting up Nagios.

thanks,
John

On Tue 04 Dec 2018 06:16:03 PM CST, Johnfm3 wrote:

tsu2;2887998 Wrote:
>
> …Nagios is still important for some situations, but it’s really the
> last option I’d choose over practically all others.
> And, that’s from someone who’d like to think is reasonably expert in
> the app.
>
> HTH,
> TSU

Thanks for the thought. My experience with Enterprise Network
monitoring is locked down to Microsoft SCOM due to where I work. I
stumbled across Nagios back with SLES 9 I believe. And though it was a
beast to setup, I was able to do it as compared to now… lol

The only reason I was going to use nagios is as its something I am
familiar with and its searchable in Software Manager. I will take your
advice and do some looking. As I understand your idea about having a
sql back end, its something I dont have much experience in and there is
no YaST module to manage it with (to my knowledge). So SQL becomes a
deal breaker for me.

Since you called out Icinga, I will start my research there while I
continue setting up Nagios.

thanks,
John

Hi
Just a word of caution with dB’s if your going that route, pop it on a
xfs partition and exclude from btrfs…


Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
SLES 15 | GNOME Shell 3.26.2 | 4.12.14-25.25-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

thanks for the advise. Personally Flat Files are just fine for my needs. I will investigate other solutions, but I want to try and setup Nagios as other than scom, I am familiar with it. Many thanks for your help on this. I have setup a VM on my work machine and going to test your advise to enable php7 during lunch. I will get back to this thread in a hour or so.

John

Ok, so here is a interesting piece of information found in /var/log/apache2/error_log

[Tue Dec 04 11:37:44.406337 2018] [autoindex:error] [pid 1603] [client ::1:57066] AH01276: Cannot serve directory /usr/share/nagios-themes/exfoliation/: No matching DirectoryIndex (index.html,index.html.var,index.php4,index.php5,index.php) found, and server-generated directory index forbidden by Options directive

which is correct. That folder only has 2 sub folders (images and stylesheets).

I wander if the nagios config for apache2 (/etc/apache2/conf.d/nagios.conf) is wrong, and needs to be pointed to /usr/share/nagios/

Ok, that seems to be it. We have access to the web portal now. I made the following change to the apache2 nagios conf file…

From:
Alias /nagios “/usr/share/nagios-themes/exfoliation”

To:
Alias /nagios “/usr/share/nagios”

I have no clue what the first folder does, but use of locate to find index.html followed by grep to filter out for nagios gave me the file location.

linux-fkcd:~ # locate index.html | grep nagios
/usr/share/doc/ghc-8.0.2/html/libraries/nagios-check-0.3.2/doc-index.html
/usr/share/doc/ghc-8.0.2/html/libraries/nagios-check-0.3.2/index.html
/usr/share/nagios/index.html
/usr/share/nagios/docs/index.html
linux-fkcd:~ #

And the only response which made sense was /usr/share/nagios/index.html

Now the real question, was that the only change needed to make this work? If so, finding out how do I go about filing a bug on this install.

Hi
I only installed nagios and nagios-contrib (for plugin checks) no themes and let it pull the other required packages, which leaves an index.php (not html) hence the need to enable php7. It would be a bug in the theme package(s).