summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--events/eventskeygen.py4
-rw-r--r--xlators/cluster/dht/src/dht-diskusage.c26
2 files changed, 26 insertions, 4 deletions
diff --git a/events/eventskeygen.py b/events/eventskeygen.py
index 23dfb478904..98c26dcbcb1 100644
--- a/events/eventskeygen.py
+++ b/events/eventskeygen.py
@@ -191,6 +191,10 @@ keys = (
#tier events
"EVENT_TIER_START",
"EVENT_TIER_START_FORCE",
+
+ #brick/inodes events
+ "EVENT_DHT_DISK_USAGE",
+ "EVENT_DHT_INODES_USAGE",
)
LAST_EVENT = "EVENT_LAST"
diff --git a/xlators/cluster/dht/src/dht-diskusage.c b/xlators/cluster/dht/src/dht-diskusage.c
index b1de9ff44aa..c2b9b2e37c4 100644
--- a/xlators/cluster/dht/src/dht-diskusage.c
+++ b/xlators/cluster/dht/src/dht-diskusage.c
@@ -18,6 +18,7 @@
#include "defaults.h"
#include <sys/time.h>
+#include "events.h"
int
@@ -221,10 +222,12 @@ gf_boolean_t
dht_is_subvol_filled (xlator_t *this, xlator_t *subvol)
{
int i = 0;
+ char vol_name[256];
dht_conf_t *conf = NULL;
gf_boolean_t subvol_filled_inodes = _gf_false;
gf_boolean_t subvol_filled_space = _gf_false;
gf_boolean_t is_subvol_filled = _gf_false;
+ double usage = 0;
conf = this->private;
@@ -259,23 +262,38 @@ dht_is_subvol_filled (xlator_t *this, xlator_t *subvol)
if (subvol_filled_space && conf->subvolume_status[i]) {
if (!(conf->du_stats[i].log++ % (GF_UNIVERSAL_ANSWER * 10))) {
+ usage = 100 - conf->du_stats[i].avail_percent;
+
gf_msg (this->name, GF_LOG_WARNING, 0,
DHT_MSG_SUBVOL_INSUFF_SPACE,
"disk space on subvolume '%s' is getting "
"full (%.2f %%), consider adding more bricks",
- subvol->name,
- (100 - conf->du_stats[i].avail_percent));
+ subvol->name, usage);
+
+ strncpy(vol_name, this->name, sizeof(vol_name));
+ vol_name[(strlen(this->name)-4)] = '\0';
+
+ gf_event(EVENT_DHT_DISK_USAGE,
+ "volume=%s;subvol=%s;usage=%.2f %%",
+ vol_name, subvol->name, usage);
}
}
if (subvol_filled_inodes && conf->subvolume_status[i]) {
if (!(conf->du_stats[i].log++ % (GF_UNIVERSAL_ANSWER * 10))) {
+ usage = 100 - conf->du_stats[i].avail_inodes;
gf_msg (this->name, GF_LOG_CRITICAL, 0,
DHT_MSG_SUBVOL_INSUFF_INODES,
"inodes on subvolume '%s' are at "
"(%.2f %%), consider adding more bricks",
- subvol->name,
- (100 - conf->du_stats[i].avail_inodes));
+ subvol->name, usage);
+
+ strncpy(vol_name, this->name, sizeof(vol_name));
+ vol_name[(strlen(this->name)-4)] = '\0';
+
+ gf_event(EVENT_DHT_INODES_USAGE,
+ "volume=%s;subvol=%s;usage=%.2f %%",
+ vol_name, subvol->name, usage);
}
}