Page 1 of 1

How to restrict to view a hosts_group by contact_group

Posted: Tue Apr 10, 2018 5:50 am
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!!

Re: How to restrict to view a hosts_group by contact_group

Posted: Wed Apr 11, 2018 4:33 pm
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.

Re: How to restrict to view a hosts_group by contact_group

Posted: Thu Apr 19, 2018 3:51 am
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
}

Re: How to restrict to view a hosts_group by contact_group

Posted: Thu Apr 19, 2018 9:18 pm
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?

Re: How to restrict to view a hosts_group by contact_group

Posted: Fri Apr 20, 2018 1:50 am
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.

Re: How to restrict to view a hosts_group by contact_group

Posted: Fri Apr 20, 2018 3:15 pm
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.

Re: How to restrict to view a hosts_group by contact_group

Posted: Mon Apr 23, 2018 12:07 pm
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.

Re: How to restrict to view a hosts_group by contact_group

Posted: Mon Apr 23, 2018 1:32 pm
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.

Re: How to restrict to view a hosts_group by contact_group

Posted: Tue Apr 24, 2018 1:48 am
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?

Re: How to restrict to view a hosts_group by contact_group

Posted: Tue Apr 24, 2018 2:52 pm
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