Fawkes API  Fawkes Development Version
rrd_manager.h
00001 
00002 /***************************************************************************
00003  *  rrd_manager.h - Fawkes RRD manager interface
00004  *
00005  *  Created: Fri Dec 17 00:28:14 2010
00006  *  Copyright  2006-2010  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #ifndef __PLUGINS_RRD_ASPECT_RRD_MANAGER_H_
00025 #define __PLUGINS_RRD_ASPECT_RRD_MANAGER_H_
00026 
00027 #include <plugins/rrd/aspect/rrd_descriptions.h>
00028 #include <core/utils/rwlock_vector.h>
00029 
00030 namespace fawkes {
00031 #if 0 /* just to make Emacs auto-indent happy */
00032 }
00033 #endif
00034 
00035 
00036 /** @class RRDManager <plugins/rrd/aspect/rrd_manager.h>
00037  * Interface for a RRD connection creator.
00038  * @author Tim Niemueller
00039  */
00040 class RRDManager
00041 {
00042  public:
00043   /** Virtual empty destructor. */
00044   virtual ~RRDManager() {}
00045 
00046   /** Add RRD.
00047    * Add an RRD which can then be fed with data using add_data().
00048    * @param rrd_def RRD definition
00049    */
00050   virtual void add_rrd(RRDDefinition *rrd_def) = 0;
00051 
00052   /** Remove RRD.
00053    * Remove a RRD definition. This also removes all associated graphs.
00054    * @param rrd_def RRD definition
00055    */
00056   virtual void remove_rrd(RRDDefinition *rrd_def) = 0;
00057 
00058   /** Add graph.
00059    * Add a graph definition from which to generate graphs.
00060    * @param rrd_graph_def RRD graph definition
00061    */
00062   virtual void add_graph(RRDGraphDefinition *rrd_graph_def) = 0;
00063 
00064   /** Add data.
00065    * Add data to an RRF.
00066    * @param rrd_name name of the RRD to add data to
00067    * @param format format string. It must have the form TIMESTAMP|N:DATA,
00068    * where TIMESTAMP|N is either a timestamp (in seconds since the epoch), or
00069    * the letter N to use the current time. DATA is a concatenation of formats
00070    * according to man sprintf and concatenated by colons, e.g. 1:2:3:4.5.
00071    */
00072   virtual void add_data(const char *rrd_name, const char *format, ...) = 0;
00073 
00074   /** Get RRDs.
00075    * @return vector of all current RRD definitions.
00076    */
00077   virtual const RWLockVector<RRDDefinition *> &       get_rrds() const = 0;
00078 
00079   /** Get graphs.
00080    * @return vector of all current graph definitions.
00081    */
00082   virtual const RWLockVector<RRDGraphDefinition *> &  get_graphs() const = 0;
00083 
00084 };
00085 
00086 } // end namespace fawkes
00087 
00088 #endif