this is possible there are some code changes to get this to work
here is the diff patch it works with 2.3.3
diff -Naur ZenModel/GraphDefinition.py ZenModel/GraphDefinition.py
--- ZenModel/GraphDefinition.py 2008-07-30 09:38:46.000000000 -0500
+++ ZenModel/GraphDefinition.py 2008-07-30 09:38:46.000000000 -0500
@@ -78,6 +78,7 @@
miny = -1
maxy = -1
custom = ""
+ customE = ""
hasSummary = True
sequence = 0
@@ -91,6 +92,7 @@
{'id':'miny', 'type':'int', 'mode':'w'},
{'id':'maxy', 'type':'int', 'mode':'w'},
{'id':'custom', 'type':'text', 'mode':'w'},
+ {'id':'customE', 'type':'text', 'mode':'w'},
{'id':'hasSummary', 'type':'boolean', 'mode':'w'},
{'id':'sequence', 'type':'long', 'mode':'w'},
)
diff -Naur ZenModel/MultiGraphReport.py ZenModel/MultiGraphReport.py
--- ZenModel/MultiGraphReport.py 2008-07-30 09:38:46.000000000 -0500
+++ ZenModel/MultiGraphReport.py 2008-07-30 09:38:46.000000000 -0500
@@ -10,7 +10,12 @@
# For complete information please visit: http://www.zenoss.com/oss/
#
###########################################################################
+import logging
+log = logging.getLogger("zen.ZenossInfo")
+import os
+import re
+import os.path
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from ZenModelRM import ZenModelRM
@@ -18,6 +23,7 @@
from RRDView import GetRRDPath
from PerformanceConf import performancePath
from ZenossSecurity import ZEN_MANAGE_DMD
+from Products.ZenUtils.ZenTales import talesEval
import sys
def manage_addMultiGraphReport(context, id, REQUEST = None):
''' Create a new MultiGraphReport
@@ -29,6 +35,28 @@
if REQUEST is not None:
REQUEST['RESPONSE'].redirect(context.absolute_url()+'/manage_main')
+class FakeContext:
+ isFake = True
+ def __init__(self, name):
+ self.id = name
+ def __getattr__(self, name):
+ return FakeContext(name)
+ def __call__(self, *kw, **args):
+ return self
+ def __getitem__(self, key):
+ return FakeContext(key)
+ def __str__(self):
+ return self.id
+ def __repr__(self):
+ return self.id
+ def device(self):
+ return self
+ def __nonzero__(self):
+ return True
+ def rrdPath(self):
+ return 'rrdPath'
+ def getRRDTemplates(self):
+ return []
class MultiGraphReport(ZenModelRM):
@@ -225,7 +253,53 @@
return resequence(self, self.getGraphDefs(), seqmap, origseq,
REQUEST)
### Graphing
-
+
+ def getDsName(self, base, multiid=-1, prefix=''):
+ name = self.addPrefix(prefix, base)
+ if multiid > -1:
+ name = '%s_%s' % (name, multiid)
+ return name
+
+
+ def addPrefix(self, prefix, base):
+ ''' If not base then return ''
+ elif prefix then return prefix_base
+ else return base
+ The result is rrd scrubbed
+ '''
+ s = base or ''
+ if s and prefix:
+ s = '_'.join((prefix, base))
+ s = self.scrubForRRD(s)
+ return s
+
+
+ def scrubForRRD(self, value, namespace=None):
+ ''' scrub value so it is a valid rrd variable name. If namespace
+ is provided then massage value as needed to avoid name conflicts
+ with items in namespace.
+ '''
+ import string
+ import itertools
+ def Scrub(c):
+ if c not in string.ascii_letters + string.digits + '_-':
+ c = '_'
+ return c
+ value = ''.join([Scrub(c) for c in value])
+ if namespace:
+ postfixIter = itertools.count(2)
+ candidate = value
+ while candidate in namespace:
+ candidate = value + str(postfixIter.next())
+ value = candidate
+ return value
+
+ def dataPointId(self):
+ '''
+ Return the id of the datapoint, without the datasource name
+ '''
+ return self.dpName.split('_', 1)[-1]
+
def getDefaultGraphDefs(self, drange=None):
''' Construct the list of graph dicts for this report.
@@ -240,7 +314,7 @@
'title': title,
'url': url,
})
-
+
def GetThingTitle(thing, postfix=''):
title = thing.device().id
if thing != thing.device():
@@ -257,8 +331,16 @@
continue
if gg.combineDevices:
cmds = []
+ #addTotal Start
+ f = open('/tmp/out.txt','a')
+ tmpList = []
+ #addTotal End
idxOffset = 0
for thing in things:
+ #addTotal Start
+ rawName = self.getDsName('%s-raw' %
graphDef.graphPoints()[0].dataPointId(), -1, GetThingTitle(thing))
+ tmpList.append(rawName)
+ #addTotal End
cmds = graphDef.getGraphCmds(
thing.primaryAq(),
performancePath(GetRRDPath(thing)),
@@ -268,6 +350,41 @@
prefix = GetThingTitle(thing),
idxOffset=idxOffset)
idxOffset += len(graphDef.graphPoints())
+ #addTotal Start
+ if len(tmpList) >= 0:
+ totalName = self.getDsName('%s-total-raw' %
graphDef.graphPoints()[0].dataPointId())
+ totalNameRPN = self.getDsName('%s-total-rpn' %
graphDef.graphPoints()[0].dataPointId())
+ #print >>f, totalName
+ #print >>f, tmpList
+ templist2 = tmpList
+ for x in range(len(tmpList)-1):
+ templist2.append("+")
+ CDEFlist = ",".join(templist2)
+ #print >>f, "CDEF:" + totalName + "=" + CDEFlist
+ cmds.append("CDEF:" + totalName + "=" + CDEFlist)
+ #if (re.search('Pkts',totalName)):
+ # cmds.append("CDEF:" + totalNameRPN + "=" + totalName)
+ #else:
+ # cmds.append("CDEF:" + totalNameRPN + "=" + totalName +
",8,*")
+ #cmds.append("VDEF:" + totalNameRPN + "_95=" + totalNameRPN
+ ",95,PERCENT")
+ #cmds.append("COMMENT: \l")
+ #cmds.append("HRULE:"+ totalNameRPN + "_95" +"#990000:95%")
+ #cmds.append("GPRINT:" + totalNameRPN + "_95" + ":%8.2lf%s")
+ #cmds.append("COMMENT: \l")
+ #cmds.append("COMMENT:Total Current\: ")
+ #cmds.append("GPRINT:" + totalNameRPN + ":LAST:%6.2lf %s")
+ #cmds.append("COMMENT:Total Average\: ")
+ #cmds.append("GPRINT:" + totalNameRPN + ":AVERAGE:%6.2lf %s")
+ #cmds.append("COMMENT:Total Max\: ")
+ #cmds.append("GPRINT:" + totalNameRPN + ":MAX:%6.2lf %s")
+ #print >>f, graphDef.graphPoints()[0].dataPointId()
+ if graphDef.customE:
+ context = FakeContext('Context')
+ res = talesEval("string:"+str(graphDef.customE), context)
+ res = [l for l in res.split('\n') if l.strip()]
+ #print >>f, res
+ cmds.extend(res)
+ #addTotal End
AppendToGraphs(things[0], cmds, gg.id)
else:
for thing in things:
diff -Naur ZenModel/RRDGraph.py ZenModel/RRDGraph.py
--- ZenModel/RRDGraph.py 2008-07-30 09:38:46.000000000 -0500
+++ ZenModel/RRDGraph.py 2008-07-30 09:38:46.000000000 -0500
@@ -68,6 +68,7 @@
miny = -1
maxy = -1
custom = ""
+ customE = ""
hasSummary = True
@@ -86,6 +87,7 @@
{'id':'maxy', 'type':'int', 'mode':'w'},
{'id':'colors', 'type':'lines', 'mode':'w'},
{'id':'custom', 'type':'text', 'mode':'w'},
+ {'id':'customE', 'type':'text', 'mode':'w'},
{'id':'hasSummary', 'type':'boolean', 'mode':'w'},
)
@@ -137,6 +139,10 @@
else:
cmds = self.buildDS(cmds, rrdfile, template, self.summary)
cmds = self.thresholds(cmds, context, template)
+ if self.customE:
+ res = talesEval("string:"+str(graphDef.customE), context)
+ res = [l for l in res.split('\n') if l.strip()]
+ cmds.extend(res)
return cmds
mansor wrote:
> Hi,
>
> I'm monitoring my cisco switches on the ISP, and I graph the internet vlanX.
> I've setup this for 95th percentile:
>
> VDEF:in95=ifInOctets,95,PERCENT
> VDEF:out95=ifOutOctets,95,PERCENT
> COMMENT:\s
> COMMENT:95th %ile over current period\: \n
> HRULE:in95#00ff00:95th % In
> GPRINT:in95:= \t %0.2lf%Sbps \n
> HRULE:out95#ff00ff:95th % Out
> GPRINT:out95:= \t %0.2lf%Sbps
>
> I've setup up a multi-graph report for all my vlanX, and I can see my data
> graphs if I setup multiple graphs, at this point works fine everything.
>
> Now I would like to have one single graph with the 95th percentile sumarized
> traffic.
> Is this can be posible?
>
> Thanks,
>
> Mansor.
>
>
>
>
> -------------------- m2f --------------------
>
> Read this topic online here:
> http://forums.zenoss.com/viewtopic.php?p=34231#34231
>
> -------------------- m2f --------------------
>
>
>
> _______________________________________________
> zenoss-users mailing list
> [email protected]
> http://lists.zenoss.org/mailman/listinfo/zenoss-users
>
>
--
------------------------------------------------------
Peter Mistich
Linux System Engineer
Rackspace Managed Hosting
(210)312-4821
------------------------------------------------------
Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace.
Any dissemination, distribution or copying of the enclosed material is
prohibited.
If you receive this transmission in error, please notify us immediately by
e-mail
at [email protected], and delete the original message.
Your cooperation is appreciated.
_______________________________________________
zenoss-users mailing list
[email protected]
http://lists.zenoss.org/mailman/listinfo/zenoss-users