summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c9df8a2)
raw | patch | inline | side by side (parent: c9df8a2)
author | Pavel Rochnyack <pavel2000@ngs.ru> | |
Sun, 8 Oct 2017 06:41:29 +0000 (13:41 +0700) | ||
committer | Pavel Rochnyack <pavel2000@ngs.ru> | |
Mon, 9 Oct 2017 06:01:36 +0000 (13:01 +0700) |
src/collectd.conf.in | patch | blob | history | |
src/collectd.conf.pod | patch | blob | history | |
src/ipmi.c | patch | blob | history |
diff --git a/src/collectd.conf.in b/src/collectd.conf.in
index b229f019ef8ebdf29ce49e7d1f844049175edfd9..5f58a6e97d9f11a1b022bb60bdaa970bef107559 100644 (file)
--- a/src/collectd.conf.in
+++ b/src/collectd.conf.in
# NotifySensorAdd false
# NotifySensorRemove true
# NotifySensorNotPresent false
+# NotifyIPMIConnectionState false
# SELEnabled false
# SELClearEvent false
# </Instance>
# NotifySensorAdd false
# NotifySensorRemove true
# NotifySensorNotPresent false
+# NotifyIPMIConnectionState false
# SELEnabled false
# SELClearEvent false
# </Instance>
diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod
index 746829c43cd23077555aaea6a40a0ef64f253a98..53e15387dfd5ca69eb40fb329de7f2a864d98cd4 100644 (file)
--- a/src/collectd.conf.pod
+++ b/src/collectd.conf.pod
If you have for example dual power supply and one of them is (un)plugged then
a notification is sent.
+=item B<NotifyIPMIConnectionState> I<true>|I<false>
+
+If a IPMI connection state changes after initialization time of a minute
+a notification is sent. Defaults to B<false>.
+
=item B<SELEnabled> I<true>|I<false>
If system event log (SEL) is enabled, plugin will listen for sensor threshold
diff --git a/src/ipmi.c b/src/ipmi.c
index 7b22bc26b8ea1c8f233a663a5b99e8f78d2c39f6..32d6e510a836f44d01ab10d51f5ca719334a5f5f 100644 (file)
--- a/src/ipmi.c
+++ b/src/ipmi.c
_Bool notify_add;
_Bool notify_remove;
_Bool notify_notpresent;
+ _Bool notify_conn;
_Bool sel_enabled;
_Bool sel_clear_event;
c_ipmi_error(st, "domain_connection_change_handler", err);
if (!still_connected) {
+
+ if (st->notify_conn && st->connected && st->init_in_progress == 0) {
+ notification_t n = {NOTIF_FAILURE, cdtime(), "", "", "ipmi", "", "", "",
+ NULL};
+
+ sstrncpy(n.host, (st->host != NULL) ? st->host : hostname_g,
+ sizeof(n.host));
+ sstrncpy(n.message, "IPMI connection lost", sizeof(n.plugin));
+
+ plugin_dispatch_notification(&n);
+ }
+
st->connected = 0;
return;
}
+ if (st->notify_conn && !st->connected && st->init_in_progress == 0) {
+ notification_t n = {NOTIF_OKAY, cdtime(), "", "", "ipmi", "", "", "", NULL};
+
+ sstrncpy(n.host, (st->host != NULL) ? st->host : hostname_g,
+ sizeof(n.host));
+ sstrncpy(n.message, "IPMI connection restored", sizeof(n.plugin));
+
+ plugin_dispatch_notification(&n);
+ }
+
st->connected = 1;
int status = ipmi_domain_add_entity_update_handler(
ignorelist_set_invert(st->ignorelist, /* invert = */ 0);
else
ignorelist_set_invert(st->ignorelist, /* invert = */ 1);
+ } else if (strcasecmp("NotifyIPMIConnectionState", child->key) == 0) {
+ if (ci->values[0].value.boolean)
+ st->notify_conn = 1;
} else if (strcasecmp("NotifySensorAdd", child->key) == 0) {
if (ci->values[0].value.boolean)
st->notify_add = 1;