summaryrefslogtreecommitdiffstats
path: root/collectors/freeipmi.plugin
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/freeipmi.plugin')
-rw-r--r--collectors/freeipmi.plugin/README.md4
-rw-r--r--collectors/freeipmi.plugin/freeipmi_plugin.c37
2 files changed, 30 insertions, 11 deletions
diff --git a/collectors/freeipmi.plugin/README.md b/collectors/freeipmi.plugin/README.md
index 52945e3c6..02a61dd2f 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 bd3c533ca..e9702e785 100644
--- a/collectors/freeipmi.plugin/freeipmi_plugin.c
+++ b/collectors/freeipmi.plugin/freeipmi_plugin.c
@@ -26,8 +26,6 @@
#include <unistd.h>
#include <sys/time.h>
-#ifdef HAVE_FREEIPMI
-
#define IPMI_PARSE_DEVICE_LAN_STR "lan"
#define IPMI_PARSE_DEVICE_LAN_2_0_STR "lan_2_0"
#define IPMI_PARSE_DEVICE_LAN_2_0_STR2 "lan20"
@@ -1621,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) {
// ------------------------------------------------------------------------
@@ -1691,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"
@@ -1765,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];
@@ -1861,11 +1886,3 @@ int main (int argc, char **argv) {
if(now_monotonic_sec() - started_t > 14400) exit(0);
}
}
-
-#else // !HAVE_FREEIPMI
-
-int main(int argc, char **argv) {
- fatal("freeipmi.plugin is not compiled.");
-}
-
-#endif // !HAVE_FREEIPMI