summaryrefslogtreecommitdiffstats
path: root/collectors
diff options
context:
space:
mode:
authorVladimir Kobal <vlad@prokk.net>2021-03-03 16:02:53 +0200
committerGitHub <noreply@github.com>2021-03-03 16:02:53 +0200
commitd127d2f6818a6ac96be0d7954d63a882969e76c6 (patch)
tree7fb1ee8b92d871fb62d701b75d31098530f31ef7 /collectors
parent9b48ae8690586d8fdba9c7e482bd4afe89461d36 (diff)
Add noauthcodecheck workaround flag to the freeipmi plugin (#10701)
Diffstat (limited to 'collectors')
-rw-r--r--collectors/freeipmi.plugin/README.md4
-rw-r--r--collectors/freeipmi.plugin/freeipmi_plugin.c27
2 files changed, 30 insertions, 1 deletions
diff --git a/collectors/freeipmi.plugin/README.md b/collectors/freeipmi.plugin/README.md
index 52945e3c62..02a61dd2f7 100644
--- a/collectors/freeipmi.plugin/README.md
+++ b/collectors/freeipmi.plugin/README.md
@@ -45,7 +45,7 @@ The plugin does a speed test when it starts, to find out the duration needed by
The plugin supports a few options. To see them, run:
-```sh
+```text
# /usr/libexec/netdata/plugins.d/freeipmi.plugin -h
netdata freeipmi.plugin 1.8.0-546-g72ce5d6b_rolling
@@ -72,6 +72,8 @@ The plugin supports a few options. To see them, run:
password PASS connect to remote IPMI host
default: local IPMI processor
+ noauthcodecheck don't check the authentication codes returned
+
driver-type IPMIDRIVER
Specify the driver type to use instead of doing an auto selection.
The currently available outofband drivers are LAN and LAN_2_0,
diff --git a/collectors/freeipmi.plugin/freeipmi_plugin.c b/collectors/freeipmi.plugin/freeipmi_plugin.c
index 8229f55c1b..e9702e785e 100644
--- a/collectors/freeipmi.plugin/freeipmi_plugin.c
+++ b/collectors/freeipmi.plugin/freeipmi_plugin.c
@@ -1619,6 +1619,14 @@ int parse_outofband_driver_type (const char *str)
return (-1);
}
+int host_is_local(const char *host)
+{
+ if (host && (!strcmp(host, "localhost") || !strcmp(host, "127.0.0.1") || !strcmp(host, "::1")))
+ return (1);
+
+ return (0);
+}
+
int main (int argc, char **argv) {
// ------------------------------------------------------------------------
@@ -1689,6 +1697,8 @@ int main (int argc, char **argv) {
" password PASS connect to remote IPMI host\n"
" default: local IPMI processor\n"
"\n"
+ " noauthcodecheck don't check the authentication codes returned\n"
+ "\n"
" driver-type IPMIDRIVER\n"
" Specify the driver type to use instead of doing an auto selection. \n"
" The currently available outofband drivers are LAN and LAN_2_0,\n"
@@ -1763,6 +1773,23 @@ int main (int argc, char **argv) {
if(debug) fprintf(stderr, "freeipmi.plugin: inband driver type set to '%d'\n", driver_type);
}
continue;
+ } else if (i < argc && strcmp("noauthcodecheck", argv[i]) == 0) {
+ if (!hostname || host_is_local(hostname)) {
+ if (debug)
+ fprintf(
+ stderr,
+ "freeipmi.plugin: noauthcodecheck workaround flag is ignored for inband configuration\n");
+ } else if (protocol_version < 0 || protocol_version == IPMI_MONITORING_PROTOCOL_VERSION_1_5) {
+ workaround_flags |= IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_1_5_NO_AUTH_CODE_CHECK;
+ if (debug)
+ fprintf(stderr, "freeipmi.plugin: noauthcodecheck workaround flag enabled\n");
+ } else {
+ if (debug)
+ fprintf(
+ stderr,
+ "freeipmi.plugin: noauthcodecheck workaround flag is ignored for protocol version 2.0\n");
+ }
+ continue;
}
else if(i < argc && strcmp("sdr-cache-dir", argv[i]) == 0) {
sdr_cache_directory = argv[++i];