Nagios - One user in multiple contacts groups

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.
Locked
irg21
Posts: 2
Joined: Tue May 11, 2021 2:41 am

Nagios - One user in multiple contacts groups

Post 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 nagios@admin.consejeria.jda 4096 may 5 12:18 Apps
drwxrwxr-x+ 2 sistemas nagios@admin.consejeria.jda 4096 may 5 12:18 BBDD
drwxrwxr-x+ 2 sistemas nagios@admin.consejeria.jda 4096 may 7 15:03 Sys
drwxrwxr-x+ 2 sistemas nagios@admin.consejeria.jda 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
User avatar
rhassing
Posts: 412
Joined: Sat Oct 05, 2013 10:29 pm
Location: Netherlands

Re: Nagios - One user in multiple contacts groups

Post 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                          	security@company.com
	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
}	
Rob Hassing
Image
irg21
Posts: 2
Joined: Tue May 11, 2021 2:41 am

Re: Nagios - One user in multiple contacts groups

Post 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                          	security@company.com
	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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios - One user in multiple contacts groups

Post by scottwilkerson »

Locking thread
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked