Time-Saving Tricks For Service Definitions
Patrick Morris
patrick.morris at hp.com
Fri Jun 29 23:41:56 CEST 2007
Hi Caylan!
On Fri, 29 Jun 2007, Caylan Van Larson wrote:
> Howdy,
>
> I think I've found a bug with the "Object Definition Tricks" found at
> http://nagios.sourceforge.net/docs/2_0/templatetricks.html#service.
>
> Here is my configuration using the tricks above, which works...
>
> define host {
> use production-host
> host_name myhost
> alias My Host
> address x.x.x.x
> hostgroups dell-servers
> }
>
> define hostgroup{
> hostgroup_name dell-servers
> alias Dell Servers
> }
>
> 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
> }
>
> Error: Service 'Dell Hardware' on host 'myhost' has already been defined
> Error: Could not register service (config file .... newhost.cfg on
> line XX)
>
> 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.
I'm not seeing a bug.
You defined a dell-hardware service that is not a template. It's a
registered service.
Later, you create another service based on that registered service, so
iin effect you're creating a duplicate service definition, with the same
name. Nagios *should* barf on that. It's a dupe.
If that's not the source of your problem, and it's just that the
"register 0" in the first service definition got dropped, than I suspect
there may be other pieces that got sanitized out that are causing your
error.
The most likely cause would be something like having "production host"
set as a member of "dell-servers," or otherwise having newhost already a
member of a group with the dell-hardware service assigned to it before
second time you define the service.
-------------------------------------------------------------------------
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/
_______________________________________________
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