Fawkes API  Fawkes Development Version
rrd_manager.h
1 
2 /***************************************************************************
3  * rrd_manager.h - Fawkes RRD manager interface
4  *
5  * Created: Fri Dec 17 00:28:14 2010
6  * Copyright 2006-2010 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #ifndef _PLUGINS_RRD_ASPECT_RRD_MANAGER_H_
25 #define _PLUGINS_RRD_ASPECT_RRD_MANAGER_H_
26 
27 #include <core/utils/rwlock_vector.h>
28 #include <plugins/rrd/aspect/rrd_descriptions.h>
29 
30 namespace fawkes {
31 
32 /** @class RRDManager <plugins/rrd/aspect/rrd_manager.h>
33  * Interface for a RRD connection creator.
34  * @author Tim Niemueller
35  */
37 {
38 public:
39  /** Virtual empty destructor. */
40  virtual ~RRDManager()
41  {
42  }
43 
44  /** Add RRD.
45  * Add an RRD which can then be fed with data using add_data().
46  * @param rrd_def RRD definition
47  */
48  virtual void add_rrd(RRDDefinition *rrd_def) = 0;
49 
50  /** Remove RRD.
51  * Remove a RRD definition. This also removes all associated graphs.
52  * @param rrd_def RRD definition
53  */
54  virtual void remove_rrd(RRDDefinition *rrd_def) = 0;
55 
56  /** Add graph.
57  * Add a graph definition from which to generate graphs.
58  * @param rrd_graph_def RRD graph definition
59  */
60  virtual void add_graph(RRDGraphDefinition *rrd_graph_def) = 0;
61 
62  /** Add data.
63  * Add data to an RRF.
64  * @param rrd_name name of the RRD to add data to
65  * @param format format string. It must have the form TIMESTAMP|N:DATA,
66  * where TIMESTAMP|N is either a timestamp (in seconds since the epoch), or
67  * the letter N to use the current time. DATA is a concatenation of formats
68  * according to man sprintf and concatenated by colons, e.g. 1:2:3:4.5.
69  */
70  virtual void add_data(const char *rrd_name, const char *format, ...) = 0;
71 
72  /** Get RRDs.
73  * @return vector of all current RRD definitions.
74  */
75  virtual const RWLockVector<RRDDefinition *> &get_rrds() const = 0;
76 
77  /** Get graphs.
78  * @return vector of all current graph definitions.
79  */
80  virtual const RWLockVector<RRDGraphDefinition *> &get_graphs() const = 0;
81 };
82 
83 } // end namespace fawkes
84 
85 #endif
fawkes::RRDGraphDefinition
Class representing a graph definition.
Definition: rrd_descriptions.h:465
fawkes::RRDManager::add_graph
virtual void add_graph(RRDGraphDefinition *rrd_graph_def)=0
Add graph.
fawkes::RRDManager::get_rrds
virtual const RWLockVector< RRDDefinition * > & get_rrds() const =0
Get RRDs.
fawkes::RRDManager::get_graphs
virtual const RWLockVector< RRDGraphDefinition * > & get_graphs() const =0
Get graphs.
fawkes::RWLockVector
Vector with a lock.
Definition: rwlock_vector.h:36
fawkes::RRDManager::remove_rrd
virtual void remove_rrd(RRDDefinition *rrd_def)=0
Remove RRD.
fawkes
Fawkes library namespace.
fawkes::RRDManager
Interface for a RRD connection creator.
Definition: rrd_manager.h:37
fawkes::RRDManager::add_data
virtual void add_data(const char *rrd_name, const char *format,...)=0
Add data.
fawkes::RRDManager::~RRDManager
virtual ~RRDManager()
Virtual empty destructor.
Definition: rrd_manager.h:40
fawkes::RRDDefinition
RRD Definition.
Definition: rrd_descriptions.h:163
fawkes::RRDManager::add_rrd
virtual void add_rrd(RRDDefinition *rrd_def)=0
Add RRD.