| Trees | Indices | Help |
|
|---|
|
|
1 ###########################################################################
2 #
3 # This program is part of Zenoss Core, an open source monitoring platform.
4 # Copyright (C) 2007-2009, 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 "Provides Wmi config to zenwin clients."
15
16 from Products.ZenCollector.services.config import CollectorConfigService
17
18 import logging
19 log = logging.getLogger('zen.ModelerService.WinServiceConfig')
20
22 "wraps a service and provides helper methods"
23
26
30
31 @property
35
36 @property
38 "converts unicode service names"
39 name = self._service.name()
40 if type(name) == type(u''):
41 name = name.encode(self._service.zCollectorDecoding)
42 return name
43
44 @property
46 return self._service.getAqProperty('zFailSeverity')
47
49 "generate services wrapped as SmartServices"
50 for service in device.getMonitoredComponents(type='WinService'):
51 yield SmartService(service)
52
54
56 deviceProxyAttributes = ('zWmiMonitorIgnore',
57 'zWinUser',
58 'zWinPassword')
59 CollectorConfigService.__init__(self, dmd, instance, deviceProxyAttributes)
60
62 include = CollectorConfigService._filterDevice(self, device)
63
64 if getattr(device, 'zWmiMonitorIgnore', False):
65 self.log.debug("Device %s skipped because zWmiMonitorIgnore is True",
66 device.id)
67 include = False
68
69 return include
70
72 proxy = CollectorConfigService._createDeviceProxy(self, device)
73
74 # for now, every device gets a single configCycleInterval based upon
75 # the collector's winCycleInterval configuration which is typically
76 # located at dmd.Monitors.Performance._getOb('localhost').
77 # TODO: create a zProperty that allows for individual device schedules
78 proxy.configCycleInterval = self._prefs.winCycleInterval
79
80 proxy.services = {}
81 for service in genServices(device):
82 if service.isMonitored:
83 proxy.services[service.name] = service.severity
84
85 # don't bother adding this device proxy if there aren't any services
86 # to monitor
87 if not proxy.services:
88 log.debug("Device %s skipped because there are no services",
89 proxy.id)
90 return None
91
92 return proxy
93
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0beta1 on Mon Oct 19 14:44:21 2009 | http://epydoc.sourceforge.net |