7 #ifndef __GANGLIA_METRIC__
8 #define __GANGLIA_METRIC__ 1
10 #include "fhiclcpp/fwd.h"
11 #include "artdaq-utilities/Plugins/MetricMacros.hh"
25 std::string configFile_;
36 , configFile_(pset.get<std::string>(
"configFile",
"/etc/ganglia/gmond.conf"))
37 , group_(pset.get<std::string>(
"group",
"ARTDAQ"))
38 , cluster_(pset.get<std::string>(
"cluster",
""))
45 MetricPlugin::stopMetrics();
53 std::string
getLibName()
const override {
return "ganglia"; }
69 void sendMetric_(
const std::string& name,
const std::string& value,
const std::string& unit)
override
72 unit.c_str(),
"both", 15, 0, group_.c_str(), cluster_.c_str(),
"",
"");
81 void sendMetric_(
const std::string& name,
const int& value,
const std::string& unit)
override
83 send_gmetric(name.c_str(), std::to_string(value).c_str(),
84 "int32", unit.c_str(),
"both", 15, 0, group_.c_str(), cluster_.c_str(),
"",
"");
93 void sendMetric_(
const std::string& name,
const double& value,
const std::string& unit)
override
95 send_gmetric(name.c_str(), std::to_string(value).c_str(),
96 "double", unit.c_str(),
"both", 15, 0, group_.c_str(), cluster_.c_str(),
"",
"");
105 void sendMetric_(
const std::string& name,
const float& value,
const std::string& unit)
override
107 send_gmetric(name.c_str(), std::to_string(value).c_str(),
108 "float", unit.c_str(),
"both", 15, 0, group_.c_str(), cluster_.c_str(),
"",
"");
117 void sendMetric_(
const std::string& name,
const unsigned long int& value,
const std::string& unit)
override
119 send_gmetric(name.c_str(), std::to_string(value).c_str(),
120 "uint32", unit.c_str(),
"both", 15, 0, group_.c_str(), cluster_.c_str(),
"",
"");
127 #endif //End ifndef __GANGLIA_METRIC__
std::string getLibName() const override
Gets the unique library name of this plugin.
void sendMetric_(const std::string &name, const double &value, const std::string &unit) override
Send a double metric to Ganglia.
int init_gmetric(const char *conf)
Initialize Ganglia.
void stopMetrics_() override
Ganglia does not need any specific action on stop.
void destroy_gmetric()
Close connection to gmond.
void sendMetric_(const std::string &name, const float &value, const std::string &unit) override
Send a float metric to Ganglia.
GangliaMetric(fhicl::ParameterSet const &pset, std::string const &app_name)
Construct an instance of the Ganglia metric.
int send_gmetric(const char *name, const char *value, const char *type, const char *units, const char *slope, int tmax, int dmax, const char *group, const char *cluster, const char *desc, const char *title)
Send a metric to gmond.
void sendMetric_(const std::string &name, const std::string &value, const std::string &unit) override
Send a string metric to Ganglia.
void sendMetric_(const std::string &name, const int &value, const std::string &unit) override
Send a integer metric to Ganglia (truncated to int32)
An instance of the MetricPlugin class that sends metric data to Ganglia.
void startMetrics_() override
Ganglia does not need any specific action on start.
void sendMetric_(const std::string &name, const unsigned long int &value, const std::string &unit) override
Send an unsigned long metric to Ganglia (truncated to uint32)