Nagios SubInstances

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
tariqondego
Posts: 85
Joined: Fri Mar 28, 2014 6:18 am

Nagios SubInstances

Post 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.
Stuart Watts
Posts: 40
Joined: Wed Sep 25, 2013 7:01 am

Re: Nagios SubInstances

Post 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.
tariqondego
Posts: 85
Joined: Fri Mar 28, 2014 6:18 am

Re: Nagios SubInstances

Post by tariqondego »

I have created user called test:
define contact{
contact_name test
alias test test
email test@mydomain.co.ke
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.
Stuart Watts
Posts: 40
Joined: Wed Sep 25, 2013 7:01 am

Re: Nagios SubInstances

Post 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?
tariqondego
Posts: 85
Joined: Fri Mar 28, 2014 6:18 am

Re: Nagios SubInstances

Post by tariqondego »

No,I just created the user test independently for this purpose.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Nagios SubInstances

Post by sreinhardt »

Did you add this user to cgi.cfg at all? Actually if you could post that file please.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
tariqondego
Posts: 85
Joined: Fri Mar 28, 2014 6:18 am

Re: Nagios SubInstances

Post by tariqondego »

Not sure under which section to add this user in cgi.cfg
Please advise.
See attched.
Attachments
cfg.zip
(4.14 KiB) Downloaded 117 times
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: Nagios SubInstances

Post 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.
tariqondego
Posts: 85
Joined: Fri Mar 28, 2014 6:18 am

Re: Nagios SubInstances

Post by tariqondego »

Thanks alot,it worked.
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: Nagios SubInstances

Post 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!
Former Nagios employee
Locked