ZenDMD Tip - Change Interface Speed

From Zenoss Wiki
Revision as of 16:03, 8 January 2014 by Hydruid (Talk | contribs)$7

Jump to: navigation, search

The following is a zendmd script to set the speed for an interface of a device. Sometimes after a device is modeled the interface speed can be incorrect.

WARNING: Be careful and remember to take a backup and/or snapshot before running the below script!


INTERFACE = 'eth0'
SPEED10Mb = '100000000'
SPEED100Mb = '100000000'
SPEED1Gb = '1000000000'
SPEED10Gb = '10000000000'
d = dmd.Devices.findDevice(DEVICE)
for dev in d.Devices.getSubDevices():
    value = d.getProperty(dev)
    for interface in d.os.interfaces():
        if interface.id.startswith(INTERFACE):
#            print interface.id
#            print interface.speed
            interface.speed = (SPEED)
            commit ()

Don't forget to lock the interface from updates, or once it's remodeled the change will be lost!