Package Products :: Package ZenWin :: Module WMIPlugin |
[hide private]
[frames] | no frames]

# Source Code for Module Products.ZenWin.WMIPlugin

     1  ###########################################################################
     2  #
     3  # This program is part of Zenoss Core, an open source monitoring platform.
     4  # Copyright (C) 2007, Zenoss Inc.
     5  #
     6  # This program is free software; you can redistribute it and/or modify it
     7  # under the terms of the GNU General Public License version 2 as published by
     8  # the Free Software Foundation.
     9  #
    10  # For complete information please visit: http://www.zenoss.com/oss/
    11  #
    12  ###########################################################################
    13
    14  from Products.DataCollector.plugins.CollectorPlugin import CollectorPlugin
    15
    16 -class WMIPlugin(CollectorPlugin):
    17      """
    18      A WMIPlugin defines a native Python collection routine and a parsing
    19      method to turn the returned data structure into a datamap. A valid
    20      WMIPlugin must implement the process method.
    21      """
    22      transport = "wmi"
    23      deviceProperties = CollectorPlugin.deviceProperties + (
    24          'zWmiMonitorIgnore',
    25          'zWinUser',
    26          'zWinPassword',
    27          'zWinEventlogMinSeverity',
    28      )
    29
    30 -    def condition(self, device, log):
    31          return not getattr(device, 'zWmiMonitorIgnore', True)
    32
    33 -    def copyDataToProxy(self, device, proxy):
    34          for prop in self.deviceProperties:
    35              if hasattr(device, prop):
    36                  setattr(proxy, prop, getattr(device, prop))
    37          # Do any other prep of plugin here
    38          setattr(proxy, 'lastChange', getattr(device, '_lastChange', ''))
    39
    40 -    def queries(self):
    41          raise NotImplementedError
    42
    43 -    def preprocess(self, results, log):
    44          if isinstance(results, Exception):
    45              log.error(results)
    46              return None
    47          return results
    48