ZenDMD Tip - Move Products to Proper Manufacturer

From Zenoss Wiki
This is the approved revision of this page, as well as being the most recent.
Jump to: navigation, search

When Zenoss finds a new hardware model, operating system revision or installed piece of software it creates a product record for it in the manufacturers database. Typically the new product record will be put into the Unknown manufacturer unless Zenoss knows otherwise.

In many cases Zenoss can't figure out the proper manufacturer, but it's obvious to you based on something in the product's name. A common example would be IOS revisions on Cisco devices. There are about three for each day of the week, each device has its own, and it would be nice to automatically put them into the Cisco manufacturer when found.

The following examples shows how this could be done.

# Move products into the proper manufacturer by performing a regular expression
# match on their name.
import re
prefix_to_manufacturer = {
    r'^Aruba': 'Aruba',
    r'^Java': 'Oracle',
    r'^Adobe': 'Adobe',
    r'^IOS ': 'Cisco',
unknown = dmd.Manufacturers.Unknown
for product in unknown.products():
    for prefix in prefix_to_manufacturer.keys():
        if re.search(prefix, product.id, re.I):
                '/%s' % prefix_to_manufacturer[prefix],