Error: Hostgroup has already been defined


Hey All,

I’m trying to solve a problem that’s not making much sense to me…

This is on Nagios 2.5 and 2.7.

Nagios is complaining that a hostgroup is already defined, but I don’t see how since the name its complaining about only exists in one file…

It’s telling me this,

Error: Hostgroup ‘dev-www’ has already been defined
Error: Could not register hostgroup (config file
’/etc/nagios/lab-configs/development/dev-www.cfg’, starting on line 1)

But, I don’t see how that is possible…

[root@server nagios]# fgrep -R dev-www *
lab-configs/development/dev-www.cfg: hostgroup_name dev-www

As you can see a recursive search is only finding one existence of dev-www name
in my configs. If I remove it, it complains about another group definition.

I have no idea where to start with this problem…

My config looks like this…

define hostgroup{
hostgroup_name dev-www
alias Development Webservers

With a host config like this…

define host{
use lab-host
alias Development Server

There’s a host file above the development directory with these settings…

define host{
name lab-host
check_command check-host-alive
contact_groups admins
notifications_enabled 1
event_handler_enabled 1
flap_detection_enabled 1
failure_prediction_enabled 1
process_perf_data 0
retain_status_information 1
retain_nonstatus_information 1
max_check_attempts 5
check_period 24x7
notification_interval 30
notification_period 24x7
notification_options d,u,r
register 0

I really need to get this working and I really don’t want to redo all the configs again. They are also based on working configs I have done, which I don’t get why they are not working now.

Any ideas?



I got it, configs were built against Nagios 2.0, in 2.5 and 2.7 cfg_dir is recursive and causing problems.

I just set the top dirs, like…


Instead of the previous method of setting all directories…


And it is ok…