Fawkes API Fawkes Development Version
rrd_thread.h
1
2/***************************************************************************
3 * rrd_thread.h - RRD thread
4 *
5 * Created: Fri Dec 17 00:32:48 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.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Library General Public License for more details.
19 *
20 * Read the full text in the LICENSE.GPL file in the doc directory.
21 */
22
23#ifndef _PLUGINS_RRD_RRD_THREAD_H_
24#define _PLUGINS_RRD_RRD_THREAD_H_
25
26#include <aspect/aspect_provider.h>
27#include <aspect/clock.h>
28#include <aspect/configurable.h>
29#include <aspect/logging.h>
30#include <core/threading/thread.h>
31#include <core/utils/rwlock_vector.h>
32#include <plugins/rrd/aspect/rrd_inifin.h>
33#include <plugins/rrd/aspect/rrd_manager.h>
34#include <utils/time/wait.h>
35
42{
43public:
44 RRDThread();
45 virtual ~RRDThread();
46
47 virtual void init();
48 virtual void loop();
49 virtual void finalize();
50
51 // for RRDManager
52 virtual void add_rrd(fawkes::RRDDefinition *rrd_def);
53 virtual void remove_rrd(fawkes::RRDDefinition *rrd_def);
54 virtual void add_graph(fawkes::RRDGraphDefinition *rrd_graph_def);
55
56 virtual void add_data(const char *rrd_name, const char *format, ...);
57
60
61 void generate_graphs();
62
63 /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
64protected:
65 virtual void
67 {
68 Thread::run();
69 }
70
71private:
72 fawkes::RRDAspectIniFin rrd_aspect_inifin_;
73
76
77 fawkes::TimeWait *time_wait_;
78 float cfg_graph_interval_;
79};
80
81#endif
RRD Thread.
Definition: rrd_thread.h:42
virtual void add_data(const char *rrd_name, const char *format,...)
Add data.
Definition: rrd_thread.cpp:225
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: rrd_thread.h:66
virtual void add_rrd(fawkes::RRDDefinition *rrd_def)
Add RRD.
Definition: rrd_thread.cpp:116
virtual ~RRDThread()
Destructor.
Definition: rrd_thread.cpp:57
virtual void remove_rrd(fawkes::RRDDefinition *rrd_def)
Remove RRD.
Definition: rrd_thread.cpp:176
void generate_graphs()
Generate all graphs.
Definition: rrd_thread.cpp:89
virtual void add_graph(fawkes::RRDGraphDefinition *rrd_graph_def)
Add graph.
Definition: rrd_thread.cpp:203
virtual void init()
Initialize the thread.
Definition: rrd_thread.cpp:62
RRDThread()
Constructor.
Definition: rrd_thread.cpp:48
virtual void loop()
Code to execute in the thread.
Definition: rrd_thread.cpp:80
virtual void finalize()
Finalize the thread.
Definition: rrd_thread.cpp:74
virtual const fawkes::RWLockVector< fawkes::RRDGraphDefinition * > & get_graphs() const
Get graphs.
Definition: rrd_thread.cpp:276
virtual const fawkes::RWLockVector< fawkes::RRDDefinition * > & get_rrds() const
Get RRDs.
Definition: rrd_thread.cpp:270
Thread aspect provide a new aspect.
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:34
Thread aspect to access configuration data.
Definition: configurable.h:33
Thread aspect to log output.
Definition: logging.h:33
RRDAspect initializer/finalizer.
Definition: rrd_inifin.h:36
Class representing a graph definition.
Interface for a RRD connection creator.
Definition: rrd_manager.h:37
Thread class encapsulation of pthreads.
Definition: thread.h:46
Time wait utility.
Definition: wait.h:33