1
2
3
4
5
6
7
8
9
10
11
12
13
14 import os
15
16 from Globals import InitializeClass
17 from AccessControl import ClassSecurityInfo
18 from AccessControl import Permissions
19 from DateTime import DateTime
20
21 from Products.PageTemplates.Expressions import getEngine
22 from Products.ZenUtils.ZenTales import talesCompile
23 from Products.ZenRelations.RelSchema import *
24 from Products.ZenEvents.ZenEventClasses import Status_Nagios
25
26 from ZenModelRM import ZenModelRM
27
28
29 import warnings
30 warnings.warn("NagiosCmd is deprecated", DeprecationWarning)
32
33 usessh = True
34 cycletime = 60
35 enabled = True
36 component = ""
37 eventClass = "/Status/Nagios"
38 eventKey = ""
39 severity = 3
40 commandTemplate = ""
41
42 _properties = (
43 {'id':'enabled', 'type':'boolean', 'mode':'w'},
44 {'id':'usessh', 'type':'boolean', 'mode':'w'},
45 {'id':'component', 'type':'string', 'mode':'w'},
46 {'id':'eventClass', 'type':'string', 'mode':'w'},
47 {'id':'eventKey', 'type':'string', 'mode':'w'},
48 {'id':'severity', 'type':'int', 'mode':'w'},
49 {'id':'commandTemplate', 'type':'string', 'mode':'w'},
50 )
51
52 _relations = (
53 ("nagiosTemplate", ToOne(ToManyCont, "Products.ZenModel.NagiosTemplate", "nagiosCmds")),
54 )
55
56 factory_type_information = (
57 {
58 'immediate_view' : 'editNagiosCmd',
59 'actions' :
60 (
61 { 'name' : 'Nagios Command'
62 , 'action' : 'editNagiosCmd'
63 , 'permissions' : ( Permissions.view, )
64 },
65 { 'name' : 'Modifications'
66 , 'action' : 'viewHistory'
67 , 'permissions' : ( Permissions.view, )
68 },
69 )
70 },
71 )
72
73 security = ClassSecurityInfo()
74
75
83
84
86 """Return tuple that defines monitored info for this cmd.
87 (ssh,cycletime,compname,eventClass,eventKey,severity,commnad)
88 """
89 return (self.usessh, self.getCycleTime(context),
90 self.getComponentName(context), self.eventClass,
91 self.eventKey, self.severity, self.getCommand(context))
92
93
95 """Get cycle time of this monitor.
96 """
97 if self.cycletime != 0: return self.cycletime
98 return context.zNagiosCycleTime
99
100
101
108
109
129
130 InitializeClass(NagiosCmd)
131