Commit aae74786 authored by Micha Mueller's avatar Micha Mueller
Browse files

Add printConfig to IPMI plugin

parent 059454c4
......@@ -82,11 +82,25 @@ void IPMIConfigurator::global(CFG_VAL config) {
ADD {
SETTING("SessionTimeout") {
_globalHost.sessionTimeout = stoi(val.second.data());
LOG(debug)<< " SessionTimeout " << _globalHost.sessionTimeout;
}
SETTING("RetransmissionTimeout") {
_globalHost.retransmissionTimeout = stoi(val.second.data());
LOG(debug) << " RetransmissionTimeout " << _globalHost.retransmissionTimeout;
}
}
}
void IPMIConfigurator::printConfiguratorConfig(LOG_LEVEL ll) {
LOG_VAR(ll) << " Session Timeout: " << _globalHost.sessionTimeout;
LOG_VAR(ll) << " Retransmission Timeout: " << _globalHost.retransmissionTimeout;
LOG_VAR(ll) << " Temporal write dir: " << _tempdir;
LOG_VAR(ll) << " Hosts:";
if (_sensorEntitys.size() != 0) {
for(auto e : _sensorEntitys) {
e->printConfig(ll);
}
} else {
LOG_VAR(ll) << " No hosts present!";
}
}
......@@ -38,6 +38,8 @@ protected:
void derivedSetGlobalSettings(const pluginSettings_t& pluginSettings) override { _tempdir = pluginSettings.tempdir; }
void printConfiguratorConfig(LOG_LEVEL ll) override;
private:
std::string _tempdir;
globalHost_t _globalHost;
......
......@@ -275,3 +275,21 @@ void IPMIHost::initializeStrand(boost::asio::io_service& io) {
_strand = new boost::asio::io_service::strand(io);
}
}
void IPMIHost::printConfig(LOG_LEVEL ll) {
LOG_VAR(ll) << " IPMIHost: " << _hostName;
LOG_VAR(ll) << " UserName: " << _userName;
#ifdef DEBUG
LOG_VAR(ll) << " Password: " << _password;
#else
LOG_VAR(ll) << " Password not shown";
#endif
LOG_VAR(ll) << " Cache: " << _cache;
LOG_VAR(ll) << " Auth: " << _auth;
LOG_VAR(ll) << " Priv: " << _priv;
LOG_VAR(ll) << " Cipher: " << _cipher;
LOG_VAR(ll) << " IPMI Version: " << _ipmiVersion;
LOG_VAR(ll) << " MQTT Part: " << _mqttPart;
LOG_VAR(ll) << " Session Timeout: " << _sessionTimeout;
LOG_VAR(ll) << " Retransmission Timeout: " << _retransmissionTimeout;
}
......@@ -63,6 +63,8 @@ public:
boost::asio::io_service::strand* getStrand() const { return _strand; }
uint64_t getDelayNextReadUntil() const { return _delayNextReadUntil; }
void printConfig(LOG_LEVEL ll);
private:
/* Open/close connection to BMC (sets/destroys _ipmiCtx) */
int connect();
......@@ -88,7 +90,7 @@ private:
uint32_t _sessionTimeout;
uint32_t _retransmissionTimeout;
boost::asio::io_service::strand* _strand;
boost::log::sources::severity_logger<boost::log::trivial::severity_level> lg;
LOGGER lg;
uint32_t _errorCount;
std::string _errorMsg;
volatile uint64_t _delayNextReadUntil;
......
......@@ -15,6 +15,7 @@
#include <boost/tokenizer.hpp>
#include <boost/regex.hpp>
#include <vector>
#include <sstream>
class IPMISensorBase: public SensorBase {
public:
......@@ -51,6 +52,14 @@ public:
const std::vector<uint8_t>& getSdrRecord() const { return _sdrRecord; }
double getFactor() const { return _factor; }
const std::vector<uint8_t>& getRawCmd() const { return _rawCmd; }
std::string getRawCmdString() const {
std::stringstream ss;
ss << "0x";
for (auto i : _rawCmd) {
ss << std::hex << i;
}
return ss.str();
}
uint8_t getLsb() const { return _lsb; }
uint8_t getMsb() const { return _msb; }
......@@ -70,6 +79,14 @@ public:
void setMsb(const std::string& msb) { _msb = stoi(msb); }
void setMsb(uint8_t msb) { _msb = msb; }
void printConfig(LOG_LEVEL ll, LOGGER& lg) {
LOG_VAR(ll) << " Record Id: " << _recordId;
LOG_VAR(ll) << " Factor: " << _factor;
LOG_VAR(ll) << " Raw Cmd: " << getRawCmdString();
LOG_VAR(ll) << " lsb: " << _lsb;
LOG_VAR(ll) << " msb: " << _msb;
}
protected:
uint16_t _recordId;
std::vector<uint8_t> _sdrRecord;
......
......@@ -113,3 +113,11 @@ void IPMISensorGroup::readAsync() {
}
_pendingTasks--;
}
void IPMISensorGroup::printConfig(LOG_LEVEL ll) {
if (_host) {
LOG_VAR(ll) << " Host: " << _host->getHostName();
} else {
LOG_VAR(ll) << " No Host set!";
}
}
......@@ -26,6 +26,8 @@ public:
void setHost(IPMIHost* host) { _host = host; }
const IPMIHost* const getHost() const { return _host; }
void printConfig(LOG_LEVEL ll) override;
private:
void read() override;
void readAsync() override;
......
Supports Markdown
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