Commit b871d684 authored by lu43jih's avatar lu43jih
Browse files

Merge branch 'master' of https://gitlab.lrz.de/dcdb/dcdbpusher

parents 7cfd562c 201f6e82
......@@ -299,12 +299,16 @@ Explanation of the values specific for the IPMI plugin:
| retransmissiontimeout | Retransmission timeout value for the IPMI-connection
| username | For the remote IPMI-connection login credentials are required
| password | For the remote IPMI-connection login credentials are required
| ipmiversion | IPMI version to use for LAN connections (1 or 2)
| cipher | Cipher to use for IPMI 2.0 LAN connections (currently supported: 0, 1, 2, 3, 6, 7, 8, 11, 12)
| cmd | One can define a raw IPMI-command (in hex-notation) to be sent. In this case also the start and stop fields for the response have to be defined. Alternatively, one can define the record-ID of the sensor (see below).
| start | Required if raw command is sent
| stop | Required if raw command is sent
| start | Offset where the wanted return value of an IPMI raw command starts at in the IPMI response<sup>[1](#ipmifn1)</sup>
| stop | Offset where the wanted return value of an IPMI raw command stops at in the IPMI response<sup>[1](#ipmifn1)</sup>
| recordId | Define the record-ID of the sensor to be read. One can look up the corresponding record-IDs for every sensor with the "ipmi-sensors" command line tool (ships with the freeipmi-library). Alternatively, one can define a raw IPMI-command (see above).
| factor | One can specify a factor to scale the read value before it is stored in the database (to adjust precision).
#### Footnotes <a name="ipmiFootnotes"></a>
<a name="ipmifn1">**1**</a>: &ensp; Use start > stop values if response is Little-endian (LSB first), use start < stop if response is Big-Endian (MSB first). Maximum length is 8 bytes.
## Perf-event <a name="perf"></a>
The Perfevent functionality is tasked with collecting data from the CPUs various performance counters (PMUs).
......
......@@ -48,6 +48,8 @@ void IPMIConfigurator::sensorEntity(IPMIHost& s, CFG_VAL config) {
ATTRIBUTE("username", setUserName);
ATTRIBUTE("password", setPassword);
ATTRIBUTE("mqttPart", setMqttPart);
ATTRIBUTE("cipher", setCipher);
ATTRIBUTE("ipmiVersion", setIpmiVersion);
}
}
......
......@@ -33,6 +33,8 @@ IPMIHost::IPMIHost() {
_cache = "";
_auth = IPMI_AUTHENTICATION_TYPE_MD5;
_priv = IPMI_PRIVILEGE_LEVEL_ADMIN;
_cipher = 3;
_ipmiVersion = 1;
_mqttPart = "";
_retransmissionTimeout = 0;
_sessionTimeout = 0;
......@@ -58,8 +60,14 @@ int IPMIHost::connect() {
}
int workaround_flags = 0;
int flags = 0;
if (ipmi_ctx_open_outofband(_ipmiCtx, _hostName.c_str(), _userName.c_str(), _password.c_str(), _auth, _priv, _sessionTimeout, _retransmissionTimeout, workaround_flags, flags) < 0) {
int flags = IPMI_FLAGS_DEFAULT;
int rc;
if (_ipmiVersion == 1) {
rc = ipmi_ctx_open_outofband(_ipmiCtx, _hostName.c_str(), _userName.c_str(), _password.c_str(), _auth, _priv, _sessionTimeout, _retransmissionTimeout, workaround_flags, flags);
} else {
rc = ipmi_ctx_open_outofband_2_0(_ipmiCtx, _hostName.c_str(), _userName.c_str(), _password.c_str(), NULL, 0, _priv, _cipher, _sessionTimeout, _retransmissionTimeout, workaround_flags, flags);
}
if (rc < 0) {
_errorMsg = "Error opening IPMI connection: " + std::string(ipmi_ctx_errormsg(_ipmiCtx));
ipmi_ctx_close(_ipmiCtx);
ipmi_ctx_destroy(_ipmiCtx);
......@@ -194,8 +202,14 @@ int64_t IPMIHost::sendRawCmd(const std::vector<uint8_t>& rawCmd,
_errorCount = 0;
int64_t val = 0;
for (i = start; i <= stop; i++) {
val |= ((int64_t) buf[i]) << (stop - i) * 8;
if (stop > start) {
for (i = start; i <= stop; i++) {
val |= ((int64_t) buf[i]) << (stop - i) * 8;
}
} else {
for (i = start; i >= stop; i--) {
val |= ((int64_t) buf[i]) << (i-stop) * 8;
}
}
return val;
......
......@@ -34,6 +34,8 @@ public:
void setPassword(const std::string& password) { _password = password; }
void setCache(const std::string& cacheDir) { _cache = cacheDir + ".ipmiPluginSdrCache." + _hostName; }
void setPriv(uint8_t priv) { _priv = priv; }
void setCipher(const std::string& cipher) { _cipher = stoi(cipher); }
void setIpmiVersion(const std::string& ipmiVersion) { _ipmiVersion = stoi(ipmiVersion); }
void setUserName(const std::string& userName) { _userName = userName; }
void setMqttPart(const std::string& mqttPart) {
_mqttPart = mqttPart;
......@@ -54,6 +56,8 @@ public:
const std::string& getPassword() const { return _password; }
const std::string& getCache() const { return _cache; }
uint8_t getPriv() const { return _priv; }
uint8_t getCipher() const { return _cipher; }
uint8_t getIpmiVersion() const { return _ipmiVersion; }
const std::string& getUserName() const { return _userName; }
const std::string& getMqttPart() const { return _mqttPart; }
boost::asio::io_service::strand* getStrand() const { return _strand; }
......@@ -78,6 +82,8 @@ private:
std::string _cache;
uint8_t _auth;
uint8_t _priv;
uint8_t _cipher;
uint8_t _ipmiVersion;
std::string _mqttPart;
uint32_t _sessionTimeout;
uint32_t _retransmissionTimeout;
......
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