How to dedicate hostgroup to user in Nagios core

nagios

I want to create some user accounts, each user has its own hostgroup. When they login to their account, they can only view and manage the hosts in their group. How do I do this? Is there a tool to easily mange? I am new to Nagios. Thank you.

Best Answer

define a contact

define contact{
    contact_name                    somedude
    alias                           somedude
    service_notification_period     24x7
    host_notification_period        24x7
    service_notification_options    w,u,c,r
    host_notification_options       d,r
    service_notification_commands   notify-service-by-email
    host_notification_commands      notify-host-by-email
    email                           somedude@example.org
}

define a group containing the contact

define contactgroup {
    contactgroup_name       somegroup
    members                 somedude
}

when you define a host, include the contact_group

define host {
    host_name       someserver.example.org
    contact_groups  somegroup
    address         1.2.3.4
    use             generic-host
    notifications_enabled           1
}

create a password for this user:

htpasswd /etc/nagios3/htpasswd.users somedude

(/etc/nagios3 might not be the right directory depending on your install)