Page 1 of 2
Nagios on OpenBSD
Posted: Wed Sep 28, 2016 4:32 am
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...?
Re: Nagios on OpenBSD
Posted: Wed Sep 28, 2016 11:24 am
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?
Re: Nagios on OpenBSD
Posted: Thu Sep 29, 2016 7:33 am
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
Re: Nagios on OpenBSD
Posted: Thu Sep 29, 2016 12:33 pm
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.
Re: Nagios on OpenBSD
Posted: Fri Sep 30, 2016 5:43 am
by mksmr
Aaaalll right (slaps forehead)... we may call this one settled. PHP wasn't enabled in Apache. My fault.
Matthias
Re: Nagios on OpenBSD
Posted: Fri Sep 30, 2016 7:17 am
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...
Re: Nagios on OpenBSD
Posted: Fri Sep 30, 2016 2:05 pm
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:
You may also need to update the permissions on the lock file, not 100% certain
Re: Nagios on OpenBSD
Posted: Tue Oct 04, 2016 3:07 am
by mksmr
mcapra wrote:
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
Re: Nagios on OpenBSD
Posted: Tue Oct 04, 2016 4:40 am
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
Re: Nagios on OpenBSD
Posted: Tue Oct 04, 2016 11:15 am
by tmcdonald
Glad to hear it - are we alright to close this thread now?