assign define hosts to specific users

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.
baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

assign define hosts to specific users

Post 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
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: assign define hosts to specific users

Post 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)
Attachments
Nagios-Automating-with-Nagios-XI.zip
(297.62 KiB) Downloaded 510 times
Former Nagios Employee
baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

Re: assign define hosts to specific users

Post 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
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: assign define hosts to specific users

Post 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!
baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

Re: assign define hosts to specific users

Post 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 ?
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: assign define hosts to specific users

Post 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.
Former Nagios Employee
baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

Re: assign define hosts to specific users

Post 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 ?
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: assign define hosts to specific users

Post 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.
baber
Posts: 308
Joined: Wed Oct 21, 2015 4:39 am

Re: assign define hosts to specific users

Post 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
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: assign define hosts to specific users

Post 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?
Locked