Fawkes API  Fawkes Development Version
fawkes::RRDDefinition Class Reference

RRD Definition. More...

#include <>>

List of all members.

Public Member Functions

 RRDDefinition (const char *name, std::vector< RRDDataSource > &ds, unsigned int step_sec=10, bool recreate=false)
 Constructor with default RRAs.
 RRDDefinition (const char *name, std::vector< RRDDataSource > &ds, std::vector< RRDArchive > &rra, unsigned int step_sec=10, bool recreate=false)
 Constructor.
 RRDDefinition (const RRDDefinition &other)
 Copy constructor.
 ~RRDDefinition ()
 Destructor.
RRDDefinitionoperator= (const RRDDefinition &other)
 Assignment operator.
size_t find_ds_index (const char *ds_name) const
 Find data source index.
void set_filename (const char *filename)
 Set filename.
const char * get_name () const
 Get name.
unsigned int get_step_sec () const
 Get step size in sec.
bool get_recreate () const
 Check recreation flag.
const std::vector
< RRDDataSource > & 
get_ds () const
 Get data sources.
const RRDDataSourceget_ds (size_t i) const
 Get specific data source.
const std::vector< RRDArchive > & get_rra () const
 Get RRD archives.
const char * get_filename () const
 Get file name.
void set_rrd_manager (RRDManager *rrd_manager)
 Set RRD manager.

Static Public Member Functions

static const std::vector
< RRDArchive
get_default_rra ()
 Get default RRAs.

Detailed Description

RRD Definition.

This class describes everything required to create an RRD file. It does not represent all the options rrdtool provides, but a reasonable subset.

Author:
Tim Niemueller

Constructor & Destructor Documentation

fawkes::RRDDefinition::RRDDefinition ( const char *  name,
std::vector< RRDDataSource > &  ds,
unsigned int  step_sec = 10,
bool  recreate = false 
)

Constructor with default RRAs.

This creates the RRD definition with the default RRAs produced by get_default_rra().

Parameters:
nameRRD name
dsdata sources
step_secSpecifies the base interval in seconds with which data will be fed into the RRD.
recreateif true existing RRD files will be overwritten, otherwise data is appended.

Definition at line 274 of file rrd_descriptions.cpp.

fawkes::RRDDefinition::RRDDefinition ( const char *  name,
std::vector< RRDDataSource > &  ds,
std::vector< RRDArchive > &  rra,
unsigned int  step_sec = 10,
bool  recreate = false 
)

Constructor.

Parameters:
nameRRD name
dsdata sources
rraRRAs for this RRD.
step_secSpecifies the base interval in seconds with which data will be fed into the RRD.
recreateif true existing RRD files will be overwritten, otherwise data is appended.

Definition at line 290 of file rrd_descriptions.cpp.

fawkes::RRDDefinition::RRDDefinition ( const RRDDefinition other)

Copy constructor.

Parameters:
otherinstance to clone

Definition at line 303 of file rrd_descriptions.cpp.

fawkes::RRDDefinition::~RRDDefinition ( )

Destructor.

Definition at line 333 of file rrd_descriptions.cpp.

References fawkes::RRDManager::remove_rrd().


Member Function Documentation

size_t fawkes::RRDDefinition::find_ds_index ( const char *  ds_name) const

Find data source index.

Parameters:
ds_namename of the data source
Returns:
index of found data source
Exceptions:
Exceptionthrown if the data source could not be found

Definition at line 397 of file rrd_descriptions.cpp.

References get_name().

Referenced by fawkes::RRDGraphDataDefinition::to_string().

const std::vector< RRDArchive > fawkes::RRDDefinition::get_default_rra ( ) [static]

Get default RRAs.

They correspond to the following and assume a 10 second step size.

 "RRA:AVERAGE:0.5:1:720"    #  2 hours of 10 sec  averages
 "RRA:AVERAGE:0.5:3:1680"   # 12 hours of 30 sec  averages
 "RRA:AVERAGE:0.5:30:456"   #  1 day   of  5 min  averages
 "RRA:AVERAGE:0.5:180:412"  #  7 days  of 30 min  averages
 "RRA:AVERAGE:0.5:720:439"  #  4 weeks of  2 hour averages
 "RRA:AVERAGE:0.5:8640:402" #  1 year  of  1 day averages
 "RRA:MIN:0.5:1:720"
 "RRA:MIN:0.5:3:1680"
 "RRA:MIN:0.5:30:456"
 "RRA:MIN:0.5:180:412"
 "RRA:MIN:0.5:720:439"
 "RRA:MIN:0.5:8640:402"
 "RRA:MAX:0.5:1:720"
 "RRA:MAX:0.5:3:1680"
 "RRA:MAX:0.5:30:456"
 "RRA:MAX:0.5:180:412"
 "RRA:MAX:0.5:720:439"
 "RRA:MAX:0.5:8640:402"
Returns:
vector of RRDArchive representing the described RRAs.

Definition at line 366 of file rrd_descriptions.cpp.

References fawkes::RRDArchive::AVERAGE, fawkes::RRDArchive::MIN, and fawkes::RRDArchive::MAX.

const std::vector<RRDDataSource>& fawkes::RRDDefinition::get_ds ( ) const [inline]

Get data sources.

*

Returns:
data sources

Definition at line 152 of file rrd_descriptions.h.

Referenced by fawkes::RRDGraphDataDefinition::to_string(), and RRDThread::add_rrd().

const RRDDataSource& fawkes::RRDDefinition::get_ds ( size_t  i) const [inline]

Get specific data source.

Parameters:
iindex of data source
Returns:
data source

Definition at line 156 of file rrd_descriptions.h.

const char* fawkes::RRDDefinition::get_filename ( ) const [inline]

Get file name.

Returns:
file name

Definition at line 160 of file rrd_descriptions.h.

Referenced by fawkes::RRDGraphDataDefinition::to_string(), RRDThread::add_rrd(), and RRDThread::add_data().

const char* fawkes::RRDDefinition::get_name ( void  ) const [inline]
bool fawkes::RRDDefinition::get_recreate ( ) const [inline]

Check recreation flag.

Returns:
true if files should be overwritte, false otherwise

Definition at line 150 of file rrd_descriptions.h.

Referenced by RRDThread::add_rrd().

const std::vector<RRDArchive>& fawkes::RRDDefinition::get_rra ( ) const [inline]

Get RRD archives.

Returns:
RRD archive

Definition at line 158 of file rrd_descriptions.h.

Referenced by RRDThread::add_rrd().

unsigned int fawkes::RRDDefinition::get_step_sec ( ) const [inline]

Get step size in sec.

Returns:
step size

Definition at line 147 of file rrd_descriptions.h.

Referenced by RRDThread::add_rrd().

RRDDefinition & fawkes::RRDDefinition::operator= ( const RRDDefinition other)

Assignment operator.

Parameters:
otherother instance to copy from
Returns:
reference to this instance.

Definition at line 316 of file rrd_descriptions.cpp.

References fawkes::RRDManager::remove_rrd().

void fawkes::RRDDefinition::set_filename ( const char *  filename)

Set filename.

This can be done only once. Do not do this manually, rather let the RRDManager handle this!

Parameters:
filenamenew filename, should be absolute, otherwise considered relative to current working directory.

Definition at line 413 of file rrd_descriptions.cpp.

Referenced by RRDThread::add_rrd().

void fawkes::RRDDefinition::set_rrd_manager ( RRDManager rrd_manager)

Set RRD manager.

This can be done only once. Do not do this manually, rather let the RRDManager handle this! The RRD manager is used to unregister this RRD if it is deleted. This is a precaution to avoid dangling RRDs.

Parameters:
rrd_managerRRD manager to use

Definition at line 429 of file rrd_descriptions.cpp.

Referenced by RRDThread::add_rrd().


The documentation for this class was generated from the following files: