Page 1 of 3

assign define hosts to specific users

Posted: Mon Dec 12, 2016 8:03 am
by baber
i have 2 group in my organazaation ( server administration) and ( data base administration) now how can i assign some service and some hosts to these groups for example
i have host1 and host2 each of them has 5 service can i say to nagios just user SS can see host1 and specific alarms and just user BB can see host2 with specific service?

Best regards

Re: assign define hosts to specific users

Posted: Mon Dec 12, 2016 11:11 am
by rkennedy
i have 2 group in my organazaation ( server administration) and ( data base administration) now how can i assign some service and some hosts to these groups for example
Just assign the services to a host group rather then a host.
i have host1 and host2 each of them has 5 service can i say to nagios just user SS can see host1 and specific alarms and just user BB can see host2 with specific service?
If the user SS is a contact then yes.

I wrote a document up which helps explain the process for Nagios XI, but it has the text configurations through Core too. It might help explain it to you. (see attached)

Re: assign define hosts to specific users

Posted: Mon Dec 12, 2016 11:22 am
by baber
rkennedy wrote:
i have 2 group in my organazaation ( server administration) and ( data base administration) now how can i assign some service and some hosts to these groups for example
Just assign the services to a host group rather then a host.
i have host1 and host2 each of them has 5 service can i say to nagios just user SS can see host1 and specific alarms and just user BB can see host2 with specific service?
If the user SS is a contact then yes.

I wrote a document up which helps explain the process for Nagios XI, but it has the text configurations through Core too. It might help explain it to you. (see attached)

thanks

but i will create a hostgroup and define services but i want when user TEST1 login to nagios web just see specific services or specific hosts in cgi.cfg file there is no authorized mehod for this user what do i have to do ?

BR

Re: assign define hosts to specific users

Posted: Mon Dec 12, 2016 12:51 pm
by dwhitfield
If I understand you correctly, all the authentication information you need is at https://assets.nagios.com/downloads/nag ... iauth.html

If that does not help, could you explain what you are trying to do in more detail? Thanks!

Re: assign define hosts to specific users

Posted: Mon Dec 12, 2016 2:13 pm
by baber
dwhitfield wrote:If I understand you correctly, all the authentication information you need is at https://assets.nagios.com/downloads/nag ... iauth.html

If that does not help, could you explain what you are trying to do in more detail? Thanks!
i have create other user on nagios with name babak .
now i want when babak login to nagios web interface just see one host with services that i asign to babak

i have added this to

hostgroup.cfg file

Code: Select all

define hostgroup{
        hostgroup_name  babak      ; The name of the hostgroup
        alias                      KB            ; Long name of the group
        }

define servicegroup {
servicegroup_name      babak
alias                             babak Group

  }
and add this host

Code: Select all


define host{
	use		        bab-test				       ; Inherit default values from a template
	host_name	DB-Asisstant				; The name we're giving to this host
	alias		         server DB-Asisstant			; A longer name associated with the host
	address		10.10.10.10			      ; IP address of the host
	}


define service{
	use					             babak-service
	host_name				     DB-Asisstant
	service_description			     Memory Usage
	check_command			     check_nt!MEMUSE!-w 90 -c 95
	servicegroup_name			        babak
	}

define service{
	use					        babak-service
	host_name				DB-Asisstant
	service_description			SqlServer
	check_command				check_nt!SERVICESTATE!-d SHOWALL -l MSSQLSERVER

	}

define service{
	use					        babak-service
	host_name				DB-Asisstant
	service_description			Cpu Usage
	check_command				check_nrpe!alias_cpu
	}

define service{
	use					        babak-service
	host_name				DB-Asisstant
	service_description			Disk Space
	check_command				check_nrpe!alias_volumes
	}

define service{
	use					        babak-service
	host_name				DB-Asisstant
	service_description			Time
	check_command				check_nrpe!check_windows_time
	}


and add these permision to babak in cgi.cfg file

Code: Select all

Authorization to view service status information=babak
Authorization to view host status information=babak


but when login can not see any service or host

what is problem ?

Re: assign define hosts to specific users

Posted: Mon Dec 12, 2016 2:20 pm
by rkennedy
Please see my original comment, you need to add SS as a contact, not just as a name, or wherever you choose.
rkennedy wrote:
i have 2 group in my organazaation ( server administration) and ( data base administration) now how can i assign some service and some hosts to these groups for example
Just assign the services to a host group rather then a host.
i have host1 and host2 each of them has 5 service can i say to nagios just user SS can see host1 and specific alarms and just user BB can see host2 with specific service?
If the user SS is a contact then yes.

Re: assign define hosts to specific users

Posted: Mon Dec 12, 2016 2:28 pm
by baber
rkennedy wrote:Please see my original comment, you need to add SS as a contact, not just as a name, or wherever you choose.
rkennedy wrote:
i have 2 group in my organazaation ( server administration) and ( data base administration) now how can i assign some service and some hosts to these groups for example
Just assign the services to a host group rather then a host.
i have host1 and host2 each of them has 5 service can i say to nagios just user SS can see host1 and specific alarms and just user BB can see host2 with specific service?
If the user SS is a contact then yes.
realy i am confused can you please say where and what do i have to add in which file and where ?

Re: assign define hosts to specific users

Posted: Mon Dec 12, 2016 2:39 pm
by dwhitfield
You need a contact definition: https://assets.nagios.com/downloads/nag ... ml#contact

Your contacts will go in your contacts.cfg. You can see the correct location for that file in your nagios.cfg. On the install I'm looking at right now, it's in /usr/local/nagios/etc/contacts.cfg. Wherever your other configs are, that's likely where contacts.cfg should go.

Please let us know if you have any additional questions.

Re: assign define hosts to specific users

Posted: Mon Dec 12, 2016 3:18 pm
by baber
dwhitfield wrote:You need a contact definition: https://assets.nagios.com/downloads/nag ... ml#contact

Your contacts will go in your contacts.cfg. You can see the correct location for that file in your nagios.cfg. On the install I'm looking at right now, it's in /usr/local/nagios/etc/contacts.cfg. Wherever your other configs are, that's likely where contacts.cfg should go.

Please let us know if you have any additional questions.

i am very confused read document but that is complex please write an example

Re: assign define hosts to specific users

Posted: Mon Dec 12, 2016 3:34 pm
by dwhitfield
For clarity, the anchor tag should have taken you directly to the contact section of the document.

Here is a contact example:

Code: Select all

define contact{
	contact_name	contact_name
	minimum_value	0
	host_notifications_enabled	[0/1]
	service_notifications_enabled	[0/1]
	host_notification_period	timeperiod_name
	service_notification_period	timeperiod_name
	host_notification_options	[d,u,r,f,s,n]
	service_notification_options	[w,u,c,r,f,s,n]
	host_notification_commands	command_name
	service_notification_commands	command_name
}
Please let us know if you need additional examples.

Can you show the output of ls -la /usr/local/nagios/etc?

Also, can you post your nagios.cfg and contacts.cfg?