How to restrict to view a hosts_group by contact_group

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
iam33
Posts: 58
Joined: Mon Mar 18, 2013 5:30 am

How to restrict to view a hosts_group by contact_group

Post by iam33 »

Hi,
thanks in advance!

How can I restrict/deny to view a hosts_group by some contact_group, when a machine its in more than one hosts_group?

Example:

Code: Select all

		HOSTS_GROUP_A --> CONTACT_GROUP_A
			host1
			host2
			host3
			host4

		HOSTS_GROUP_C --> CONTACT_GROUP_A
			host5
			host6

		HOSTS_GROUP_B --> CONTACT_GROUP_B
			host1
			host2

	The users in CONTACT_GROUP_B, could view ALL the hosts in HOSTS_GROUP_A, because the host1 and host2 are in both. I want that the CONTACT_GROUP_B only view HOSTS_GROUP_B.
thanks!!
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: How to restrict to view a hosts_group by contact_group

Post by npolovenko »

@ iam33 , You need to make sure that none of the hosts: host1, host2,host3,host4 have the HOSTS_GROUP_A under "contact_groups". Let me know it works for you.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
iam33
Posts: 58
Joined: Mon Mar 18, 2013 5:30 am

Re: How to restrict to view a hosts_group by contact_group

Post by iam33 »

Hi!

I have upgrade to 4.3.4 from 4.0.7, because I had read th next:
https://support.nagios.com/forum/viewto ... +hostgroup

that finished in a bug solved:
http://tracker.nagios.org/view.php?id=5 ... 1517481886

and now the users in contact group CONTACT_GROUP_B only can view their hosts (HOSTS_GROUP_B) and they can view HOSTS_GROUP_A with only hosts host1 and host2.

So I want that they only can view HOSTS_GROUP_B not HOSTS_GROUP_A although these hosts are in HOSTS_GROUP_B and HOSTS_GROUP_A.

Now I have the configuration like this:

Code: Select all

define hostgroup{
        hostgroup_name   HOSTS_GROUP_A
        alias            Servers HOSTS_GROUP_A
        members          host1,host2,host3,host4
        }
		
define hostgroup{
        hostgroup_name   HOSTS_GROUP_C
        alias            Servers HOSTS_GROUP_C
        members          host5,host6
        }
		
define hostgroup{
        hostgroup_name   HOSTS_GROUP_B
        alias            Servers HOSTS_GROUP_B
        members          host1,host2
        }
		
define host{
        use                     servers,host-pnp
        host_name               host1.domain
        alias                   host1
        contact_groups          CONTACT_GROUP_A,CONTACT_GROUP_B
}
		
define host{
        use                     servers,host-pnp
        host_name               host2.domain
        alias                   host2
        contact_groups          CONTACT_GROUP_A,CONTACT_GROUP_B
}
		
define host{
        use                     servers,host-pnp
        host_name               host3.domain
        alias                   host3
        contact_groups          CONTACT_GROUP_A
}
		
define host{
        use                     servers,host-pnp
        host_name               host4.domain
        alias                   host4
        contact_groups          CONTACT_GROUP_A
}
User avatar
tacolover101
Posts: 432
Joined: Mon Apr 10, 2017 11:55 am

Re: How to restrict to view a hosts_group by contact_group

Post by tacolover101 »

i'd like to help you, but i'm having a hard time understanding what you're looking to do. any chance you could paint a picture for reference?
iam33
Posts: 58
Joined: Mon Mar 18, 2013 5:30 am

Re: How to restrict to view a hosts_group by contact_group

Post by iam33 »

Basically what I need is to put contact_group in the host_group not in the host, so that a person can only see the host_group that corresponds not the rest. I think this time it was in implementation in old versions.

In the following image attached you can see what a user can see now from the hosts_groups, and he should not be able to see the hosts_group "Servidores Gerencia Seguridad Social (SERVIDORES-GSS)", but since the host" apliexpwl1.jcyl.es "is in both groups, you can see these groups.
Attachments
image004.png
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: How to restrict to view a hosts_group by contact_group

Post by npolovenko »

@iam33, I see what you mean. Unfortunately, you can't assign a contact group to a host group. I suggest creating a separate host group for that host check.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
tacolover101
Posts: 432
Joined: Mon Apr 10, 2017 11:55 am

Re: How to restrict to view a hosts_group by contact_group

Post by tacolover101 »

npolovenko wrote:@iam33, I see what you mean. Unfortunately, you can't assign a contact group to a host group. I suggest creating a separate host group for that host check.
you could, however, assign a contact group and host group to a template, and assign that same template to a host.

just a thought.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: How to restrict to view a hosts_group by contact_group

Post by npolovenko »

@tacolover101, I've tried that but didn't quite work for me. Still able to see both host groups.

Code: Select all

define host {
       name                          		host_template
       hostgroups                    		bravo
       contact_groups                		test_contact
       register                    		0

}	

define hostgroup {
	hostgroup_name                		bravo
	alias                         		bravo
	members                       		host1,host2
	}	


	define hostgroup {
	hostgroup_name                		alpha
	alias                         		alpha
	members                       		host1,host3
	}


	define contactgroup {
	contactgroup_name             		test_contact
	alias                         		test_contact
	members                       		nik
	}	
Test contact is still able to see alpha and bravo host groups.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
iam33
Posts: 58
Joined: Mon Mar 18, 2013 5:30 am

Re: How to restrict to view a hosts_group by contact_group

Post by iam33 »

I undestand that, while It´s not posible assign a contact_group clause to an host_group, this is not posible to do it.

I´m thinking this was posible in older versions ....

do you think will be it posible to do in future versions?
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: How to restrict to view a hosts_group by contact_group

Post by npolovenko »

@iam33, I don't think this is on a roadmap... When you grand a user acess to a host he will automatically be able to see all the hostgroups that the host belongs to. You could submit a feature request here if you'd like:
https://github.com/NagiosEnterprises/na ... issues/new
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked