| 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 or (at your
8 # option) any later version as published by 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')
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 isinstance(name, unicode):
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 running = None
84 if service.getStatus() > 0:
85 running = False
86 else:
87 running = True
88
89 proxy.services[service.name] = (
90 running, service.severity, None,
91 service.getMonitoredStartModes())
92
93 # don't bother adding this device proxy if there aren't any services
94 # to monitor
95 if not proxy.services:
96 log.debug("Device %s skipped because there are no services",
97 proxy.id)
98 return None
99
100 return proxy
101
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1.1812 on Tue Oct 11 12:51:58 2011 | http://epydoc.sourceforge.net |