sysinfo.py

place in: Products/DataCollector/plugins/zenoss/cmd/linux/
Then restart Zenoss

On the remote system, create a file '/etc/sysinfo.zenoss' with the following 
format (just leave out the lines which you don't need/know):

Code:

Contact: <your email address>
Location: <server's location description>
Hardware: <server's hardware description>
Serialnumber: <server hardware's serial number>
Tag: <server's tag>





Code:

###########################################################################
#
# This program is an addendum to Zenoss Core, an open source monitoring 
platform.
# Copyright (C) 2009, Ross R. Duncan
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# For complete information on Zenoss please visit: http://www.zenoss.com/oss/
#
###########################################################################

from Products.DataCollector.plugins.DataMaps import ObjectMap

from CollectorPlugin import CommandPlugin

class sysinfo(CommandPlugin):
    """
    retrieves system info using cat /etc/sysinfo.zenoss
    """
    command = 'cat /etc/sysinfo.zenoss'

    def condition(self, device, log):
        return device.os.uname == 'Linux'


    def process(self, device, results, log):
        log.info('Collecting system information for device %s' % device.id)

        os = None
        for row in results.split('\n'):
            if len(row.strip()) == 0: continue

            values = row.split(':')
            if len(values) < 2: continue
            name, value = values[0:2]

            name = name.strip()
            value = value.strip()

            if os == None:
                os = self.objectMap()
            if name == 'Contact': os.snmpContact = value
            if name == 'Location': os.snmpLocation = value
            if name == 'Serialnumber': os.setHWSerialNumber = value
            if name == 'Tag': os.setHWTag = value
            if name == 'Hardware': os.setHWProductKey = value
        return os







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

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

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



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

Reply via email to