[solved] Displaying host (hostgroup) to specific user only

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
bsfez
Posts: 23
Joined: Tue May 08, 2012 8:41 am

[solved] Displaying host (hostgroup) to specific user only

Post by bsfez »

Hello,

I'm monitoring 4 servers + localhost.
I have set hostgroup, i have set contact_groups and contacts. How do i marry all that together ?

Meaning; i want to set several user so each user can see only one server or one host_group but not the data collected or the notification about others.

Bernard
Last edited by bsfez on Sat Jun 09, 2012 2:24 am, edited 1 time in total.
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: Displaying host (hostgroup) to specific user only

Post by jsmurphy »

I'll try to keep this as brief and not write war and peace.

When a user login matches a contact definition, nagios will restrict that user to a world view of only those hosts and services to which that contact has been assigned.

First step is to create contacts that match the login user names of your users (I like to make a logical distinction between a real contact and a view-user... a contact has an email/SMS/etc address where as a view user is just a dummy to match a user login), assign these view-users to contact groups based on "Should all these users be able to see the same thing".

From here whenever you assign a contact_group to a host or service, you assign both a real contact-group and a view-users group... this creates a separation of church and state between user access control and your actual alerting. It also gives you the flexibility to give multiple teams the ability to view a single service/host, but only alert one team about it.

This is my personal preferred approach, but there's some really powerful stuff you can do here depending on how you approach it. I think this should meet your needs.
bsfez
Posts: 23
Joined: Tue May 08, 2012 8:41 am

Re: Displaying host (hostgroup) to specific user only

Post by bsfez »

Hi jsmurphy,

Thanks for you help i have rethink, and now it is working.
This is what i have done it.

1/ I create the user/contact in /etc/nagios3/conf.d/contacts_nagios2.cfg

Code: Select all

define contact{
        contact_name                    fony
        alias                           Mister fony
        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                           [email protected]
        }
2/ I create a contactgroup

Code: Select all

define contactgroup{
        contactgroup_name       fonygroup
        alias                   Fony Group Team
        members                 fony
        } 
3/ Create a template host: duplicated "generic-host_nagios2.cfg" and change namefile (fony-host_nagios2.cfg) and change name to fony

4/ create a new nagios user "htpasswd /etc/nagios3/htpasswd.users fony" to complete authentication.

To have user with only view capability i added those lines under contact definition

host_notifications_enabled 0
can_submit_commands 0

It display the command options, there are just not enable. Not very elegant, but work fine.

Thanks again, hopes this will help another user.
Bernard
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: [solved] Displaying host (hostgroup) to specific user on

Post by jsmurphy »

Glad you found a solution :)
alihyder_cse
Posts: 1
Joined: Wed Aug 21, 2013 7:23 am

Re: [solved] Displaying host (hostgroup) to specific user on

Post by alihyder_cse »

hi sir,

as per your bellow instruction i successfully configured & assigned to a user for monitoring a specific host but when this user click to other options (host group, summary and grid) it shows all "host-group" which are created before. plz see the attachment.

you are requested to provide me step by step instruction how i can restrict to the specific user who can not view any other options/groups and tell me step by step how i can assign to this user to view only specific host-group as like as host. it may be mentioned here that, i m new in nagios and i m using v.3.4.1

waiting for your quick response.

Alihyder
Attachments
hostgroup-summary-grid.jpg
Locked