Re: [Nagios-users] Time-Saving Tricks For Service Definitions
Nagios network monitoring software is enterprise server monitoring
Brought to you by:
egalstad,
sawolf-nagios
From: Caylan V. L. <ca...@ma...> - 2007-06-29 18:30:59
|
On Jun 29, 2007, at 12:44 PM, Marc Powell wrote: >> define service{ >> name dell-hardware >> service_description Dell Hardware >> hostgroup_name dell-servers >> contact_groups sysadmins >> check_command check_nrpe!check_dell >> } >> >> Right up until I add back in a legacy host/service definition... >> >> define host { >> use production-host >> host_name newhost >> alias New Host >> address y.y.y.y >> } >> >> >> define service { >> use dell-hardware >> host newhost >> } > > dell-hardware is a registered service that is applied to all hosts in > the hostgroup dell-servers. It is _not_ a template (register 0) > that can > be applied to arbitrary service definitions. > > http://nagios.sourceforge.net/docs/2_0/templaterecursion.html > > "The third variable is register. This variable is used to indicate > whether or not the object definition should be "registered" with > Nagios. > By default, all object definitions are registered. If you are using a > partial object definition as a template, you would want to prevent it > from being registered (an example of this is provided later). > Values are > as follows: 0 = do NOT register object definition, 1 = register object > definition (this is the default). __This variable is NOT inherited; > every (partial) object definition used as a template must > explicitly set > the register directive to be 0.__ This prevents the need to > override an > inherited register directive with a value of 1 for every object that > should be registered." > > (emphasis mine) > > -- > Marc When drafting this email I used a sanitized version of my configs, and neglected to add the "register 0" that is in the configuration for the "define service { name dell-hardware .... register 0 }" Unless I'm missing another area where I should be using "register 0" my issue is still unsolved. I'm reading the errors as one single error, with the first line being a bit of detail on why it couldn't register the service. Error: Service 'Dell Hardware' on host 'myhost' has already been defined Error: Could not register service (config file .... newhost.cfg on line XX) Loosely translated as: Error: Could not register (use) service 'Dell Hardware' on newhost because 'Dell Hardware" has already been defined on 'myhost.' My claim is that Nagios parses "hostgroups dell-servers" and incorrectly creates a dynamic service definition that should not be registered, or maybe it's just registering it. Remember, it works the old way. It works the new "trick" way. However, the problem is I can't blend the solutions, where both host definitions are using the same (non registered) service definition. Something is wack. Maybe it's me :) Caylan |