Page 1 of 2

Hostgroup ??

Posted: Fri May 06, 2016 1:21 pm
by nagiosjam
Hello
I have 3 hosts.
server1, server2 and server3
and I want to create two groups of hosts.
Hostgroup1 members server1, server2 and server3
and Hostgroup2 with members server1 and server2

it's possible?

I created host groups and each group is assigned a group of contacts.

Contactgroup1, hostgroup1 (Server1, server2 and server3)
Y
contactgroup2, hostgroup2 (server1, server2)

When I log on the website of nagios with contact pins 2, only I see the hostgroup2 group, so far so good, but when I log with a contact group of contacts 1, see the two groups, hostgroup1 and hostgroup2 and I just want see the hostgroup1

do not know if I'm doing something wrong or is that not possible

thank you very much

Re: Hostgroup ??

Posted: Fri May 06, 2016 1:52 pm
by bwallace
What you are attempting is certainly possible.
When you say
"...I log with a contact group of contacts 1"
implies there is a misunderstanding between contacts and users, and there is a significant difference between the two. Read this https://assets.nagios.com/downloads/nag ... ntacts.pdf

If you expect a user (not a contact) to login in to the UI and see only the corresponding host group to which they've been assigned to receive notification alerts on - that won't happen. You can configure XI to have varying degrees of permissions for users, but it is not so granular to restrict views to particular hosts, host groups, etc.

Re: Hostgroup ??

Posted: Fri May 06, 2016 6:23 pm
by nagiosjam
i have nagios core, no nagios xI

Re: Hostgroup ??

Posted: Sun May 08, 2016 7:52 pm
by Box293
This guide, while it is for Nagios XI, uses Nagios Core in the backend and hence the concept applies to Core as well.

Have a look at pages 6 and 7
https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Does this help?

Re: Hostgroup ??

Posted: Tue May 10, 2016 7:54 am
by nagiosjam
Hello
If you have not understood me , let me explain again
I have two contact groups, with one group of contacts want to see all the services of a host ( this host has 10 services) and the other contact group want to see only five alerts for the same host
Thank you

Re: Hostgroup ??

Posted: Tue May 10, 2016 10:05 am
by lmiltchev

Code: Select all

When I log on the website of nagios with contact pins 2, only I see the hostgroup2 group, so far so good, but when I log with a contact group of contacts 1, see the two groups, hostgroup1 and hostgroup2 and I just want see the hostgroup1
You added contactgroup1 to both, server1 and server2, which are members of both hostgroups - hostgroup1 and hostgroup2... That's why, when you log in as a contactgroup1 contact, you can see both hostgroups.
I have two contact groups, with one group of contacts want to see all the services of a host ( this host has 10 services) and the other contact group want to see only five alerts for the same host
Are you talking about what services the contacts (members of contactgroup2) can see in the web UI or what notifications they can receive? Can you elaborate? Post some "example" configs.

When you add a contact to a host, this contact will be able to see all services of this host. If you want the contact to see only some of the services, add it directly to the services you want him/her to see.

Re: Hostgroup ??

Posted: Wed May 11, 2016 2:58 am
by nagiosjam
my settings

I have two hostgroups

Code: Select all

define hostgroup{
        hostgroup_name      SERVERS-NAGIOS
        alias                                Servers Nagios
        members                     nagios1,nagios2
        }

define hostgroup{
        hostgroup_name      SERVERS-NAGIOS2
        alias                                 Servidores Nagios
        members                      nagios2
        }
And I have two hosts

Code: Select all

define host{
        use                                   nagios-server
        host_name                   nagios1
        alias                                  Nagios Pre 1
        address                          nagios1
        contact_groups          nagios
}

define host{
        use                                  nagios-server,nagios2-server
        host_name                  nagiospre2
        alias                                 Nagios Pre 2
        address                         nagiospre2
        contact_groups         nagios2

}
Templates:

Nagios-server

Code: Select all

define host{
        name                            nagios-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           120                    
        notification_options            d,u,r                   
        contact_groups                  nagios                
        register                        0                       
        }
Template nagios2-server

Code: Select all

define host{
        name                            nagios2-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           120                    
        notification_options            d,u,r                   
        contact_groups                  nagios2
        register                        0                       
        }
Two contacts groups

Code: Select all

define contactgroup{
        contactgroup_name   	    nagios
        alias                   		    Servers Nagios Contact 
        members                                       user1        }

define contactgroup{
        contactgroup_name       	    nagios2
        alias                                                  Servers Nagios Contact 2
        members                                       user1
        }
And i have these services

Code: Select all

define service{
        use                                                  nagios-service
        host_name                                  nagios1
        service_description                  PING
        check_command                       check_ping!100.0,20%!200.0,40%
        }


define service{
        use			                   nagios-service
        host_name                                   nagios1
        service_description     	  Espacio en discos
        check_command          	 check_diskl!90!95
        }

define service{
        use 		                    nagios-service
        host_name               		    nagios2
        service_description                   PING
        check_command                        check_ping!100.0,20%!200.0,40%
        }


define service{
        use		                                 nagios-service,nagios2-service
        host_name                                 nagios2
        service_description                HTTP
        check_command                     check_http
        }
I have two templates for this service

Code: Select all

define service{
        name                            nagios-service         
        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                  nagios                  
        notification_options            w,u,c,r              
        notification_interval           1220                    
        notification_period             24x7                    
        register                        0                      
        }


define service{
        name                            nagios2-service         
        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                  nagios2                  
        notification_options            w,u,c,r              
        notification_interval           1220                    
        notification_period             24x7                    
        register                        0                      
        }
Hello
what I want is to see all user 1 , the two hosts and all services of each host and the user 2 only see nagios2 group , with nagios2 host and only the HTTP service.

that I have misconfigured , because now with the usuario2 , I see the two groups host ( nagios1 and nagios2 ) , I just want to see group 2 , and I see the two services nagios2 and I just want to see one service.

I hope you understand me and help me , thank you for everything

Re: Hostgroup ??

Posted: Wed May 11, 2016 3:06 am
by nagiosjam
I see this now

Re: Hostgroup ??

Posted: Wed May 11, 2016 3:17 am
by nagiosjam
and I want to see this ... thanks !!!

Re: Hostgroup ??

Posted: Wed May 11, 2016 4:42 pm
by tmcdonald
A few things:

First, I am moving this out of Nagios Ideas since this is a question about Core, not a suggestion.

Second, this is very confusing because you keep changing the names of groups and hosts. In the original posting you had "Hostgroup1" with "server1, server2, and server3" but in your configs you have hostgroups named "SERVERS-NAGIOS" and "SERVERS-NAGIOS" with members named "nagios1" and "nagios2", but there is no "nagios2" host, only "nagios1" and "nagiospre2", but there is a contact group called "nagios2". Please be consistent in your naming and examples so they are easier to follow.

Third, as has been mentioned the solution is to only assign the contacts to the hosts or services which you wish them to view. Currently you have your contacts in a group, and that group is assigned directly to your individual hosts, which means the contacts in those groups can see the associated services.