Hostgroup ??

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.
nagiosjam
Posts: 81
Joined: Thu Feb 04, 2016 2:47 am

Re: Hostgroup ??

Post by nagiosjam »

The first apology if I have not explained very well. I do not speak English at all well , sorry,

Ok thanks, I understand , but I have a problem.

I understand that if I want to see a service, we will add that I have to contact the service group and the service I do not want to see , do not add the group. So far so good , the problem is that the definition of host , I say that host group want to belong and I have you to say that contact group want , here's the problem , I put my contact group and me aLL inherits permissions services and eventually see all services. Not to do , because if the definition of host not add contact group in Nagios frontend , I do not see that group of host

How do I see the host group and me not inherit all permissions to all its services ?

Not if I have explained well and you have understood me .. thank you very much
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Hostgroup ??

Post by tmcdonald »

I think I understand better. Take a look at the Implied Inheritance rules:

https://assets.nagios.com/downloads/nag ... nheritance

Basically, if you assign a contact_group to a host, and there is no contact or contact_group entry on a service that is attached to that host, then the attached service will inherit the contact_group from the host. Does that make sense? So in this case you will need to define a contact_group on the service that includes only the contacts you want to view them, and use a separate contact_group for the host.
Former Nagios employee
nagiosjam
Posts: 81
Joined: Thu Feb 04, 2016 2:47 am

Re: Hostgroup ??

Post by nagiosjam »

Hi.
I tried what you tell me tmcdonald and it does not work .
If I create a new contact group and assign this group to a service and the other contact group to host, continuous watching all the services of this host and I just want to see some , if I delete the contact group of the host , I keep seeing in the nagios frontend that host and the host group belonging , forcing me to take the definition of host a contact or contact group. I can not find the solution :-(
Anyway, thanks for the help
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Hostgroup ??

Post by tmcdonald »

I'm sorry, I don't quite understand what you are saying. I am certain this is a language barrier issue, and I want to help out. Can you post the actual configurations you are using?
Former Nagios employee
nagiosjam
Posts: 81
Joined: Thu Feb 04, 2016 2:47 am

Re: Hostgroup ??

Post by nagiosjam »

Hello

I start from scratch and explain everything and see as I have it configured , what I see with my setup and what you want to see . I hope you now understand

Image

Image

This is my setup

Code: Select all

define contactgroup{
        contactgroup_name 	      CONTACTGROUP1
        alias                   		      Contact Group 1
        members                                         contact1


define contactgroup{
        contactgroup_name 	      CONTACTGROUP2
        alias                   		      Contact Group 2
        members                                         contact2


define contact{
        contact_name  	                contac1
        alias                           		Contact 1
        service_notification_period     24x7                    
        host_notification_period          24x7
        service_notification_options    w,u,c,f,s              
        host_notification_options       d,u,f,s               
        email                          		 [email protected]
        }


define contact{
        contact_name  	                contac2
        alias                           		Contact2
        service_notification_period     24x7                    
        host_notification_period          24x7
        service_notification_options    w,u,c,f,s              
        host_notification_options       d,u,f,s               
        email                          		 [email protected]
        }



define hostgroup{
        hostgroup_name          HOSTGROUP1
        alias                                     Host Group 1
       }


define host{
        use                    	      template1-server,template2-server
        host_name       	      HOST1
        alias                                    Host 1
        contact_groups             CONTACTGROUP1, CONTACTGROUP2
        hostgroups                      HOSTGROUP1
}



define host{
        use                    	      template1-server,template2-server
        host_name       	      HOST2
        alias                                    Host 2
        contact_groups             CONTACTGROUP1, CONTACTGROUP2
        hostgroups                      HOSTGROUP1
}


define host{
        use                    	      template1-server
        host_name       	      host3
        alias                                    Host 3
        contact_groups             CONTACTGROUP1
        hostgroups                      HOSTGROUP1    
}



define host{
        name                                           template1-server
        use                                               generic-host            
        check_period                          24x7                    
        check_interval                        5                       
        retry_interval                         1                       
        max_check_attempts         10                      
        event_handler_enabled    1
        check_command                   check-host-alive        
        notification_period               24x7                    
        notification_interval            100                     
        notification_options            d,u,r                   
        contact_groups                     CONTACTGROUP1           
        register                                     0                       
        }


define host{
        name                                           template2-server
        use                                               generic-host            
        check_period                          24x7                    
        check_interval                        5                       
        retry_interval                         1                       
        max_check_attempts         10                      
        event_handler_enabled    1
        check_command                   check-host-alive        
        notification_period               24x7                    
        notification_interval            100                     
        notification_options            d,u,r                   
        contact_groups                     CONTACTGROUP2
        register                                     0                       
        }



SERVICE HOST1

define service{
        use                	     group1service,group2service
        host_name                     HOST1
        service_description     Service 1
        contact_groups             CONTACTGROUP1,CONTACTGROUP2
        check_command         check_service1
        }

define service{
        use                	     group1service
        host_name                     HOST1
        service_description     Service 2
        contact_groups             CONTACTGROUP1
        check_command         check_service2
        }

SERVICE HOST2

define service{
        use                	     group1service
        host_name                     HOST2
        service_description     Service 3
        contact_groups             CONTACTGROUP1
        check_command         check_service3
        }

define service{
        use                	     group1service,group2service
        host_name                     HOST2
        service_description     Service 4
        contact_groups             CONTACTGROUP1,CONTACTGROUP2
        check_command         check_service4
        }


SERVICE HOST3

define service{
        use                	     group1service
        host_name                     HOST3
        service_description     Service 5
        contact_groups             CONTACTGROUP1
        check_command         check_service5
        }


Templates:

define service{
        name                         		   group1service
        active_checks_enabled           1                       
        passive_checks_enabled        1                       
        parallelize_check                        1                        
        obsess_over_service               1                       
        check_freshness                       0                        
        notifications_enabled             1                       
        event_handler_enabled        1                       
        flap_detection_enabled        1                       
        process_perf_data                  1                       
        retain_status_information       1                       
        retain_nonstatus_information    1                       
        is_volatile                                              0                       
        check_period                              24x7                      
        max_check_attempts              3                      
        normal_check_interval           10                      
        retry_check_interval               2                       
        contact_groups                        CONTACTGROUP1                  
        notification_options               w,u,c,r                 
        notification_interval             100                    
        notification_period               24x7                    
        register                                        0                       
        }

define service{
        name                         		   group2service
        active_checks_enabled           1                       
        passive_checks_enabled        1                       
        parallelize_check                        1                        
        obsess_over_service               1                       
        check_freshness                       0                        
        notifications_enabled             1                       
        event_handler_enabled        1                       
        flap_detection_enabled        1                       
        process_perf_data                  1                       
        retain_status_information       1                       
        retain_nonstatus_information    1                       
        is_volatile                                              0                       
        check_period                              24x7                      
        max_check_attempts              3                      
        normal_check_interval           10                      
        retry_check_interval               2                       
        contact_groups                        CONTACTGROUP2
        notification_options               w,u,c,r                 
        notification_interval             100                    
        notification_period               24x7                    
        register                                        0                       
        }
Last edited by tmcdonald on Tue May 17, 2016 9:33 am, edited 1 time in total.
Reason: Please use [code][/code] tags around long output
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Hostgroup ??

Post by ssax »

If you assign the contactgroups to the host they automatically can see ALL services attached to the host.

So in order for you to have contactgroup2 to only see HOST1 - SERVICE1 and HOST2 - SERVICE4 would be to REMOVE contactgroup2 from HOST1 and HOST2 and add/keep contactgroup2 on SERVICE1 and SERVICE4 (at the service level):
- Note: They will not be able to see the status of the host then, there is no way around this, that's the way Nagios permissions are.
nagiosjam
Posts: 81
Joined: Thu Feb 04, 2016 2:47 am

Re: Hostgroup ??

Post by nagiosjam »

That is the solution .had already proven but not seen as the host , I thought I was doing things wrong , but if so are nagios permits , it will configure as well .
thank you very much to all for the help
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Hostgroup ??

Post by tmcdonald »

If everything is working correctly now, can we close the thread?
Former Nagios employee
nagiosjam
Posts: 81
Joined: Thu Feb 04, 2016 2:47 am

Re: Hostgroup ??

Post by nagiosjam »

if it is solved , you can close it.
thank you very much
Locked