Package ZenHub :: Package services :: Module RRDImpl :: Class RRDImpl
[hide private]
[frames] | no frames]

Class RRDImpl

source code

RRDUtil wrapper class for zenhub

Instance Methods [hide private]
 
__init__(self, dmd)
Initializer
source code
number or None
writeRRD(self, devId, compType, compId, dpName, value)
Write the given data to its RRD file.
source code
string
getDefaultRRDCreateCommand(self, device)
Get the overridable create command for new RRD files.
source code
object
getDeviceOrComponent(self, devId, compId, compType)
If a compId is given then try to return that component.
source code
 
checkThresholds(self, dev, dp, value)
Check the given value against any thresholds.
source code
Class Variables [hide private]
  LONG_RRD_TYPES = ['COUNTER', 'DERIVE']
Method Details [hide private]

__init__(self, dmd)
(Constructor)

source code 
Initializer
Parameters:
  • dmd (dmd object) - Device Management Database (DMD) reference

writeRRD(self, devId, compType, compId, dpName, value)

source code 
Write the given data to its RRD file. Also check any thresholds and send events if value is out of bounds. Note that if the write does not succeed, a None value is returned.
Parameters:
  • devId (string) - device name (as known by DMD)
  • compType (string) - component type (found in objects meta_type field)
  • compId (string) - name of the component
  • dpName (string) - name of the data point
  • value (number) - performance metric to store
Returns: number or None
valid value (ie long or float) or None

getDefaultRRDCreateCommand(self, device)

source code 
Get the overridable create command for new RRD files.
Parameters:
  • device (device object) - device object from in DMD
Returns: string
RRD create command

getDeviceOrComponent(self, devId, compId, compType)

source code 
If a compId is given then try to return that component. If unable to find it or if compId is not specified then try to return the given device. If unable to find then return None.
Parameters:
  • devId (string) - device name (as known by DMD)
  • compId (string) - name of the component
  • compType (string) - component type (found in objects meta_type field)
Returns: object
device or component object

checkThresholds(self, dev, dp, value)

source code 
Check the given value against any thresholds. Count the number of times a dp has exceeded a given threshold in self.counts. Send events as appropriate.
Parameters:
  • dev (object) - device or component object
  • dp (RRD datapoint object) - datapoint
  • value (number) - performance metric to compare