Fawkes API
Fawkes Development Version
mongorrd_thread.h
1
2
/***************************************************************************
3
* mongorrd_thread.h - MongoDB RRD thread
4
*
5
* Created: Sat Jan 15 18:42:12 2011
6
* Copyright 2006-2011 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_MONGORRD_MONGORRD_THREAD_H_
24
#define _PLUGINS_MONGORRD_MONGORRD_THREAD_H_
25
26
#include <aspect/clock.h>
27
#include <aspect/configurable.h>
28
#include <aspect/logging.h>
29
#include <config/change_handler.h>
30
#include <core/threading/thread.h>
31
#include <plugins/mongodb/aspect/mongodb.h>
32
#include <plugins/rrd/aspect/rrd.h>
33
34
namespace
fawkes
{
35
class
TimeWait;
36
}
37
38
class
MongoRRDThread
:
public
fawkes::Thread
,
39
public
fawkes::LoggingAspect
,
40
public
fawkes::ConfigurableAspect
,
41
public
fawkes::ClockAspect
,
42
public
fawkes::MongoDBAspect
,
43
public
fawkes::RRDAspect
,
44
public
fawkes::ConfigurationChangeHandler
45
{
46
public
:
47
MongoRRDThread
();
48
virtual
~MongoRRDThread
();
49
50
virtual
void
init
();
51
virtual
void
loop
();
52
virtual
void
finalize
();
53
54
/** Stub to see name in backtrace for easier debugging. @see Thread::run() */
55
protected
:
56
virtual
void
57
run
()
58
{
59
Thread::run();
60
}
61
62
private
:
63
void
add_dbstats(
const
char
*path, std::string dbname);
64
void
remove_dbstats(
const
char
*path);
65
66
virtual
void
config_tag_changed(
const
char
*new_tag);
67
virtual
void
config_value_changed(
const
fawkes::Configuration::ValueIterator
*v);
68
virtual
void
config_comment_changed(
const
fawkes::Configuration::ValueIterator
*v);
69
virtual
void
config_value_erased(
const
char
*path);
70
71
private
:
72
fawkes::TimeWait
*timewait_;
73
74
fawkes::RRDDefinition
*opcounters_rrd_;
75
fawkes::RRDDefinition
*memory_rrd_;
76
fawkes::RRDDefinition
*indexes_rrd_;
77
fawkes::RRDDefinition
*locks_rrd_;
78
79
fawkes::RRDGraphDefinition
*opcounters_graph_;
80
fawkes::RRDGraphDefinition
*memory_graph_;
81
fawkes::RRDGraphDefinition
*indexes_graph_;
82
83
/// @cond INTERNALS
84
typedef
struct
85
{
86
std::string db_name;
87
std::string rrd_name;
88
std::string conf_path;
89
fawkes::RRDDefinition
* rrd;
90
fawkes::RRDGraphDefinition
*graph1;
91
fawkes::RRDGraphDefinition
*graph2;
92
fawkes::RRDGraphDefinition
*graph3;
93
} DbStatsInfo;
94
/// @endcond
95
96
typedef
std::map<std::string, DbStatsInfo> DbStatsMap;
97
DbStatsMap dbstats_;
98
};
99
100
#endif
fawkes::RRDGraphDefinition
Definition:
rrd_descriptions.h:468
fawkes::MongoDBAspect
Definition:
mongodb.h:41
fawkes::RRDAspect
Definition:
rrd.h:39
MongoRRDThread::~MongoRRDThread
virtual ~MongoRRDThread()
Destructor.
Definition:
mongorrd_thread.cpp:57
fawkes::ConfigurationChangeHandler
Definition:
change_handler.h:35
MongoRRDThread
Definition:
mongorrd_thread.h:37
MongoRRDThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition:
mongorrd_thread.h:56
fawkes::Configuration::ValueIterator
Definition:
config.h:75
MongoRRDThread::MongoRRDThread
MongoRRDThread()
Constructor.
Definition:
mongorrd_thread.cpp:48
fawkes
fawkes::LoggingAspect
Definition:
logging.h:36
MongoRRDThread::init
virtual void init()
Initialize the thread.
Definition:
mongorrd_thread.cpp:62
MongoRRDThread::loop
virtual void loop()
Code to execute in the thread.
Definition:
mongorrd_thread.cpp:413
fawkes::Thread
Definition:
thread.h:44
fawkes::TimeWait
Definition:
wait.h:36
fawkes::RRDDefinition
Definition:
rrd_descriptions.h:166
fawkes::ConfigurableAspect
Definition:
configurable.h:36
fawkes::ClockAspect
Definition:
clock.h:38
MongoRRDThread::finalize
virtual void finalize()
Finalize the thread.
Definition:
mongorrd_thread.cpp:248
src
plugins
mongodb
mongorrd_thread.h
Generated by
1.8.16