Archived community.zenoss.org | full text search
Skip navigation
Currently Being Moderated

6.1 1 Adding a zProperty

VERSION 1 
Created on: Oct 26, 2009 4:01 PM by Zenoss API - Last Modified:  Oct 26, 2009 4:01 PM by Zenoss API

#6.1. Adding a zProperty

#6.1.1. Adding a zProperty to an Event

In EventClass.py...

...

def buildZProperties(self):
    edict = self.getDmdRoot("Events")
    edict._setProperty("zNewProperty", "default value")
    edict._setProperty("zNewIntegerProperty", -1, type="int")
    edict._setProperty("zNewFloatProperties", 10.01, type="float")
    edict._setProperty("zNewListProperty", ["default value", \
                       "another default value"], type="lines")
    edict._setProperty("zNewBooleanProperty", False, type="boolean")

...

Adding a new property to the EventClass is as easy adding a new line to the buildZProperties method. You need to set a new property at the "Events" level.

#6.1.2. Adding a zProperty to a Device

In DeviceClass.py

...

def buildDeviceTreeProperties(self):
    devs= self.getDmdRoot("Devices")

...

    devs._setProperty("zNewProperty", "default value")
    devs._setProperty("zNewIntegerProperty", -1, type="int")
    devs._setProperty("zNewFloatProperties", 10.01, type="float")
    devs._setProperty("zNewListProperty", ["default value", \
                      "another default value"], type="lines")
    devs._setProperty("zNewBooleanProperty", False, type="boolean")
...
...

Adding a new property to the DeviceClass is as easy adding a new line to the buildDeviceTreeProperties method. You need to set a new property at the "Devices" level.

Comments (0)