Page 1 of 1

Nagios - One user in multiple contacts groups

Posted: Tue May 11, 2021 4:50 am
by irg21
I have a Nagios Core 4.4.5 and I am triying that one member/user belongs to multiple contactgroups/departments to isolate determinate services to several users.

For example: One user that belongs to Securiry department only see the Hosts of this department and I want that this user belongs also to System department and he will can see the Hosts of System Department.

My nagios is installed in the path /opt/nagios and the contacts groups are in the path /opt/nagios//etc/deparments/:

[root@s503pro01sc2 /opt/nagios/etc/departaments]# ll
total 36
drwxrwxr-x+ 2 sistemas [email protected] 4096 may 5 12:18 Apps
drwxrwxr-x+ 2 sistemas [email protected] 4096 may 5 12:18 BBDD
drwxrwxr-x+ 2 sistemas [email protected] 4096 may 7 15:03 Sys
drwxrwxr-x+ 2 sistemas [email protected] 4096 may 7 15:05 Sec


In each group we have the c_user.cfg where the data of the user is described. Also in the group is the file gc_NameOfDepartment.cfg we put the name of the user. If I do this in two Department's directories I can't reload the nagios service. Only If I have the user in one contact group I can reload nagios with the new configuration...

Do you know the way to have One user in two contacts groups?? Thanks

Re: Nagios - One user in multiple contacts groups

Posted: Fri May 14, 2021 10:06 am
by rhassing
You should not redefine the user. That's not possible.

You should have the user data in separate directory or file and then add this username to the groups you want this user to be in.

Code: Select all

define contact {
	contact_name                   	sec_officer
	alias                          	Security Officer
	host_notifications_enabled     	1
	service_notifications_enabled  	1
	host_notification_period       	24x7
	service_notification_period    	24x7
	host_notification_options      	d,u,r
	service_notification_options   	w,u,c,r
	host_notification_commands     	host-notify-by-email,host-notify-by-sms
	service_notification_commands  	notify-by-email,notify-by-sms
	retain_status_information      	1
	retain_nonstatus_information   	1
	email                          	[email protected]
	pager                          	180123123456
	register                       	1
	}	

Code: Select all

define contactgroup {
	contactgroup_name              	Apps
	alias                          	Apps
	members                        	sec_officer
	register                       	1
}	

define contactgroup {
	contactgroup_name              	BBDD
	alias                          	BBDD
	members                        	sec_officer
	register                       	1
}	

define contactgroup {
	contactgroup_name              	Sys
	alias                          	Sys
	members                        	sec_officer
	register                       	1
}	

Re: Nagios - One user in multiple contacts groups

Posted: Tue May 18, 2021 7:01 am
by irg21
rhassing wrote:You should not redefine the user. That's not possible.

You should have the user data in separate directory or file and then add this username to the groups you want this user to be in.

Code: Select all

define contact {
	contact_name                   	sec_officer
	alias                          	Security Officer
	host_notifications_enabled     	1
	service_notifications_enabled  	1
	host_notification_period       	24x7
	service_notification_period    	24x7
	host_notification_options      	d,u,r
	service_notification_options   	w,u,c,r
	host_notification_commands     	host-notify-by-email,host-notify-by-sms
	service_notification_commands  	notify-by-email,notify-by-sms
	retain_status_information      	1
	retain_nonstatus_information   	1
	email                          	[email protected]
	pager                          	180123123456
	register                       	1
	}	

Code: Select all

define contactgroup {
	contactgroup_name              	Apps
	alias                          	Apps
	members                        	sec_officer
	register                       	1
}	

define contactgroup {
	contactgroup_name              	BBDD
	alias                          	BBDD
	members                        	sec_officer
	register                       	1
}	

define contactgroup {
	contactgroup_name              	Sys
	alias                          	Sys
	members                        	sec_officer
	register                       	1
}	


Yes, it works! I didn't know it works this way... Thanks

Re: Nagios - One user in multiple contacts groups

Posted: Tue May 18, 2021 8:30 am
by scottwilkerson
Locking thread