13

I follow simple steps from guides all over the web:

a) add an user to Nagios via command htpasswd htpasswd.users username

b) in cgi.cfg file add this user to lines:

authorized_for_system_information=nagiosadmin, username
authorized_for_configuration_information=nagiosadmin, username
authorized_for_system_commands=nagiosadmin, username
authorized_for_all_services=nagiosadmin, username
authorized_for_all_hosts=nagiosadmin, username
authorized_for_all_service_commands=nagiosadmin, username
authorized_for_all_host_commands=nagiosadmin, username

c) restart nagios3 service, even restart apache2 service

but when I try to list anything from nagios web interface it still gives me this annoying message:

It appears as though you do not have permission to view information for any of the services 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.

Where could be a problem please?

1
  • 1
    Just for amusement value, can you take the spaces out of the authorized_for lines, eg, authorized_for_all_hosts=nagiosadmin,username. I doubt that's the issue, but all my working NAGIOS configs are space-free.
    – MadHatter
    Apr 26, 2013 at 12:32

6 Answers 6

10

Check out the Nagios FAQ at No permission to view configuration, which says:

Description: If you click on "View Config" and you get: """It appears as though you do not have permission to view the configuration information 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."""

Solution: You need to set "authorized_for_configuration_information" in cgi.cfg

By default on my EL6 system, 'authorized_for_configuration_information' is set to be 'nagiosadmin'. Many sites set this to be authorized_for_configuration_information=*, which fixes your issue.

Also, make sure you are using HTTP authentication correctly. See http://nagios.sourceforge.net/docs/3_0/cgiauth.html

Enabling Authentication/Authorization Functionality In The CGIs

The next thing you need to do is make sure that the CGIs are configured to use the authentication and authorization functionality in determining what information and/or commands users have access to. This is done be setting the use_authentication variable in the CGI configuration file to a non-zero value. Example:

use_authentication=1

5

edit /usr/local/nagios/etc/cgi.cfg

add username , without any space like this

authorized_for_system_information=nagiosadmin,username,username2

save file and restart nagios service using service nagios restart

1
  • Thanks for the tip. also important that no spaces after the commas, that caught me out Jan 23, 2020 at 4:05
3
  1. In terminal:

    sudo htpasswd -c /etc/nagios/htpasswd.users new_user
        # set password for user "new_user"
    
  2. In terminal:

    nano /usr/local/nagios/etc/cgi.cfg
    

    (in cgi.cfg file, look for this section):

    # GLOBAL HOST/SERVICE VIEW ACCESS
    # These two options are comma-delimited lists of all usernames that
    # can view information for all hosts and services that are being
    # monitored.  By default, users can only view information
    # for hosts or services that they are contacts for (unless you
    # you choose to not use authorization). You may use an asterisk (*)
    # to authorize any user who has authenticated to the web server.
    

    (at the end of the line, add the user "new_user"):

    authorized_for_all_services=nagiosadmin,new_user
    authorized_for_all_hosts=nagiosadmin,new_user
    

    (save and exit nano)

  3. Restart nagios service:

    sudo systemctl restart nagios.service
    

Now you can access the web page with "new_user" and monitor all objects.

1

make sure below line in cgi.cfg in nagios folder

authorized_for_all_services=nagiosadmin,noc authorized_for_all_hosts=nagiosadmin,noc

0

I have also faced the same issue and I solved running command

sudo htpasswd -b -c /usr/local/nagios/etc/htpasswd.users nagiosadmin nagiosadmin
0

My issue on a fresh install migrating a configuration from an older box today was that I hadn't copied my authentication configuration in httpd's nagios config.

I use LDAP for authentication and authorization, but I had configured the various auth directives at the top-level of the server and expected them to be inherited by subdirectories, etc.

The symptom was (other than "you can't read this configuration") that Nagios said I was Logged in as ? (with a literal ?).

Copying the authentication and authorization setup into the <Directory> sections for Nagios got it all fixed-up for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .