1
2
3
4
5
6
7
8
9
10
11
12
13
14 __doc__="""Service.py
15
16 Service is a function provided by computer (like a server). it
17 is defined by a protocol type (udp/tcp) and a port number.
18
19 $Id: Service.py,v 1.15 2003/03/11 23:32:13 edahl Exp $"""
20
21 __version__ = "$Revision: 1.15 $"[11:-2]
22
23 from Globals import DTMLFile
24 from Globals import InitializeClass
25 from Acquisition import aq_base, aq_chain
26 from AccessControl import ClassSecurityInfo
27 from Commandable import Commandable
28
29 from Products.ZenRelations.RelSchema import *
30
31 from OSComponent import OSComponent
32 from ZenPackable import ZenPackable
33
34 -class Service(OSComponent, Commandable, ZenPackable):
35 portal_type = meta_type = 'Service'
36
37 _relations = OSComponent._relations + ZenPackable._relations + (
38 ("serviceclass", ToOne(ToMany,"Products.ZenModel.ServiceClass","instances")),
39 ('userCommands', ToManyCont(ToOne, 'Products.ZenModel.UserCommand', 'commandable')),
40 )
41
42 security = ClassSecurityInfo()
43
45 """Return tuple (manageIp, name) for this service to uniquely id it.
46 """
47 return (self.getManageIp(), self.name())
48
49
51 """Return the name of this service. (short name for net stop/start).
52 """
53 svccl = self.serviceclass()
54 if svccl: return svccl.name
55 return ""
56
57
59 """Should this service be monitored or not. Use ServiceClass aq path.
60 """
61 return self.getAqProperty("zMonitor")
62
64 """Return a list of tuples with the possible severities
65 """
66 return self.ZenEventManager.getSeverities()
67
69 """Return the severity for this service when it fails.
70 """
71 return self.getAqProperty("zFailSeverity")
72
74 """Return a string representation of zFailSeverity
75 """
76 return self.ZenEventManager.severities[self.getAqProperty("zFailSeverity")]
77
85
86
98
99
101 return self.serviceclass()
102
103
104 security.declareProtected('Manage DMD', 'manage_editService')
117
118
120 ''' Called by Commandable.doCommand() to ascertain objects on which
121 a UserCommand should be executed.
122 '''
123 return [self]
124
125
131
132
137
138
141