I’m having trouble defining a service for hosts in a hostgroup using v1.2. It appears that if there’s more than one host in the hostgroup it complains of duplicate host descriptions. Has anyone seen this before and am I doing something silly?
srv-ftp01# …/bin/nagios -v nagios.cfg
–snip–
Reading configuration data…
Error: Service ‘rtr-cor01.sta-bgp’ on host ‘rtr-lrm05.sta’ has already been defined
Error: Could not register service (config file ‘/usr/local/nagios/etc/services.cfg’, line 44)
–snip–
define hostgroup{
hostgroup_name hk_lrm_routers
alias Hong Kong Low Rate Modem Routers
members rtr-lrm01.sta, rtr-lrm02.sta, rtr-lrm03.sta, rtr-lrm04.sta, rtr-lrm05.sta
contact_groups all
}
That is not a workaround, that is how you are suppose to configure hosts/services.
I have fping defined for each and every host on our network. So I have lets say 100 hosts in the same hostgroup, all with fping as there service check and that is how it’s supposed to work.
Now, I think I know what you are attempting to do. You want to define a service check for a hostgroup, and not for each and every host. If that is true, show me the directive from the instructions/doc’s that allows this. Save yourself the trouble. There IS NO directive in the hostsgroups.cfg file that allows this.
All Hosts In Multiple Hostgroups: If you want to create identical services that are assigned to all hosts in one or more hostgroups, you can do so by creating a single service definition. How? The hostgroup_name directive allows you to specify the name of one or more hostgroups that the service should be created for:
define service{
hostgroup_name HOSTGROUP1,HOSTGROUP2,...,HOSTGROUPN
service_description SOMESERVICE
other service directives ...
}
Anyway, it doesn’t seem to work for me, whether I put in a single or multiple hostgroups.
Now, I think I know what you are attempting to do. You want to define a service check for a hostgroup, and not for each and every host.[/quote]
Yes that’s exactly what I’m trying to do.
By the way, thanks for your assistance so far. I’ve been configuring it for two weeks and got it talking nicely to our broadcast video multiplexors and receivers and it’s looking far better that the rather expensive prorprietary stuff we’ve got in place already!
Whew, I haven’t seen that page in ages and thank you for pointing it out.
I’m gonna try it out right now, since I’ve never ever used that trick.
I’ll let you know how it goes.
in services.cfg I defined:
define service{
use generic-service
hostgroup_name Bus-Switches
service_description testing
check_command check_ping!200.0,20%!500.0,60%
contact_groups Bus-Switches
Hostgroup Bus_switches is composed of about 5 hosts.
Restarted nagios and each and every host in hostgroup Bus_switches has a new service called “testing” which is simply a check_ping check.
I have no idea then why yours is not working, except that you already have a service check with the same definition per the error you stated. Error: Service ‘rtr-cor01.sta-bgp’ on host ‘rtr-lrm05.sta’ has already been defined"
Yes I am using v1.2
If you run nagios using the -v to check your configs, you will find that you have defined a service check more than once. You might have defined it once as a normal ping check for one host and then again, as I did above, as another check for that host, but using the hostgroup_name directive. Edited Sat Oct 01 2005, 05:00AM ]