Package Products :: Package ZenRRD :: Module utils
[hide private]
[frames] | no frames]

Module utils

source code

Classes [hide private]
rpnStack
Functions [hide private]
 
loadargs(obj, args)
Load data into a RRD Object
source code
string
prefixid(idprefix, id)
See if prefix needs to be added to id
source code
string or None
rootid(idprefix, id)
See if prefix needs to be removed from id
source code
rrdconfig object
walkupconfig(context, name)
Given a Zope context, try to find the rrdconfig object for the name.
source code
set of strings
templateNames(context)
Return template names in the given context
source code
rrdconfig object
getRRDView(context, name)
Lookup an RRDView based on its name
source code
rrdconfig object
getRRDTargetType(context, name)
Lookup an rrdtargettype based on its name
source code
rrdconfig object
getRRDDataSource(context, name)
Lookup an rrddatasource based on its name
source code
 
close(x, y) source code
 
rpneval(value, rpn)
Simulate RPN evaluation as per http://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.html Note: because we only have one value, we won't support the entire API.
source code
Variables [hide private]
  __doc__ = """ut...
Function Details [hide private]

loadargs(obj, args)

source code 

Load data into a RRD Object

Parameters:
  • obj (RRD object) - RRD object
  • args (list of strings) - arguments

prefixid(idprefix, id)

source code 

See if prefix needs to be added to id

Parameters:
  • idprefix (string) - prefix
  • id (string) - identifier
Returns: string
add the prefix with a '-' in between

rootid(idprefix, id)

source code 

See if prefix needs to be removed from id

Parameters:
  • idprefix (string) - prefix
  • id (string) - identifier
Returns: string or None
remove the prefix with a '-' in between or return None

walkupconfig(context, name)

source code 

Given a Zope context, try to find the rrdconfig object for the name. Raises RRDObjectNotFound if not found.

Parameters:
  • context (Zope context object) - Zope context
  • name (string) - RRDView name
Returns: rrdconfig object
rrdconfig object or None

templateNames(context)

source code 

Return template names in the given context

Parameters:
  • context (Zope context object) - Zope context
Returns: set of strings
names of the templates

getRRDView(context, name)

source code 

Lookup an RRDView based on its name

Parameters:
  • context (Zope context object) - Zope context
  • name (string) - RRDView name
Returns: rrdconfig object
rrdconfig object or None

getRRDTargetType(context, name)

source code 

Lookup an rrdtargettype based on its name

Parameters:
  • context (Zope context object) - Zope context
  • name (string) - RRDView name
Returns: rrdconfig object
rrdconfig object or None

getRRDDataSource(context, name)

source code 

Lookup an rrddatasource based on its name

Parameters:
  • context (Zope context object) - Zope context
  • name (string) - RRDView name
Returns: rrdconfig object
rrdconfig object or None

rpneval(value, rpn)

source code 

Simulate RPN evaluation as per http://oss.oetiker.ch/rrdtool/doc/rrdgraph_rpn.en.html Note: because we only have one value, we won't support the entire API. >>> rpneval(2, '2,*') 4.0 >>> rpneval(7, '2,3,*,*') 42.0 >>> close(rpneval(19, '9,5,/,*,32,+'), 66.2) True >>> rpneval(1, '*') -1.0 >>> rpneval(2, '-8,-') 10.0 >>> rpneval(3, '2,%') 1.0 >>> rpneval(1e5000 - 1e5000, 'UN') 1.0 >>> rpneval(70, '71,LT') 1.0 >>> rpneval(69, '69,LT') 0.0 >>> rpneval(68, 'inf,LT') 0.0 >>> rpneval(67, '67,LE') 1.0 >>> rpneval(66, '0,LE') 0.0 >>> rpneval(65, 'inf,LE') 0.0 >>> rpneval(64, '60,GT') 1.0 >>> rpneval(63, '63,GT') 0.0 >>> rpneval(63, 'neginf,GT') 0.0 >>> rpneval(61, '100,GE') 0.0 >>> rpneval(60, '60,GE') 1.0 >>> rpneval(59, 'neginf,GE') 0.0 >>> rpneval(58, '137,EQ') 0.0 >>> rpneval(57, '57,EQ') 1.0 >>> rpneval(56, 'inf,EQ') 0.0 >>> rpneval(55, '55,NE') 0.0 >>> rpneval(-1e5000, 'neginf,EQ') 0.0 >>> rpneval(1e5000 - 1e5000, 'unkn,EQ') 0.0 >>> rpneval(1e5000 - 1e5000, 'unkn,NE') 0.0 >>> rpneval(1e5000, 'inf,NE') 0.0 >>> rpneval(51, '51,NE') 0.0 >>> rpneval(50, ' 42 , NE ') 1.0 >>> rpneval(49, 'UN') 0.0 >>> rpneval(-1e5000, 'isINF') 1.0 >>> rpneval(1e5000, 'IsInF') 1.0 >>> rpneval(46, 'ISINF') 0.0 >>> rpneval(0, '1,2,if') 2.0 >>> rpneval(44, '1,2,if') 1.0 >>> rpneval(1e5000, '1,2,IF') 1.0 >>> rpneval(1e5000 - 1e5000, '1,2,iF') 1.0 >>> rpneval(41, '5,min') 5.0 >>> rpneval(40, 'neginf,min') == -1e5000 True >>> rpneval(39, 'unkn,min') nan >>> rpneval(38, 'neginf,max') 38.0 >>> rpneval(37, 'inf,max') == 1e5000 True >>> math.isnan(rpneval(36, 'unkn,max')) True >>> math.isnan(rpneval(35, '30,neginf,limit')) True >>> math.isnan(rpneval(34, '30,30.5,limit')) True >>> rpneval(33, '30,35,limit') 33.0 >>> rpneval(32, '464,+') 496.0 >>> rpneval(31, '5,-') 26.0 >>> rpneval(37, '18,*') 666.0 >>> close(rpneval(29, '5,/'), 5.8) True >>> math.isnan(rpneval(28, '0,/')) True >>> rpneval(27, '11,%') 5.0 >>> math.isnan(rpneval(26, '0,%')) True >>> rpneval(25, '0,0,/,addnan') 25.0 >>> close(rpneval(math.pi / 6, 'sin'), 0.5) True >>> close(rpneval(math.pi / 3, 'cos'), 0.5) True >>> rpneval(math.e, 'log') == 1 True >>> rpneval(1, 'exp') == math.e True >>> rpneval(1.44, 'sqrt') 1.2 >>> rpneval(1, 'atan') == math.pi / 4 True >>> rpneval(1, '0,atan2') == math.pi / 2 True >>> rpneval(17.9, 'floor') 17.0 >>> rpneval(16.3, 'ceil') 17.0 >>> rpneval(15, 'deg2rad') == 15 * math.pi / 180 True >>> rpneval(14, 'rad2deg') == 14 * 180 / math.pi True >>> rpneval(-13,'abs') 13.0 >>> rpneval(12, '5,7,3,sort,-,-') 10.0 >>> rpneval(11, '3,4,3,rev,-,+') -4.0 >>> rpneval(10, '5,4,2,4,avg') 5.25 >>> rpneval(9, 'unkn') nan >>> rpneval(8, 'inf') inf >>> rpneval(7, 'neginf') -inf >>> rpneval(6, 'time') != 6 True >>> rpneval(5, 'dup,-') 0.0 >>> rpneval(2, 'pop') -1.0 >>> rpneval(4, '5,exc,-') 1.0 >>> rpneval(None, '2,*') None


Variables Details [hide private]

__doc__

Value:
"""utils

RRD utility functions
"""