Page 1 of 1

Unable to authorize read only user

Posted: Mon Sep 25, 2017 9:04 am
by AcidTech
Hey everybody,

I try to authorize an user to see only some services/hosts that i choose. I found with Google that i need to enable "authorized_for_read_only" options, and add to the hosts/services that i want, the "contacts" options, but when i log in to the web interface, i see 0 service and host.. :(

that's my config :

cgi.cfg :

Code: Select all

authorized_for_system_information=nagiosadmin,nagios
authorized_for_configuration_information=nagiosadmin
authorized_for_system_commands=nagiosadmin
authorized_for_all_services=nagiosadmin,nagios
authorized_for_all_hosts=nagiosadmin,nagios
authorized_for_all_service_commands=nagiosadmin,nagios
authorized_for_all_host_commands=nagiosadmin,nagios
authorized_for_read_only=logiciel
contact.cfg :

Code: Select all

define contact{
	contact_name			logiciel_agro
	alias				Logiciel_Agro
	service_notification_period	workhours
	host_notifications_enabled	0
	host_notification_period	workhours
        service_notification_options    w,u,c,r
        host_notification_options       d,r
        service_notification_commands   notify-service-by-email
        host_notification_commands      notify-host-by-email
        email                           ******@******.com
        }

define contactgroup{
	contactgroup_name	logiciel
	alias			Logiciel Agro
	members			logiciel_agro
	}
A service definition :

Code: Select all

# Taille base SQL
define service {
	use generic-service
	host_name server1,server2,server3
	service_description Base_SQL
	check_command check_sql
	check_interval 60
	contacts logiciel_agro,support_agro
	contact_groups logiciel
}
Someone can help me ? Thx :)

Re: Unable to authorize read only user

Posted: Mon Sep 25, 2017 11:20 am
by scottwilkerson
After you add the contact to the service like you did you need to restart the nagios service

Code: Select all

service nagios restart
Also, I noticed on what you posted, this

Code: Select all

authorized_for_read_only=logiciel
should be this

Code: Select all

authorized_for_read_only=logiciel_agro

Re: Unable to authorize read only user

Posted: Tue Sep 26, 2017 1:43 am
by AcidTech
Thank you for the fast reply, i found my mistake :D

I create an account in htpasswd named "logiciel", and my contact name in nagios were "logiciel_agro", so it can't work.. I changed my contact name and contact groups, and now it's work 8-)

Re: Unable to authorize read only user

Posted: Tue Sep 26, 2017 9:06 am
by kyang
We are glad to hear you found the mistake!

May we close this thread?

Re: Unable to authorize read only user

Posted: Tue Sep 26, 2017 9:18 am
by scottwilkerson
Great, glad it is resolved.