Page 2 of 5

Re: Problems on Core 4.3.0

Posted: Wed Feb 22, 2017 10:38 pm
by Box293
chris_rr wrote:On a stock ubuntu 16.04 install, those instructions produce the following upon execution:

#service apache2 restart
Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.

apache2[22876]: AH00526: Syntax error on line 23 of /etc/apache2/sites-enabled/nagios.conf:
apache2[22876]: Invalid command 'AuthFormLoginRequiredLocation', perhaps misspelled or defined by a module not included in the server configuration
apache2[22876]: Action 'configtest' failed.
apache2[22876]: The Apache error log may have more information.

So... what module/package does 4.3 now require to be installed to make this work?

--C
Looks like the new nagios.conf file has been updated and requires some modules. Execute the the following commands and it should work now:

Code: Select all

sudo a2enmod rewrite
sudo a2enmod request
sudo a2enmod auth_form
sudo a2enmod session_cookie
sudo a2enmod session_crypto
sudo a2enmod cgi
sudo systemctl restart apache2.service
I was able to replicate your issue on a test Ubuntu 16.04 server (clean build) and these commands resolved the issue.

Let us know how you go.

Re: Problems on Core 4.3.0

Posted: Wed Feb 22, 2017 11:54 pm
by Box293
Pikmin wrote:Centos 7 here, same problem
I have installed mod_session and now I get an error message about something else
AH00526: Syntax error on line 28 of /etc/httpd/conf.d/nagios.conf:
Feb 23 09:56:46 nagios httpd[945]: Invalid command 'SessionCryptoPassphrase', perhaps misspelled or defined by a module not included in the ...iguration
Feb 23 09:56:46 nagios systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE

Maps are not working for me either anymore:
Last Updated: {{lastUpdate | date:'EEE MMM dd HH:mm:ss yyyy'}}
Nagios® Core™ {{json.data.programstatus.version}} - http://www.nagios.org
Updated every {{updateInterval}} seconds
Logged in as {{json.result.user}}
Warning: Monitoring process may not be running!
Click here for more info.
- Notifications are disabled
- Service checks are disabled
I've been able to progress your issue however I can't get past the new login screen.

Code: Select all

yum install -y mod_session apr-util-openssl
Edit the file /etc/httpd/conf.modules.d/01-session.conf and uncomment the line:
#LoadModule session_crypto_modulemodules/mod_session_crypto.so

Edit the file /etc/httpd/conf.modules.d/00-base.conf and uncomment the line:
#LoadModule request_module modules/mod_request.so

Code: Select all

systemctl restart httpd.service

Re: Problems on Core 4.3.0

Posted: Thu Feb 23, 2017 3:07 am
by Pikmin
Box293 wrote: I've been able to progress your issue however I can't get past the new login screen.

Code: Select all

yum install -y mod_session apr-util-openssl
Edit the file /etc/httpd/conf.modules.d/01-session.conf and uncomment the line:
#LoadModule session_crypto_modulemodules/mod_session_crypto.so

Edit the file /etc/httpd/conf.modules.d/00-base.conf and uncomment the line:
#LoadModule request_module modules/mod_request.so

Code: Select all

systemctl restart httpd.service
Hello again and thank you :)

I have since done the same before seeing your post and can login to the Nagios Core instance, pretty much enabled the same two modules

I was stuck there for a while as httpd refused to start, until I saw the httpd error log which pointed me to install apr-util-openssl

So everything appears to be working correctly except the new maps, now there's a new login page. If I keep the old /etc/httpd/conf.d/nagios.conf and still use 4.3.0 it also works as long as I make the modification posted in this thread (by jfrickson), though map issue is present as well.

Re: Problems on Core 4.3.0

Posted: Thu Feb 23, 2017 3:55 am
by Petr M.
I´am running Nagios on latest Debian with my own created nagios.conf Apache2 configuration file.
I can´t use make install-webconf because it replace all my specific settings (our users are authenticated on Windows domain etc).
Then we don´t need new Login and Logout functions in Nagios 4.3.0.

For me, adding the line
ScriptAlias /nagios/cgibin "/usr/local/nagios/sbin"
to my own nagios.conf which is located in /etc/apache2/conf-available helps me. After this change I restarted Apache2 service and upgrade Nagios to 4.3.0. Now all links works fine and at Home page is displayed Daemon running with PID xxx.
PS: from side.php I removed Logout link.
I hope this helps other users.

But there are another issues on 4.3.0 now.
Map, Trends and Histogram does not anymore.
These functions display the error in attachment. What´s wrong? Legacy links working fine.

Re: Problems on Core 4.3.0

Posted: Thu Feb 23, 2017 4:05 am
by Pikmin
The maps appears to be a separate issue, legacy works fine for me too, will have another go tomorrow at work

Re: Problems on Core 4.3.0

Posted: Thu Feb 23, 2017 8:37 am
by metaldad
Pikmin wrote:The maps appears to be a separate issue, legacy works fine for me too, will have another go tomorrow at work
I had the same problem. I figured out that config.js in /usr/local/nagios/share/js is missing. I looked into the source tar and found a config.js.in. This file needs to be copied to the js directory, renamed (config.js) and modified. Replace value @cgiurl@ with cgibin, so the file looks like:
var nagcfg = {};
nagcfg.cgidir = "cgibin/";


This worked for me.

Re: Problems on Core 4.3.0

Posted: Thu Feb 23, 2017 8:50 am
by pelicanmedia
I have just got back in the office to test.

So with the new 'fix' I have no Nagios and am now unable to restart httpd...

Code: Select all

[root@centos ~]# cd /etc/httpd/conf.d/
[root@centos conf.d]# ls
nagios.conf  php.conf  README  welcome.conf
[root@centos conf.d]# cp nagios.conf nagios.conf.bak
[root@centos conf.d]# ls
[root@centos conf.d]# ls
nagios.conf  nagios.conf.bak php.conf  README  welcome.conf
[root@centos conf.d]# cd
[root@centos ~]# cd downloads/nagios-4.3.0
[root@centos nagios-4.3.0]# make install-webconf
/usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf
if [ 0 -eq 1 ]; then \
		ln -s /etc/httpd/conf.d/nagios.conf /etc/apache2/sites-enabled/nagios.conf; \
	fi

*** Nagios/Apache conf file installed ***

[root@centos nagios-4.3.0]# service restart httpd
restart: unrecognized service
[root@centos nagios-4.3.0]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: [Thu Feb 23 13:01:23 2017] [warn] Useless use of AllowOverride in line 15 of /etc/httpd/conf.d/nagios.conf.
Syntax error on line 38 of /etc/httpd/conf.d/nagios.conf:
Invalid command 'AuthFormLoginRequiredLocation', perhaps misspelled or defined by a module not included in the server configuration
                                                           [FAILED]
/etc/httpd/conf.d/nagios.conf:

Code: Select all

[root@centos nagios-4.3.0]# cat /etc/httpd/conf.d/nagios.conf
# 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/cgibin "/usr/local/nagios/sbin"
ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
Alias /nagios "/usr/local/nagios/share"

<Location "/nagios">
#	SSLRequireSSL
	Options None
	AllowOverride None
	<IfVersion >= 2.3>
		<RequireAll>
			Require all granted
#			Require host 127.0.0.1
			AuthName "Nagios Access"
			AuthUserFile /usr/local/nagios/etc/htpasswd.users
			AuthType form
			AuthFormLoginRequiredLocation "/nagios/login.html"
			Session On
			SessionCookieName NagiosSession path=/nagios
			SessionEnv On
			SessionCryptoPassphrase "fb893181c5925849ea5ad8d2ba99c53f"
			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
		AuthType form
		AuthFormLoginRequiredLocation "/nagios/login.html"
		Session On
		SessionCookieName NagiosSession path=/nagios
		SessionEnv On
		SessionCryptoPassphrase "fb893181c5925849ea5ad8d2ba99c53f"
		Require valid-user
	</IfVersion>
</Location>

<Location "/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 /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>
</Location>

<LocationMatch "/nagios/(login.html|images/corelogo.gif)">
	Require all granted
</LocationMatch>

<Location "/nagios/dologin.html">
	Order allow,deny
	Allow from all
	SetHandler form-login-handler
	AuthFormProvider file
	AuthUserFile /usr/local/nagios/etc/htpasswd.users
	AuthType form
	AuthName "Nagios Access"
	AuthFormLoginRequiredLocation "/nagios/login.html"
	AuthFormLoginSuccessLocation "/nagios/index.php"
	Session On
	SessionCookieName NagiosSession path=/nagios
	SessionEnv On
	SessionCryptoPassphrase "fb893181c5925849ea5ad8d2ba99c53f"
</Location>

<Location /nagios/dologout>
	SetHandler form-logout-handler
	AuthFormLogoutLocation /nagios/login.html?logoff
	session On
	# Expire the session
	SessionMaxAge 1
	SessionCookieName NagiosSession path=/nagios
	SessionCryptoPassphrase "fb893181c5925849ea5ad8d2ba99c53f"
</Location>
When instructions are put on a publicly viewable page, can they please be proof read before posting ? https://assets.nagios.com/downloads/nag ... ading.html
A random ' ; ' at the end of ' cd /etc/httpd/conf.d; '

Code: Select all

service restart httpd
should be

Code: Select all

service httpd restart

Re: Problems on Core 4.3.0

Posted: Thu Feb 23, 2017 8:59 am
by Petr M.
It seems that this upgrade was released without fully testing.
Dou you also enable session, session_cookie, and session_crypto apache modules after you installed new nagios.conf? Try this from previous post:
sudo a2enmod rewrite
sudo a2enmod request
sudo a2enmod auth_form
sudo a2enmod session_cookie
sudo a2enmod session_crypto
sudo a2enmod cgi
sudo systemctl restart apache2.service

Re: Problems on Core 4.3.0

Posted: Thu Feb 23, 2017 9:05 am
by pelicanmedia
Yes it does seem that way, and then the instructions also rushed!

But anyway...

Code: Select all

[root@centos ~]# sudo a2enmod rewrite
sudo: a2enmod: command not found
[root@centos ~]# yum search all a2enmod
Loaded plugins: fastestmirror, priorities, security
Loading mirror speeds from cached hostfile
 * base: mirror.vorboss.net
 * epel: www.mirrorservice.org
 * extras: mirror.vorboss.net
 * remi: rpms.remirepo.net
 * remi-php55: rpms.remirepo.net
 * remi-safe: rpms.remirepo.net
 * updates: mirrors.vooservers.com
Warning: No matches found for: a2enmod
No Matches found
[root@centos ~]# 

Re: Problems on Core 4.3.0

Posted: Thu Feb 23, 2017 9:09 am
by Petr M.
try the commands withous sudo. For ex. on my Debian its working without sudo if your are already as SU