In January 2021 we will introduce a 10 GB quota for project repositories. Higher limits for individual projects will be available on request. Please see https://doku.lrz.de/display/PUBLIC/GitLab for more information.

Commit 01ce2ef0 authored by Carla Guillen Carias's avatar Carla Guillen Carias

Completing todos (mainly try catch statements) and extending the configuration of persystsql

parent 2fc4a776
......@@ -71,40 +71,68 @@ void PerSystSqlConfigurator::sensorBase(AggregatorSensorBase& s, CFG_VAL config)
void PerSystSqlConfigurator::operatorAttributes(PerSystSqlOperator& op, CFG_VAL config) {
BOOST_FOREACH(boost::property_tree::iptree::value_type &val, config) {
if (boost::iequals(val.first, "number_quantiles")) {
unsigned int num_quantiles = std::stoul(val.second.data());
op.setNumberOfEvenQuantiles(num_quantiles);
try {
unsigned int num_quantiles = std::stoul(val.second.data());
op.setNumberOfEvenQuantiles(num_quantiles);
} catch (const std::exception &e) {
LOG(error) << " Error parsing number_quantiles \"" << val.second.data() << "\": " << e.what();
}
} else if (boost::iequals(val.first, "go_back_ms")) {
auto go_back_ms = std::stoi(val.second.data());
op.setGoBackInMs(go_back_ms);
try {
auto go_back_ms = std::stoi(val.second.data());
op.setGoBackInMs(go_back_ms);
} catch (const std::exception &e) {
LOG(error) << " Error parsing go_back_ms \"" << val.second.data() << "\": " << e.what();
}
} else if (boost::iequals(val.first, "severity_threshold")){
double threshold = std::stod(val.second.data());
op.setSeverityThreshold(threshold);
try {
double threshold = std::stod(val.second.data());
op.setSeverityThreshold(threshold);
} catch (const std::exception &e) {
LOG(error) << " Error parsing severity_threshold \"" << val.second.data() << "\": " << e.what();
}
} else if (boost::iequals(val.first, "severity_exponent")){
double exponent = std::stod(val.second.data());
op.setSeverityExponent(exponent);
try {
double exponent = std::stod(val.second.data());
op.setSeverityExponent(exponent);
} catch (const std::exception &e) {
LOG(error) << " Error parsing severity_exponent \"" << val.second.data() << "\": " << e.what();
}
} else if (boost::iequals(val.first, "severity_formula")){
std::string formula = val.second.data();
if(formula == "formula1"){
if(formula == "formula1" || formula == "FORMULA1"){
op.setSeverityFormula(PerSystSqlOperator::FORMULA1);
} else if (formula == "formula2") {
} else if (formula == "formula2" || formula == "FORMULA2") {
op.setSeverityFormula(PerSystSqlOperator::FORMULA2);
} else if (formula == "formula3") {
} else if (formula == "formula3" || formula == "FORMULA3") {
op.setSeverityFormula(PerSystSqlOperator::FORMULA3);
} else if (formula == "memory_formula"){
} else if (formula == "memory_formula" || formula == "MEMORY_FORMULA"){
op.setSeverityFormula(PerSystSqlOperator::MEMORY_FORMULA);
} else {
LOG(error) << "Unrecognized/unsupported severity formula: " << formula;
}
} else if (boost::iequals(val.first, "severity_max_memory")){
auto max_memory = std::stof(val.second.data());
op.setSeverityMaxMemory(max_memory);
try {
auto max_memory = std::stof(val.second.data());
op.setSeverityMaxMemory(max_memory);
} catch (const std::exception &e) {
LOG(error) << " Error parsing severity_max_memory \"" << val.second.data() << "\": " << e.what();
}
} else if (boost::iequals(val.first, "backend")) {
if(val.second.data() == "cassandra") {
op.setBackend(PerSystSqlOperator::CASSANDRA);
} else if(val.second.data() == "mariadb") {
op.setBackend(PerSystSqlOperator::MARIADB);
} else {
LOG(error) << " Unrecognized/unsupported backend \"" << val.second.data();
}
} else if(boost::iequals(val.first, "property_id")){
auto property_id = std::stoi(val.second.data());
op.setPropertyId(property_id);
} else if(boost::iequals(val.first, "property_id")){
try {
auto property_id = std::stoi(val.second.data());
op.setPropertyId(property_id);
} catch (const std::exception &e) {
LOG(error) << " Error parsing property_id \"" << val.second.data() << "\": " << e.what();
}
} else if (boost::iequals(val.first, "mariadb_host")) {
op.setMariaDBHost(val.second.data());
} else if (boost::iequals(val.first, "mariadb_user")){
......@@ -114,8 +142,12 @@ void PerSystSqlConfigurator::operatorAttributes(PerSystSqlOperator& op, CFG_VAL
} else if (boost::iequals(val.first, "mariadb_database_name")){
op.setMariaDBDatabaseName(val.second.data());
} else if (boost::iequals(val.first, "mariadb_port")){
int port = std::stoi(val.second.data());
op.setMariaDBPort(port);
try {
int port = std::stoi(val.second.data());
op.setMariaDBPort(port);
} catch (const std::exception &e) {
LOG(error) << " Error parsing mariadb_port \"" << val.second.data() << "\": " << e.what();
}
} else if (boost::iequals(val.first, "mariadb_rotation")){
auto found = _rotation_map.find(val.second.data());
if (found != _rotation_map.end()){
......@@ -124,8 +156,12 @@ void PerSystSqlConfigurator::operatorAttributes(PerSystSqlOperator& op, CFG_VAL
LOG(error) << " Rotation strategy (" << val.second.data() << ") not found.";
}
} else if (boost::iequals(val.first, "mariadb_every_x_days")){
unsigned int every_x_days = std::stoi(val.second.data());
op.setMariaDBEveryXDays(every_x_days);
try {
unsigned int every_x_days = std::stoi(val.second.data());
op.setMariaDBEveryXDays(every_x_days);
} catch (const std::exception &e) {
LOG(error) << " Error parsing mariadb_every_x_days \"" << val.second.data() << "\": " << e.what();
}
}
}
}
......
......@@ -157,11 +157,19 @@ void SMUCNGPerfConfigurator::operatorAttributes(SMUCNGPerfOperator& op, CFG_VAL
BOOST_FOREACH(boost::property_tree::iptree::value_type &val, config)
{
if (boost::iequals(val.first, "measuring_interval")){
auto measurementInterval_s = std::stod(val.second.data())/1000.0; //miliseconds to seconds
op.setMeasuringInterval(measurementInterval_s);
try {
auto measurementInterval_s = std::stod(val.second.data())/1000.0; //miliseconds to seconds
op.setMeasuringInterval(measurementInterval_s);
} catch (const std::exception &e) {
LOG(error) << " Error parsing measuring_interval \"" << val.second.data() << "\": " << e.what();
}
} else if(boost::iequals(val.first, "go_back_ms")) {
auto go_back_ms = std::stod(val.second.data());
op.setGoBackMs(go_back_ms);
try {
auto go_back_ms = std::stod(val.second.data());
op.setGoBackMs(go_back_ms);
} catch (const std::exception &e) {
LOG(error) << " Error parsing go_back_ms \"" << val.second.data() << "\": " << e.what();
}
}
}
_metricToPosition.clear();
......
......@@ -38,9 +38,12 @@ MSRConfigurator::~MSRConfigurator() {}
void MSRConfigurator::sensorBase(MSRSensorBase &s, CFG_VAL config) {
ADD {
if (boost::iequals(val.first, "metric")) {
//TODO try catch...
uint64_t metric = std::stoull(val.second.data(), nullptr, 16);
s.setMetric(metric);
try {
uint64_t metric = std::stoull(val.second.data(), nullptr, 16);
s.setMetric(metric);
} catch (const std::exception &e) {
LOG(error) << " Error parsing metric \"" << val.second.data() << "\": " << e.what();
}
}
}
}
......@@ -53,8 +56,12 @@ void MSRConfigurator::sensorGroup(MSRSensorGroup &s, CFG_VAL config) {
s.addCpu(static_cast<unsigned int>(cpu));
}
} else if (boost::iequals(val.first, "htVal")) {
unsigned int htVal = std::stoul(val.second.data());
s.setHtAggregation(htVal);
try {
unsigned int htVal = std::stoul(val.second.data());
s.setHtAggregation(htVal);
} catch (const std::exception &e) {
LOG(error) << " Error parsing htVal \"" << val.second.data() << "\": " << e.what();
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment