Time-Saving Tricks For Service Definitions
Caylan Van Larson
caylan at mac.com
Fri Jun 29 20:31:44 CEST 2007
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20070629/78d4ab63/attachment.html>
-------------- next part --------------
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
-------------- next part --------------
_______________________________________________
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