Trees | Indices | Help |
|
---|
|
1 ########################################################################### 2 # 3 # This program is part of Zenoss Core, an open source monitoring platform. 4 # Copyright (C) 2007, 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 __doc__="""ThreshGraphPoint 15 16 Handles GraphPoints that refer to RRDDataPoints 17 """ 18 19 from GraphPoint import GraphPoint 20 from Globals import InitializeClass 21 2224 ''' This is here so than zope will let us copy/paste/rename 25 graphpoints. 26 ''' 27 gp = ThresholdGraphPoint(id) 28 context._setObject(gp.id, gp) 29 if REQUEST: 30 return context.callZenScreen(REQUEST)31 3234 35 meta_type = 'ThresholdGraphPoint' 36 37 isThreshold = True 38 39 threshId = '' 40 color = '' 41 legend = GraphPoint.DEFAULT_LEGEND 42 43 _properties = GraphPoint._properties + ( 44 {'id':'threshId', 'type':'string', 'mode':'w'}, 45 {'id':'color', 'type':'string', 'mode':'w'}, 46 {'id':'legend', 'type':'string', 'mode':'w'}, 47 ) 48124 125 126 InitializeClass(ThresholdGraphPoint) 12750 ''' Get the related threshold class or None if it doesn't exist 51 ''' 52 threshClass = None 53 if self.graphDef.rrdTemplate(): 54 threshClass = self.graphDef.rrdTemplate.thresholds._getOb( 55 self.threshId, None) 56 return threshClass57 5860 return self.threshId61 62 65 66 67 # def getMissingDPNames(self): 68 # ''' Return a list of datapoint names that are used by this threshold 69 # but not included in any graphpoint. 70 # ''' 71 # threshClass = self.getThreshClass() 72 # if threshClass: 73 # dpNames = [dpName for dpName in threshClass.dsnames 74 # if not self.graphDef.isDataPointGraphed(dpName)] 75 # else: 76 # dpNames = [] 77 # return dpNames 78 7981 ''' Return a dictionary where keys are the dp names from the 82 threshold and values are a DataPointGraphPoint for that dp or 83 None if a RPGP doesn't exist. If multiple exist for any given 84 dp then return just the first one. 85 ''' 86 related = {} 87 threshClass = self.getThreshClass(context) 88 if threshClass: 89 for dpName in threshClass.dsnames: 90 gps = self.graphDef.getDataPointGraphPoints(dpName) 91 if gps: 92 gp = gps[0] 93 gp.legend = gp.talesEval(gp.legend, context) 94 else: 95 gp = None 96 related[dpName] = gp 97 return related98 99102 ''' Build the graphing commands for this graphpoint 103 ''' 104 from Products.ZenUtils.Utils import unused 105 unused(multiid, rrdDir) 106 if getattr(context, 'isFake', False): 107 return cmds 108 relatedGps = self.getRelatedGraphPoints(context) 109 gopts = [] 110 threshClass = self.getThreshClass(context) 111 if threshClass: 112 threshInst = threshClass.createThresholdInstance(context) 113 namespace = self.addPrefix(prefix, self.id) 114 color = self.getThresholdColor(idx) 115 legend = self.talesEval(self.legend, context) 116 template = self.graphDef.rrdTemplate() or None 117 # We can't get templates when doing mgr 118 # need to refactor threshinst to not take template. 119 # Looks like it's not being used anyway. 120 gopts = threshInst.getGraphElements( 121 template, context, gopts, namespace, 122 color, legend, relatedGps) 123 return cmds + gopts
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Thu May 7 11:46:34 2009 | http://epydoc.sourceforge.net |