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 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 __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 ) 48123 124 125 InitializeClass(ThresholdGraphPoint) 12650 ''' 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 else: 94 gp = None 95 related[dpName] = gp 96 return related97 98101 ''' Build the graphing commands for this graphpoint 102 ''' 103 from Products.ZenUtils.Utils import unused 104 unused(multiid, rrdDir) 105 if getattr(context, 'isFake', False): 106 return cmds 107 relatedGps = self.getRelatedGraphPoints(context) 108 gopts = [] 109 threshClass = self.getThreshClass(context) 110 if threshClass: 111 threshInst = threshClass.createThresholdInstance(context) 112 namespace = self.addPrefix(prefix, self.id) 113 color = self.getThresholdColor(idx) 114 legend = self.talesEval(self.legend, context) 115 template = self.graphDef.rrdTemplate() or None 116 # We can't get templates when doing mgr 117 # need to refactor threshinst to not take template. 118 # Looks like it's not being used anyway. 119 gopts = threshInst.getGraphElements( 120 template, context, gopts, namespace, 121 color, legend, relatedGps) 122 return cmds + gopts
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1.1812 on Tue Oct 11 12:51:43 2011 | http://epydoc.sourceforge.net |