Hello,

I added the Collector for the uptime, below you'll find the code. You need to 
add this to the file /usr/lib/python2.4/site-packages/zenoss/plugins/linux2.py 
or in 
/usr/lib/python2.4/site-packages/Zenoss_Plugins-1.0.0-py2.4.egg/zenoss/plugins/linux2.py
 according to your installation:


Code:


COLLECTOR_NAMES = {'cpu' : 'CPUCollector',
                   'io' : 'IOCollector',
                   'disk' : 'DiskCollector',
                   'process' : 'ProcessCollector',
                   'mem' : 'MemoryCollector',
                   'uptime' : 'UptimeCollector'            # Add this rule
                   }

...

class UptimeCollector(Collector):
    '''
    Collector that reads cpu information from /proc
    '''

    def __init__(self, *args, **kwargs):
        Collector.__init__(self, *args, **kwargs)

    def collect(self):
        import popen2
        stdout, stdin = popen2.popen4("/usr/bin/cut -f 1 -d \" \" < 
/proc/uptime")
        lines = stdout.readlines()
        ut = lines[0]
        if ut < 0:
            return "Unknown"
        elif ut == 0:
            return "0d:0h:0m:0s"
        ut = float(ut)
        self.map['sysUpTime'] = int(ut*100)




My OS is Debian Lenny.

Kind regards,
Jurgen




-------------------- m2f --------------------

Read this topic online here:
http://forums.zenoss.com/viewtopic.php?p=36101#36101

-------------------- m2f --------------------



_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users

Reply via email to