Archived community.zenoss.org | full text search
Skip navigation
11186 Views 0 Replies Latest reply: Jul 8, 2009 2:39 PM by Andreas Trawoeger RSS
Andreas Trawoeger Rank: Green Belt 109 posts since
Apr 10, 2008
Currently Being Moderated

Jul 8, 2009 2:39 PM

Thresholds and custom class properties

I'm currently meddling around with ZenModel relationships and tried defining my own Filesystem class:
class LinuxFileSystem(FileSystem):
    _relations = OSComponent._relations + (
        ("os", ToOne(ToManyCont, "ZenPacks.atrawog.HelloLinux.zenmodel.LinuxOperatingSystem", "filesystems")),
    )
    
    _properties = OSComponent._properties + (
        {'id':'mount', 'type':'string', 'mode':''},
        {'id':'storageDevice', 'type':'string', 'mode':''},
        {'id':'type', 'type':'string', 'mode':''},
        {'id':'blockSize', 'type':'int', 'mode':''},
        {'id':'totalFiles', 'type':'long', 'mode':''},
        {'id':'maxNameLen', 'type':'int', 'mode':''},
    )
    
    def getTotalBlocks(self, default = None):
        """
        Return the number of total blocks stored in the filesystem's rrd file
        """
        blocks = self.cacheRRDValue('totalBlocks', default)
        if blocks:
            return long(blocks)
        else:
            return 0

My class definition works flawless and everything shows up correctly in the Web Gui. But I'm lost when I try to define a threshold for my Filesytem class.

Defining a threshold against "here.totalBlocks " like it is done normally won't work, because I'm fetching totalBlocks directly from the RRD file and don't store it in ZODB. But everything i tried like "here.getTotalBlocks()" only ended up with an "User-supplied Python expression for maximum value caused error" message.

More Like This

  • Retrieving data ...