1
2
3
4
5
6
7
8
9
10
11
12
13
14 __doc__="""RRDDataPoint
15
16 Defines attributes for how a datasource will be graphed
17 and builds the nessesary DEF and CDEF statements for it.
18
19 $Id:$"""
20
21 __version__ = "$Revision:$"[11:-2]
22
23 import os
24
25 from Globals import DTMLFile
26 from Globals import InitializeClass
27 from AccessControl import ClassSecurityInfo, Permissions
28 from Acquisition import aq_parent
29
30 from Products.ZenRelations.RelSchema import *
31
32 from ZenModelRM import ZenModelRM
33 from ZenPackable import ZenPackable
34
41
42
43
44 SEPARATOR = '_'
45
55
57
59
60 meta_type = 'RRDDataPoint'
61
62 rrdtypes = ('COUNTER', 'GAUGE', 'DERIVE', 'ABSOLUTE')
63
64 createCmd = ""
65 rrdtype = 'GAUGE'
66 isrow = True
67 rrdmin = None
68 rrdmax = None
69
70
71
72 linetypes = ('', 'AREA', 'LINE')
73 rpn = ""
74 color = ""
75 linetype = ''
76 limit = -1
77 format = '%5.2lf%s'
78
79
80 _properties = (
81 {'id':'rrdtype', 'type':'selection',
82 'select_variable' : 'rrdtypes', 'mode':'w'},
83 {'id':'createCmd', 'type':'text', 'mode':'w'},
84 {'id':'isrow', 'type':'boolean', 'mode':'w'},
85 {'id':'rrdmin', 'type':'string', 'mode':'w'},
86 {'id':'rrdmax', 'type':'string', 'mode':'w'},
87 )
88
89
90 _relations = ZenPackable._relations + (
91 ("datasource", ToOne(ToManyCont,"Products.ZenModel.RRDDataSource","datapoints")),
92 )
93
94
95 factory_type_information = (
96 {
97 'immediate_view' : 'editRRDDataPoint',
98 'actions' :
99 (
100 { 'id' : 'edit'
101 , 'name' : 'Data Point'
102 , 'action' : 'editRRDDataPoint'
103 , 'permissions' : ( Permissions.view, )
104 },
105 )
106 },
107 )
108
109 security = ClassSecurityInfo()
110
111
119
120
121
122 security.declareProtected('View', 'getPrimaryUrlPath')
124 """get the physicalpath as a url"""
125 return self.absolute_url_path()
126
127
129 """Include the data source name in our name,
130 useful for lists of DataPoints"""
131 return '%s%c%s' % (self.datasource().id, SEPARATOR, self.id)
132
134 """Get the create command.
135 Return '' for the default from performanceConf"""
136 if self.createCmd:
137 return self.createCmd
138 return ''
139
140
141 security.declareProtected('Manage DMD', 'zmanage_editProperties')
160