How to allow a user in Nagios to view the status of some servers, but not disable/enable anything?

How to allow a user in Nagios to view the status of some servers, but not disable/enable anything?


Solution 1:

In /usr/local/nagios/etc/cgi.cfg (or wherever it lives on your system) define the read-only users:

# A comma-delimited list of usernames that have read-only rights in
# the CGIs.  This will block any service or host commands normally shown
# on the extinfo CGI pages.  It will also block comments from being shown
# to read-only users.

authorized_for_read_only=viewer

Of course, viewer must be first defined as contact with an appropriate htpasswd authentication. In the service/host detail page, the right hand side where you usually have commands will say:

Your account does not have permissions to execute commands.

Solution 2:

If I understand your question correctly you would like to add users to nagios that can only see some of the servers and have no authority to do any of the administration tasks ( Start / Stop monitoring or alerting ).

To accomplish this you will need to add a user to the .htpasswd file for nagios and then create a contact in nagios with the contact_name matching the username set in .htpasswd and then add that contact only to the hosts which you want them to see. Remember that when you add things to the host configuration that are also defined in the template that it overrides the template instead of adding to it so you will need to also add back any contacts that host already has in the template.