Oct 11, 2010 5:58 PM
How to remove installed software list from a Device or Device Class?
-
Like (0)
Hello everyone!
The default zenpack for linux devices collects a list of all installed software on each device every time the ZenModeler runs. This takes forever, up to a minute generally. We don't want to store a list of the installed software, as nobody in our enterprise cares about that from a management interface.
I've removed the SWInstalledMap plugin from the modeler plugins list for the /Server/Linux device class, and now that info is not collected when we are modeling Linux devices (which, by itself, reduced modeling time for Linux servers from about 90 seconds to 3 seconds).
Now, I'm trying to figure out how to remove the list of installed software for all devices belonging to the /Server/Linux device class. Our Data.fs file is HUGE, and I'm thinking that removing all that unwanted software info from the DB would dramatically reduce the size of Data.fs.
I don't see how to do this anywhere in the documentation, and assume I would need to use zendmd to do it. Has anyone tried to do this? Anyone have any ideas on how that would be done in zendmd?
To be clear, the modeler plugin that I removed to stop checking installed SW list was:
zenoss.snmp.HRSWInstalledMap
I'm not sure where this modeler plugin is storing its data, nor how to remove it.
Thanks...
This will remove all of the software relationships from existing devices in your system.
$ zendmd
>>> for device in dmd.Devices.getSubDevices():
... device.os.software._remove(suppress_events=True)
...
>>> commit()
This will remove all of the software products from your system:
$ zendmd
>>> from Products.ZenModel.SoftwareClass import SoftwareClass
... for product in dmd.Manufacturers.getProductsGen():
... if isinstance(product, SoftwareClass):
... dmd.Manufacturers._delOb( product.getId() )
...
>>> commit()
For obvious reasons I was not able to test this code, but I did verify that the desired objects would be affected.
Finally, you may want to execute the zenoss script found in the /etc/cron.weekly folder. It says that it packs the database, so maybe check the file size of data.fs before and after you run these scripts.
phonegi wrote:
This will remove all of the software relationships from existing devices in your system.
$ zendmd
>>> for device in dmd.Devices.getSubDevices():
... device.os.software._remove(suppress_events=True)
...
>>> commit()
This will remove all of the software products from your system:
$ zendmd
>>> from Products.ZenModel.SoftwareClass import SoftwareClass
... for product in dmd.Manufacturers.getProductsGen():
... if isinstance(product, SoftwareClass):
... dmd.Manufacturers._delOb( product.getId() )
...
>>> commit()
For obvious reasons I was not able to test this code, but I did verify that the desired objects would be affected.
Finally, you may want to execute the zenoss script found in the /etc/cron.weekly folder. It says that it packs the database, so maybe check the file size of data.fs before and after you run these scripts.
Thanks for the help, phonegi!
Well, the first block ran successfully, but the second code block returned this error immediately:
Traceback (most recent call last): File "", line 3, in File "/opt/zenoss/lib/python/Products/BTreeFolder2/BTreeFolder2.py", line 253, in _delOb meta_type = getattr(tree[id], 'meta_type', None) KeyError: 'ATI Display Driver'
Looks like it pretty much puked on the first item in the Software list. Any ideas? Thanks again for the help so far!
Follow Us On Twitter »
|
Latest from the Zenoss Blog » | Community | Products | Services Resources | Customers Partners | About Us | ||
Copyright © 2005-2011 Zenoss, Inc.
|
||||||||