Page 1 of 1

Nagios SubInstances

Posted: Mon Jun 16, 2014 4:15 am
by tariqondego
Is it possible to have subsets of nagios running on different machines?

I have a customer who wants to see what I am seeing from the main nagios server, but only for the machines that belong to them.

Please advise.

Re: Nagios SubInstances

Posted: Mon Jun 16, 2014 6:25 am
by Stuart Watts
If you create a web user (set up a username/password in the htpasswd file), and you make that username match the contact name you use to send alerts, then that user will only be able to see the hosts and services they will receive alerts for. See this doc for more info.

Re: Nagios SubInstances

Posted: Mon Jun 16, 2014 7:41 am
by tariqondego
I have created user called test:
define contact{
contact_name test
alias test test
email [email protected]
use testtemplate

}

Added this user as contact on computer1:

define host{
use hosts_template1
host_name computer1
alias comp1
address 132.160.1.0
contacts test
}

Added authentication for test:
htpasswd /usr/local/nagios/etc/htpasswd.users test

Enable authentication is set to default:
use_authentication = 1

Restarted Nagios.

But still when I acces NAgios from web interface using test,I see all hosts rather than seeing computer1 only.

Please advise.

Re: Nagios SubInstances

Posted: Mon Jun 16, 2014 7:45 am
by Stuart Watts
Check for inheritance - do you have any "contactgroups" defined in either your base host or service templates? Is that test user a member of any contact groups?

Re: Nagios SubInstances

Posted: Mon Jun 16, 2014 8:01 am
by tariqondego
No,I just created the user test independently for this purpose.

Re: Nagios SubInstances

Posted: Mon Jun 16, 2014 11:40 am
by sreinhardt
Did you add this user to cgi.cfg at all? Actually if you could post that file please.

Re: Nagios SubInstances

Posted: Wed Jun 18, 2014 1:15 am
by tariqondego
Not sure under which section to add this user in cgi.cfg
Please advise.
See attched.

Re: Nagios SubInstances

Posted: Wed Jun 18, 2014 11:51 am
by slansing
Yep, you will essentially want to make them "read only," and then attach their contact to the hosts you wish them to view, the following are explanations of the different authorization levels directly from the cgi.cfg:

Code: Select all

# SYSTEM/PROCESS INFORMATION ACCESS
# This option is a comma-delimited list of all usernames that
# have access to viewing the Nagios process information as
# provided by the Extended Information CGI (extinfo.cgi).  By
# default, *no one* has access to this unless you choose to
# not use authorization.  You may use an asterisk (*) to
# authorize any user who has authenticated to the web server.

authorized_for_system_information=paynet



# CONFIGURATION INFORMATION ACCESS
# This option is a comma-delimited list of all usernames that
# can view ALL configuration information (hosts, commands, etc).
# By default, users can only view configuration information
# for the hosts and services they are contacts for. You may use
# an asterisk (*) to authorize any user who has authenticated
# to the web server.

authorized_for_configuration_information=paynet



# SYSTEM/PROCESS COMMAND ACCESS
# This option is a comma-delimited list of all usernames that
# can issue shutdown and restart commands to Nagios via the
# command CGI (cmd.cgi).  Users in this list can also change
# the program mode to active or standby. By default, *no one*
# has access to this unless you choose to not use authorization.
# You may use an asterisk (*) to authorize any user who has
# authenticated to the web server.

authorized_for_system_commands=paynet



# GLOBAL HOST/SERVICE VIEW ACCESS
# These two options are comma-delimited lists of all usernames that
# can view information for all hosts and services that are being
# monitored.  By default, users can only view information
# for hosts or services that they are contacts for (unless you
# you choose to not use authorization). You may use an asterisk (*)
# to authorize any user who has authenticated to the web server.


authorized_for_all_services=paynet
authorized_for_all_hosts=paynet



# GLOBAL HOST/SERVICE COMMAND ACCESS
# These two options are comma-delimited lists of all usernames that
# can issue host or service related commands via the command
# CGI (cmd.cgi) for all hosts and services that are being monitored. 
# By default, users can only issue commands for hosts or services 
# that they are contacts for (unless you you choose to not use 
# authorization).  You may use an asterisk (*) to authorize any
# user who has authenticated to the web server.

authorized_for_all_service_commands=paynet
authorized_for_all_host_commands=paynet



# READ-ONLY USERS
# A comma-delimited list of usernames that have read-only rights in
# the CGIs.  This will block any service or host commands normally shown
# on the extinfo CGI pages.  It will also block comments from being shown
# to read-only users.

#authorized_for_read_only=user1,user2

Once you have made your changes and saved the file, restart nagios.

Re: Nagios SubInstances

Posted: Thu Jun 19, 2014 3:20 am
by tariqondego
Thanks alot,it worked.

Re: Nagios SubInstances

Posted: Thu Jun 19, 2014 9:10 am
by tmcdonald
Good to hear! I'll be closing this thread now, but feel free to open another if you need anything in the future!