Could not expand hostgroups error
Chris Weiss
chris.weiss at gmail.com
Wed Feb 3 02:14:26 CET 2010
I've got a Nagios 3.2 setup on FC10 monitoring ~32 or so hosts for a
few dozen services and am having troubles trying to add a couple of
hostgroups.
The way I have things organized is /etc/nagios/conf.d/ contains
individual files for each host and /etc/nagios/objects contains
hostgroup definitions used to define common services to be monitored.
I've got all the objects/*.cfg files included in nagios.cfg:
cfg_file=/etc/nagios/objects/commands.cfg
cfg_file=/etc/nagios/objects/contacts.cfg
cfg_file=/etc/nagios/objects/timeperiods.cfg
cfg_file=/etc/nagios/objects/templates.cfg
cfg_file=/etc/nagios/objects/localhost.cfg
cfg_file=/etc/nagios/objects/windows.cfg
cfg_file=/etc/nagios/objects/linux.cfg
cfg_file=/etc/nagios/objects/switch.cfg
cfg_file=/etc/nagios/objects/printer.cfg
cfg_file=/etc/nagios/objects/router.cfg
#cfg_file=/etc/nagios/objects/winhttp.cfg
#cfg_file=/etc/nagios/objects/twiki.cfg
#cfg_file=/etc/nagios/objects/bugzilla.cfg
cfg_file=/etc/nagios/objects/mysql.cfg
cfg_file=/etc/nagios/objects/exchange.cfg
Sample host definition:
#/etc/nagios/conf.d/mailsrv.cfg
define host{
use windows-server ; Inherit default values from a template
host_name mailsrv ; The name we're giving to this host
alias mailsrv.domain.com ; A longer name
associated with the host
hostgroups windows-servers,exchange-servers
address 10.239.1.16 ; IP address of the host
parents cisco-3560g
}
Sample hostgroup definition:
#/etc/nagios/objects/exchange.cfg
define hostgroup{
hostgroup_name exchange-servers
alias Exchange Servers
}
define service{
use generic-service
hostgroup_name exchange-servers
service_description Exchange Information Store
check_command check_nt!SERVICESTATE!-d SHOWALL -l MSExchangeIS
}
define service{
use generic-service
hostgroup_name exchange-servers
service_description Exchange Management
check_command check_nt!SERVICESTATE!-d SHOWALL -l
MSExchangeMGMT
}
define service{
use generic-service
hostgroup_name exchange-servers
service_description Exchange MTA Stacks
check_command check_nt!SERVICESTATE!-d SHOWALL -l
MSExchangeMTA
}
define service{
use generic-service
hostgroup_name exchange-servers
service_description Exchange Routing Engine
check_command check_nt!SERVICESTATE!-d SHOWALL -l RESvc
}
define service{
use generic-service
hostgroup_name exchange-servers
service_description Exchange System Attendant
check_command check_nt!SERVICESTATE!-d SHOWALL -l MSExchangeSA
}
define service{
use generic-service
hostgroup_name exchange-servers
service_description IIS Admin Service
check_command check_nt!SERVICESTATE!-d SHOWALL -l IISADMIN
}
This seems to work fine.
However, I have three hostgroup files that do not work and I can't
suss out why. They're all fairly identical, single-service hostgroups,
two are checking a URL (bugzilla & twiki) and one is a Win32 service
check.
Sample 'broken' hostgroup config:
#/etc/nagios/objects/twiki.cfg
define hostgroup{
hostgroup_name twiki-servers
alias TWiki Servers
}
define service{
use generic-service
hostgroup_name twiki-servers
service_description TWiki
check_command
check_http!$HOSTADDRESS$!twiki/bin/view/Software
}
When I run nagios -v with cfg_file=/etc/nagios/objects/twiki.cfg
present, it complains:
Error: Could not expand hostgroups and/or hosts specified in service
(config file '/etc/nagios/objects/twiki.cfg', starting on line 24)
Error processing object config files!
I'm stumped as to why it cannot expand the hostname. It's defined in
the same file and nowhere else. The only other place "twiki-servers"
is referenced is in one of the other host files in conf.d:
Sample host config (actually works regardless of whether broken
hostgroups are included)
#/etc/nagios/conf.d/hudson.cfg
define host{
use linux-server ; Name of host
template to use
host_name hudson
alias hudson
hostgroups
linux-servers,mysql-servers,twiki-servers,bugzilla-servers
address hudson.sw.domain.com
parents t1-router, cisco-3560g
}
If I comment out that include in nagios.cfg, things run just fine. The
hostgroup_name definition does not appear anywhere else except that
file. I would think that the exchange.cfg file would fail as well,
since they're implemented identically. The same thing happens with the
other 2 definitions, bugzilla.cfg and winhttp.cfg. They're very
similar and use the exchange.cfg template.
Am I missing something? This all *looks* like it should work.
--
-Chris
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list