Page 1 of 1

Restricting a webuser to view specific host and their servic

Posted: Sat Nov 08, 2014 6:53 am
by diwakar0304
Hello,

I need help to configure solution to integrate a web front end user to monitor specific host and their services.
For eg : -
User 1 can view/monitor/alter host 1,2 and services related to host 1,2. Not able to view/monitor/alter host 3,4 and services related to host 3,4.
User 2 can view/monitor/alter host 3,4 and services related to host 3,4. Not able to view/monitor/alter host 1,2 and services related to host 1,2.
Admin user (nagiosadmin) can view all the host and their services.

My current setup is built with following source codes
Nagios-core 4.0.8
nagios plugin 2.0.3
nrpe 2.12
Theme vautour_style
pnp4nagios-0.6.24

I hope that i have elaborate the requirement in easy way to understand.
It will be very helpful if there any documentation or guidance to fulfill the requirement .

BR//
Diwakar

Re: Restricting a webuser to view specific host and their se

Posted: Mon Nov 10, 2014 5:40 am
by Box293
This document is for Nagios XI multi tenancy however I'm pretty sure the same concepts applies for Nagios Core.

http://assets.nagios.com/downloads/nagi ... ios-XI.pdf

Re: Restricting a webuser to view specific host and their se

Posted: Tue Nov 11, 2014 1:30 am
by diwakar0304
Hello,

Thanks Box293 for your inputs.

I have added new user "abc" in htpasswd.users
=============================================
Then updated new contact in contacts.cfg :

define contact {
contact_name abc
alias abc Team
host_notification_options d,u,r,f,n
service_notification_options w,u,c,r,f,n
email [email protected]
host_notification_period 24x7
service_notification_period 24x7
host_notification_commands notify-host-by-email
service_notification_commands notify-service-by-email
}

=============================================
Updated new contact group :

define contactgroup {
contactgroup_name abc group
alias abc Team
members abc
}

=============================================
In Hosts.cfg changed "contact_groups". Same also updated in services.cfg too.

define host {
host_name hostname
alias portal server
address xxx.xxx.xxx.xxx
check_command check-host-alive
notification_interval 15
notification_options d,u,r
max_check_attempts 3
active_checks_enabled 1
passive_checks_enabled 0
notifications_enabled 1
check_period 24x7
notification_period 24x7
contact_groups abc group
use Default_monitor_server,Default_timeperiod_interval_10,Default_timeperiod_interval_5,host-pnp
icon_image_alt Sun Solaris
icon_image sunlogo.gif
statusmap_image sunlogo.gd2

}

=============================================

cgi.fg : removed # and updated to below line.

authorized_for_read_only=abc

==============================================

Like this I have added 3 user to access Nagios frontend to access their specific hosts in read only mode.


Any thing else need to be done here ???

BR//
Diwakar

Re: Restricting a webuser to view specific host and their se

Posted: Tue Nov 11, 2014 1:38 am
by Box293
Is it working as expected? Do they only see what they are supposed to?

Re: Restricting a webuser to view specific host and their se

Posted: Wed Nov 12, 2014 3:24 am
by diwakar0304
Yes, it is working for read only mode.
How to give permission to a particular user to use external command interface for their specific host. Is changes require in cgi.cfg only for the same???

Re: Restricting a webuser to view specific host and their se

Posted: Wed Nov 12, 2014 5:27 pm
by slansing
If you are interested in CGI user control options, I'd take a look at:

http://nagios.sourceforge.net/docs/3_0/configcgi.html

Re: Restricting a webuser to view specific host and their se

Posted: Sat Nov 15, 2014 1:51 am
by diwakar0304
Thanks, this works. You can lock the thread.

Re: Restricting a webuser to view specific host and their se

Posted: Mon Nov 17, 2014 12:32 pm
by abrist
Locked :)