Error Whoops! Error: Could not open CGI config file

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.
fm2ahmed
Posts: 32
Joined: Wed Oct 09, 2013 9:41 am

Error Whoops! Error: Could not open CGI config file

Post by fm2ahmed »

Hi,

I updated Nagios Core from 3.2.3 to 4.0.1. We previously had it installed in a directory called /usr/local/nagios-3.2.3. But then the upgraded version is now installed in /usr/local/nagios-4.0.2. The upgrade went fine but one of the links on the left "MAP" when i click on it gives this error.

------------------------
Whoops!
Error: Could not open CGI config file '/usr/local/nagios-3.2.3/etc/cgi.cfg' for reading!
-------------------------

Why is it still taking the old location and where is it taking it from ?? We have got Apache linked to it.

Awaiting quick reply.

Regards,
Farooq Ahmed
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Error Whoops! Error: Could not open CGI config file

Post by abrist »

Maybe your init script is still pointing to the old config location?

Code: Select all

grep "prefix=" /etc/init.d/nagios
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
fm2ahmed
Posts: 32
Joined: Wed Oct 09, 2013 9:41 am

Re: Error Whoops! Error: Could not open CGI config file

Post by fm2ahmed »

Hi,

Just checked that and it looks OK.

prefix=/usr/local/nagios-4.0.2
exec_prefix=/usr/local/nagios-4.0.2

What can be the problem??? Please help.
fm2ahmed
Posts: 32
Joined: Wed Oct 09, 2013 9:41 am

Re: Error Whoops! Error: Could not open CGI config file

Post by fm2ahmed »

Hi,

Is it that there is a symlink to the old config in Apache??
fm2ahmed
Posts: 32
Joined: Wed Oct 09, 2013 9:41 am

Re: Error Whoops! Error: Could not open CGI config file

Post by fm2ahmed »

Hi,

This is how the entries are in /etc/init.d/nagios

prefix=/usr/local/nagios-4.0.2
exec_prefix=/usr/local/nagios-4.0.2
NagiosBin=${exec_prefix}/bin/nagios
NagiosCfgFile=/usr/local/nagios-4.0.2/etc/nagios.cfg
NagiosStatusFile=${prefix}/var/status.dat
NagiosRetentionFile=${prefix}/var/retention.dat
NagiosCommandFile=${prefix}/var/rw/nagios.cmd
NagiosVarDir=${prefix}/var
NagiosRunFile=${prefix}/var/nagios.lock
NagiosLockDir=/var/lock/subsys
NagiosLockFile=nagios
NagiosCGIDir=${exec_prefix}/sbin
NagiosUser=nagios
NagiosGroup=nagcmd

Anything wrong???
fm2ahmed
Posts: 32
Joined: Wed Oct 09, 2013 9:41 am

Re: Error Whoops! Error: Could not open CGI config file

Post by fm2ahmed »

Hi,

I am going crazy now !!!!!!!!!!!!

There is one more error i get when i click on Service Groups Summary.

It appears as though you do not have permission to view information for any of the hosts you requested...
If you believe this is an error, check the HTTP server authentication requirements for accessing this CGI
and check the authorization options in your CGI configuration file.

I assume that its related to the aboce cgi.cfg error.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Error Whoops! Error: Could not open CGI config file

Post by slansing »

Yes, this is attributed to the CGI issues you are having, you will need to change the required paths to point to the correct one of the current CGI.cfg file. Do you have notes on what you changed last time? There are quite a lot of custom paths here.
fm2ahmed
Posts: 32
Joined: Wed Oct 09, 2013 9:41 am

Re: Error Whoops! Error: Could not open CGI config file

Post by fm2ahmed »

Hi,

These are the steps i followed for upgrading from 3.2.3 to 4.0.2 Core.

-->wget http://osdn.dl.sourceforge.net/sourcefo ... 4.x.tar.gz
-->tar xzf nagios-4.x.tar.gz
-->cd nagios-4.x
-->./configure --with-command-group=nagcmd
-->make all
-->make install
--> /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
0 Errors found.
--> Lastly, service nagios reload
All these commands were run being a root user.

Note: Prior to upgrade i had a folder /usr/local/nagios-3.2.3 which had a symlink to nagios.
nagios -> /usr/local/nagios-3.2.3

I changed that to nagios -> /usr/local/nagios-4.0.2 before the upgrade so that the upgrade runs successfully.
Upgrade was successful apart from the error "Error: Could not open CGI config file '/usr/local/nagios-3.2.3/etc/cgi.cfg' for reading!" when you click on Map or Trends

Please help as i need to sort it ASAP.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Error Whoops! Error: Could not open CGI config file

Post by lmiltchev »

Run the following command and show us the output:

Code: Select all

ls -lR /usr/local | grep ^l
Be sure to check out our Knowledgebase for helpful articles and solutions!
fm2ahmed
Posts: 32
Joined: Wed Oct 09, 2013 9:41 am

Re: Error Whoops! Error: Could not open CGI config file

Post by fm2ahmed »

Hi,

This is the output.

lrwxrwxrwx. 1 root root 23 Jan 14 09:22 nagios -> /usr/local/nagios-4.0.2
lrwxrwxrwx. 1 root root 21 Sep 22 2011 nrpe -> /usr/local/nrpe-2.12/

Regards,
Farooq Ahmed
Locked