Fawkes API
Fawkes Development Version
|
23 #include "rrd_example_thread.h"
25 #include <core/exceptions/system.h>
26 #include <plugins/rrd/aspect/rrd_manager.h>
27 #include <utils/misc/string_conversions.h>
28 #include <utils/system/file.h>
46 :
Thread(
"RRDExampleThread",
Thread::OPMODE_WAITFORWAKEUP),
59 std::vector<RRDDataSource> rrds;
60 rrds.push_back(
RRDDataSource(
"value", RRDDataSource::COUNTER));
64 std::vector<RRDGraphDataDefinition> defs;
65 std::vector<RRDGraphElement> els;
69 els.push_back(
RRDGraphLine(
"value", 1,
"FF0000",
"Value",
false));
70 els.push_back(
RRDGraphGPrint(
"value", RRDArchive::LAST,
"Current\\:%8.2lf %s"));
71 els.push_back(
RRDGraphGPrint(
"value", RRDArchive::AVERAGE,
"Average\\:%8.2lf %s"));
72 els.push_back(
RRDGraphGPrint(
"value", RRDArchive::MAX,
"Maximum\\:%8.2lf %s\\n"));
75 "testgraph", test_rrd_def_, -600, -10, 10,
"Test Value",
"Foo", 10,
false, defs, els);
93 if (rand() > RAND_MAX / 2)
95 if (loop_count_ == 10) {
101 "Adding data to %s failed, exception follows",
Class representing a graph definition.
virtual void add_graph(RRDGraphDefinition *rrd_graph_def)=0
Add graph.
virtual void loop()
Code to execute in the thread.
Print string inside graph.
RRDExampleThread()
Constructor.
Class to represent a RRD data source.
Thread aspect to use blocked timing.
const char * name() const
Get name of thread.
virtual void remove_rrd(RRDDefinition *rrd_def)=0
Remove RRD.
Represent data definition in graph arguments.
Logger * logger
This is the Logger member used to access the logger.
Fawkes library namespace.
virtual ~RRDExampleThread()
Destructor.
virtual void log_warn(const char *component, const char *format,...)=0
Log warning message.
virtual void finalize()
Finalize the thread.
const char * get_name() const
Get name.
virtual void add_data(const char *rrd_name, const char *format,...)=0
Add data.
RRDManager * rrd_manager
Manager class to access RRD features.
Thread class encapsulation of pthreads.
virtual void log_debug(const char *component, const char *format,...)=0
Log debug message.
virtual void add_rrd(RRDDefinition *rrd_def)=0
Add RRD.
virtual void init()
Initialize the thread.
Base class for exceptions in Fawkes.