Nagios on OpenBSD

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.
mksmr
Posts: 55
Joined: Thu Sep 22, 2016 7:17 am

Nagios on OpenBSD

Post by mksmr »

Hi @all, I am currently switching a number of machines from Linux to OpenBSD and got a bit stuck over the Nagios Monitor. OpenBSD6.0 comes with Nagios Core 4.0.8. I made a fresh install on a vm and installed Nagios per pkg_add, then followed the (aged) instructions at http://www.kernel-panic.it/openbsd/nagios/index.html which mainly applied to OpenBSD 4.8. Nagios itself is running now, and I can authenticate with user/passwd and (partially) access the initial page. Still, this page reports Nagios as "not running" and the side panel is pretty messed up. This is what the whole thing looks like (see attachment).

This is my apache conf module:

Code: Select all

ScriptAlias /nagios/cgi-bin "/var/www/cgi-bin/nagios"

<Directory "/var/www/cgi-bin/nagios">
    Options ExecCGI
    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /var/www/etc/nagios/nagios.passwd
    Require valid-user
    Order deny,allow
    Deny from all
    Allow from all
</Directory>

Alias /nagios "/var/www/nagios"

<Directory "/var/www/nagios">
    DirectoryIndex index.php
    Options None
    AllowOverride None
    AuthName "Nagios Access"
    AuthType Basic
    AuthUserFile /var/www/etc/nagios/nagios.passwd
    Require valid-user
    Order deny,allow
    Deny from all
    Allow from all
</Directory>
...and my cgi.cfg:

Code: Select all

main_config_file=/etc/nagios/nagios.cfg

(changed this manually:)
#physical_html_path=/nagiosdatadir@
physical_html_path=/nagios
url_html_path=/nagios

(no changes from here down to eof)
At first glance I'd assume a path issue...?
Attachments
nagios-screenshot.png
Hulluna humpasta taas
Minä olen hulluna humpasta taas
Minen toivu koskaan, luotan voimaan votkan
Hulluna humpasta taas
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios on OpenBSD

Post by tmcdonald »

Can you hover over a few of the links in the sidebar and copy the paths? I want to see what is being built.

Also, any errors in your Apache logs?
Former Nagios employee
mksmr
Posts: 55
Joined: Thu Sep 22, 2016 7:17 am

Re: Nagios on OpenBSD

Post by mksmr »

This is what the current screen looks like with the provided index.php. I suspect either a path issue or php code not processed properly.

The Apache logs have no suspicious entries.

On hover no popups show up. The first entry in the sidebar ("Curr. Status - Tacticel overview") is a link to
http://<serverip>/nagios/%3C?php%20echo%20$cfg[
(literally what's in the file)


By the way, you will note that with the original out-of-the-box setting, the main page looks like (see below). In my above posting I have attached a screenshot that at least loaded the main.php properly after I had hacked the index.php:

original index.php:

Code: Select all

 <frame src="<?php echo $url; ?>" name="main" frameborder="0" style=""
(this is what you see below)

my hack:

Code: Select all

<frame src="main.php" name="main" frameborder="0" style="">
Probably related, but I have to admit my ignorance about php.

Matthias
Attachments
nagios-screenshot-2.png
Hulluna humpasta taas
Minä olen hulluna humpasta taas
Minen toivu koskaan, luotan voimaan votkan
Hulluna humpasta taas
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Nagios on OpenBSD

Post by rkennedy »

What is the output of php -V from the CLI? Are you able to verify php is running in conjunction with apache?

Creating a page with <?php phpinfo(); ?> should help provide a bit of information if you're able to do so. Hacking together the functions will work, but it seems like a bigger issue here than just the HTML side bar.
Former Nagios Employee
mksmr
Posts: 55
Joined: Thu Sep 22, 2016 7:17 am

Re: Nagios on OpenBSD

Post by mksmr »

Aaaalll right (slaps forehead)... we may call this one settled. PHP wasn't enabled in Apache. My fault.

Matthias
Hulluna humpasta taas
Minä olen hulluna humpasta taas
Minen toivu koskaan, luotan voimaan votkan
Hulluna humpasta taas
mksmr
Posts: 55
Joined: Thu Sep 22, 2016 7:17 am

Re: Nagios on OpenBSD

Post by mksmr »

One more thing... I'm still getting a message that nagios wasn't running while it actually is. I understand that the apache user needs to have read access to status files, namely
status.dat
retention.dat
nagios.qh

In this installation, the files are located here:
/var/www/var/nagios/status.dat
/var/www/var/nagios/
/var/nagios/rw/nagios.qh

and they are either group (www) or world readable. I'm clearly still missing something here...
Attachments
nagios-screenshot-3.png
Hulluna humpasta taas
Minä olen hulluna humpasta taas
Minen toivu koskaan, luotan voimaan votkan
Hulluna humpasta taas
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Nagios on OpenBSD

Post by mcapra »

If it's just a cosmetic thing, I would suggest raising a github issue:
https://github.com/NagiosEnterprises/nagioscore/issues

I can't find anything particularly different about how the pid is assessed between BSD and GNU. Can you share the output of:

Code: Select all

ls -al /var/www/var/nagios
You may also need to update the permissions on the lock file, not 100% certain
Former Nagios employee
https://www.mcapra.com/
mksmr
Posts: 55
Joined: Thu Sep 22, 2016 7:17 am

Re: Nagios on OpenBSD

Post by mksmr »

mcapra wrote:

Code: Select all

ls -al /var/www/var/nagios
You may also need to update the permissions on the lock file, not 100% certain

Code: Select all

#  ls -al /var/www/var/nagios
-rw-r--r--  1 _nagios  _nagios  12640 Sep 30 13:17 objects.cache
-rw-------  1 _nagios  _nagios  12989 Oct  4 09:17 retention.dat
drwxrwxr-x  2 _nagios  www        512 Sep 30 13:17 rw
-rw-rw-r--  1 _nagios  _nagios  13423 Oct  4 10:01 status.dat
I changed the ownership/perms on
/var/www/var/nagios/retention.dat to

Code: Select all

-rw-r-----  1 _nagios  www      12989 Oct  4 09:17 retention.dat
just to make sure. No effect, though.

Matthias
Hulluna humpasta taas
Minä olen hulluna humpasta taas
Minen toivu koskaan, luotan voimaan votkan
Hulluna humpasta taas
mksmr
Posts: 55
Joined: Thu Sep 22, 2016 7:17 am

Re: Nagios on OpenBSD

Post by mksmr »

mksmr wrote: I changed the ownership/perms on
/var/www/var/nagios/retention.dat to

Code: Select all

-rw-r-----  1 _nagios  www      12989 Oct  4 09:17 retention.dat
just to make sure. No effect, though.
Edit - for some reason it's running now. Restart of Nagios brought the old fileperms back on retention.dat, but I can access everything. No idea why it wouldn't do before.

Thanks a lot everybody.

Matthias
Hulluna humpasta taas
Minä olen hulluna humpasta taas
Minen toivu koskaan, luotan voimaan votkan
Hulluna humpasta taas
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios on OpenBSD

Post by tmcdonald »

Glad to hear it - are we alright to close this thread now?
Former Nagios employee
Locked