Fawkes API  Fawkes Development Version
fawkes::RRDDefinition Class Reference

RRD Definition. More...

#include <>>

Public Member Functions

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

Static Public Member Functions

static const std::vector< RRDArchiveget_default_rra ()
 Get default RRAs. More...
 

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

Definition at line 125 of file rrd_descriptions.h.

Constructor & Destructor Documentation

◆ RRDDefinition() [1/3]

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.

◆ RRDDefinition() [2/3]

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.

◆ RRDDefinition() [3/3]

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

Copy constructor.

Parameters
otherinstance to clone

Definition at line 303 of file rrd_descriptions.cpp.

◆ ~RRDDefinition()

fawkes::RRDDefinition::~RRDDefinition ( )

Destructor.

Definition at line 333 of file rrd_descriptions.cpp.

References fawkes::RRDManager::remove_rrd().

Member Function Documentation

◆ find_ds_index()

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().

◆ get_default_rra()

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::MAX, and fawkes::RRDArchive::MIN.

◆ get_ds() [1/2]

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 RRDThread::add_rrd(), and fawkes::RRDGraphDataDefinition::to_string().

◆ get_ds() [2/2]

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.

◆ get_filename()

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 RRDThread::add_data(), RRDThread::add_rrd(), and fawkes::RRDGraphDataDefinition::to_string().

◆ get_name()

const char* fawkes::RRDDefinition::get_name ( void  ) const
inline

◆ get_recreate()

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().

◆ get_rra()

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().

◆ get_step_sec()

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().

◆ operator=()

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().

◆ set_filename()

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().

◆ set_rrd_manager()

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: