Aug 17, 2012 7:18 AM
Copy/Override Template using zendmd
-
Like (0)
Hello, relative newbie to the world of zenoss here!
I'm looking for a way of copying a template from one deviceClass to another using zendmd (to perform the same operation as the menu item "Override Template") Hoping to use zendmd so our installation/configuration of zenoss can be completely scripted.
I've seen examples of how to apply templates at a device level, but I can't seem to get them to work for a device class.
So, current situation is we have a template from a comunity ZenPack that applies to Devices\Servers. I want to make this apply to Devices\Server\MyClass - a straightforward operation from within the GUI. (Essentially, I want the template to apply to all devices (existing and new) in \Server\MyClass by default, but not to ones in \Server)
So butchering a similar example (from docs/DOC-2526), what I've attempted is this:-
template = dmd.Devices.Server.rrdTemplates.MyTemplate
dest = dmd.Devices.Server.MyClass
dest._setObject(template.id,template._getCopy(dest))
commit()
This seems to create a copy of the template, but applying to "Devices\MyClass" instead of "Devices\Server\MyClass"
Can anyone suggest a better method, or point me in the right direction. Apologies if I've performed some horrendous zendmd abuse!
With a bit of playing around, I found the error. The template should be copied to Devices.Server.MyClass.rrdTemplates. This appears to fix my problem, and all is well:
template = dmd.Devices.Server.rrdTemplates.MyTemplate
dest = dmd.Devices.Server.MyClass.rrdTemplates
dest._setObject(template.id,template._getCopy(dest))
commit()
Follow Us On Twitter »
|
Latest from the Zenoss Blog » | Community | Products | Services Resources | Customers Partners | About Us | ||
Copyright © 2005-2011 Zenoss, Inc.
|
||||||||