<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><br class="Apple-interchange-newline"></span></span></span> </div><br><div><div>On Jun 29, 2007, at 8:48 AM, Caylan Van Larson wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; ">Howdy,<div><br class="khtml-block-placeholder"></div><div>I think I've found a bug with the "Object Definition Tricks" found at <a href="http://nagios.sourceforge.net/docs/2_0/templatetricks.html#service">http://nagios.sourceforge.net/docs/2_0/templatetricks.html#service</a>.</div><div><br class="khtml-block-placeholder"></div><div>Here is my configuration using the tricks above, which works...</div><div><br class="khtml-block-placeholder"></div><div><font class="Apple-style-span" face="Courier">define host {</font></div><div><font class="Apple-style-span" face="Courier">        use                     production-host</font></div><div><font class="Apple-style-span" face="Courier">        host_name               myhost</font></div><div><font class="Apple-style-span" face="Courier">        alias                   My Host</font></div><div><font class="Apple-style-span" face="Courier">        address                 x.x.x.x</font></div><div><font class="Apple-style-span" face="Courier">        hostgroups              <font class="Apple-style-span" color="#002A81"><b>dell-servers</b></font></font></div><div><font class="Apple-style-span" face="Courier">}</font></div><div><font class="Apple-style-span" face="Courier"><br class="khtml-block-placeholder"></font></div><div><font class="Apple-style-span" face="Courier">define hostgroup{</font></div><div><font class="Apple-style-span" face="Courier">        hostgroup_name<span class="Apple-tab-span" style="white-space:pre">                   </span> <font class="Apple-style-span" color="#002A81"><b>dell-servers</b></font></font></div><div><font class="Apple-style-span" face="Courier">        alias           <span class="Apple-tab-span" style="white-space:pre">          </span> Dell Servers</font></div><div><font class="Apple-style-span" face="Courier">}</font></div><div><font class="Apple-style-span" face="Courier"><br class="khtml-block-placeholder"></font></div><div><font class="Apple-style-span" face="Courier">define service{</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">           </span> name                    dell-hardware</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">          </span> service_description     Dell Hardware</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">          </span> hostgroup_name          <font class="Apple-style-span" color="#002A81"><b>dell-servers</b></font></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">          </span> contact_groups          sysadmins</font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">              </span> check_command           check_nrpe!check_dell</font></div><div><font class="Apple-style-span" face="Courier">}</font></div><div><br class="khtml-block-placeholder"></div><div>Right up until I add back in a legacy host/service definition...</div><div><br class="khtml-block-placeholder"></div><div><font class="Apple-style-span" face="Courier"><b><font class="Apple-style-span" color="#FB0C00">define host {</font></b></font></div><div><font class="Apple-style-span" face="Courier"><b><font class="Apple-style-span" color="#FB0C00">        use                     production-host</font></b></font></div><div><font class="Apple-style-span" face="Courier"><b><font class="Apple-style-span" color="#FB0C00">        host_name               newhost</font></b></font></div><div><font class="Apple-style-span" face="Courier"><b><font class="Apple-style-span" color="#FB0C00">        alias                   New Host</font></b></font></div><div><font class="Apple-style-span" face="Courier"><b><font class="Apple-style-span" color="#FB0C00">        address                 y.y.y.y</font></b></font></div><div><font class="Apple-style-span" face="Courier"><b><font class="Apple-style-span" color="#FB0C00">}</font></b></font></div><div><font class="Apple-style-span" face="Courier"><b><font class="Apple-style-span" color="#FB0C00"><br class="khtml-block-placeholder"></font></b></font></div><div><font class="Apple-style-span" face="Courier"><b><font class="Apple-style-span" color="#FB0C00">define service {</font></b></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">         </span><b><font class="Apple-style-span" color="#FB0C00"> use </font></b></font><font class="Apple-style-span" face="Courier"><b><font class="Apple-style-span" color="#FB0C00">                    dell-hardware</font></b></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre">           </span><b><font class="Apple-style-span" color="#FB0C00"> host</font></b><span class="Apple-tab-span" style="white-space:pre">                                              </span><b><font class="Apple-style-span" color="#FB0C00"> newhost</font></b></font></div><div><font class="Apple-style-span" face="Courier"><b><font class="Apple-style-span" color="#FB0C00">}</font></b></font></div><div><font class="Apple-style-span" face="Courier"><span class="Apple-tab-span" style="white-space:pre"></span></font></div><div><br class="khtml-block-placeholder"></div><div><b>Error: Service 'Dell Hardware' on host 'myhost' has already been defined</b></div><div><b>Error: Could not register service (config file .... newhost.cfg on line XX)</b></div><div><br class="khtml-block-placeholder"></div><div>Question:  Why does "using" dell-hardware in a normal syntax (remember, my goal is to migrate the old style in red to the new hostgroups trick style above), is not compatible when the service has a hostgroup_name defined?  This looks to me like a bug, where it's trying to redefine the service instead of just using it.<br><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div><br></div><div>Thoughts?</div></span></div></span></blockquote></div><div><br class="webkit-block-placeholder"></div>My thought is that you need a unique "name" directive in the second service that uses dell-hardware. Otherwise the service with the use directive has the same name as the service it is using, causing exactly what the error says- the service dell hardware has already been defined, and yes, you are trying to re-define it. Basically, when you insert the use directive, it copies everything from the service (or whatever) you tell it to use into the new one, except for any directives that are explicitly set in the new on. And since you can't have two service definitions with the same name, you get that error.<div><br><div><div>-----------------------------------------------</div><div>Israel Brewster</div><div>Computer Support Technician</div><div>Frontier Flying Service Inc.</div><div>5245 Airport Industrial Rd</div><div>Fairbanks, AK 99709</div><div>(907) 450-7250 x293</div><div>-----------------------------------------------</div></div></div></body></html>