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

Class RRDUtil

source code

object --+
         |
        RRDUtil

Wrapper class around rrdtool

Instance Methods [hide private]
 
__init__(self, defaultRrdCreateCommand, defaultCycleTime)
Initializer
source code
number
endCycle(self)
Report on the number of data points collected in a cycle, and reset the counter for a new cycle.
source code
string
performancePath(self, path)
Given a path, return its location from $ZENHOME and the perf/ directories.
source code
 
getStep(self, cycleTime)
Return the step value for the provided cycleTime.
source code
 
getHeartbeat(self, cycleTime)
Return the heartbeat value for the provided cycleTime.
source code
number or None
put(self, path, value, rrdType, rrdCommand=None, cycleTime=None, min='U', max='U', useRRDDaemon=True, timestamp='N', start=None, allowStaleDatapoint=True)
Save the value provided in the command to the RRD file specified in path.
source code
number or None
save(self, path, value, rrdType, rrdCommand=None, cycleTime=None, min='U', max='U', useRRDDaemon=True, timestamp='N', start=None, allowStaleDatapoint=True)
Save the value provided in the command to the RRD file specified in path.
source code
Method Details [hide private]

__init__(self, defaultRrdCreateCommand, defaultCycleTime)
(Constructor)

source code 

Initializer

The RRD creation command is only used if the RRD file doesn't exist and no rrdCommand was specified with the save() method.

Parameters:
  • defaultRrdCreateCommand (string) - RRD creation command
  • defaultCycleTime (integer) - expected time to periodically collect data
Overrides: object.__init__

endCycle(self)

source code 

Report on the number of data points collected in a cycle, and reset the counter for a new cycle.

Returns: number
number of data points collected during the cycle

performancePath(self, path)

source code 

Given a path, return its location from $ZENHOME and the perf/ directories.

Parameters:
  • path (string) - name for a datapoint in a path (eg device/component/datasource_datapoint)
Returns: string
absolute path

getStep(self, cycleTime)

source code 

Return the step value for the provided cycleTime. This is a hook for altering the default step calculation.

getHeartbeat(self, cycleTime)

source code 

Return the heartbeat value for the provided cycleTime. This is a hook for altering the default heartbeat calculation.

put(self, path, value, rrdType, rrdCommand=None, cycleTime=None, min='U', max='U', useRRDDaemon=True, timestamp='N', start=None, allowStaleDatapoint=True)

source code 

Save the value provided in the command to the RRD file specified in path.

If the RRD file does not exist, use the rrdType, rrdCommand, min and max parameters to create the file.

Parameters:
  • path (string) - name for a datapoint in a path (eg device/component/datasource_datapoint)
  • value (number) - value to store into the RRD file
  • rrdType (string) - RRD data type (eg ABSOLUTE, DERIVE, COUNTER)
  • rrdCommand (string) - RRD file creation command
  • cycleTime (number) - length of a cycle
  • min (number) - minimum value acceptable for this metric
  • max (number) - maximum value acceptable for this metric
  • allowStaleDatapoint (boolean) - attempt to write datapoint even if a newer datapoint has already been written
Returns: number or None
the parameter value converted to a number

save(self, path, value, rrdType, rrdCommand=None, cycleTime=None, min='U', max='U', useRRDDaemon=True, timestamp='N', start=None, allowStaleDatapoint=True)

source code 

Save the value provided in the command to the RRD file specified in path. Afterward, fetch the latest value for this point and return it.

If the RRD file does not exist, use the rrdType, rrdCommand, min and max parameters to create the file.

Parameters:
  • path (string) - name for a datapoint in a path (eg device/component/datasource_datapoint)
  • value (number) - value to store into the RRD file
  • rrdType (string) - RRD data type (eg ABSOLUTE, DERIVE, COUNTER)
  • rrdCommand (string) - RRD file creation command
  • cycleTime (number) - length of a cycle
  • min (number) - minimum value acceptable for this metric
  • max (number) - maximum value acceptable for this metric
  • allowStaleDatapoint (boolean) - attempt to write datapoint even if a newer datapoint has already been written
Returns: number or None
the parameter value converted to a number