Jan 13, 2010 1:50 PM
creating new device with zendmd
-
Like (0)
sorry for asking such a basic question but here we go:
trying to create new devices in bulk using zendmd. This is mostly copy/paste from the developer guide:
>>> for line in file('linux.txt'):
... d = dmd.Devices.Server.createInstance(line.strip())
... commit()
... d.collectDevice()
...
Traceback (most recent call last):
File "<console>", line 4, in ?
File "/opt/zenoss/zenoss/Products/ZenModel/Device.py", line 1674, in collectDevice
perfConf.collectDevice(self, setlog, REQUEST)
AttributeError: 'NoneType' object has no attribute 'collectDevice'
Have you tried the script I wrote some time back, that takes a CSV file as input? You can find the script and sample input file here:
Cheers,
Jane
try this code, and let me know what the output is:
for line in open("linux.txt"):
dmd.DeviceLoader.loadDevice(line, "/Server")
Try this...
>>> d = dmd.Devices.Server.createInstance('asdf')
>>> d.setPerformanceMonitor('localhost')
>>> commit()
>>> d.collectDevice()
-EAD
Erik A. Dahl
Co-Founder and CTO, Zenoss Inc.
Thank you Erik, that fixed it. The developer guide is missing the d.setPerformanceMonitor('localhost') in the sample code.
i've been poking around the documentation looking for more info on zendmd commands but can't find much - what's the 'right' way of obtaining that information?
thanks
-iv
Well there isn't a good answer to the right way... You can use grepdir
to find methods that you are looking for like:
>>> d = find('tilde*')
>>> grepdir(d, '^set')
setAdminLocalRoles
setGroups
setGroups__roles__
setHWProduct
setHWProductKey
...
grepdir takes an object and a regex.
You can ignore the __roles__ methods they have to do with access
control.
You can also look in the API doc
But its not an "official" list of APIs to call.
Of course you can go to the source when all else fails. Clearly this
is a place we need improvement.
-EAD
Erik A. Dahl
Co-Founder and CTO, Zenoss Inc.
Follow Us On Twitter »
|
Latest from the Zenoss Blog » | Community | Products | Services Resources | Customers Partners | About Us | ||
Copyright © 2005-2011 Zenoss, Inc.
|
||||||||