aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/stats/functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/stats/functions.c')
-rw-r--r--src/plugins/stats/functions.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/plugins/stats/functions.c b/src/plugins/stats/functions.c
index ffb99733..488a8410 100644
--- a/src/plugins/stats/functions.c
+++ b/src/plugins/stats/functions.c
@@ -140,6 +140,27 @@ static int getCPULoadStat(const void * closure,
140 return OK; 140 return OK;
141} 141}
142 142
143static int getQuotaStat(const void * closure,
144 gfloat ** data) {
145 long long allowed;
146 long long have;
147
148 if (OK != getStatValue(&allowed,
149 NULL,
150 NULL,
151 "# bytes allowed in datastore"))
152 return SYSERR;
153 if (allowed == 0)
154 return SYSERR;
155 if (OK != getStatValue(&have,
156 NULL,
157 NULL,
158 "# bytes in datastore"))
159 return SYSERR;
160 data[0][0] = ((gfloat) have) / allowed;
161 return OK;
162}
163
143static int getTrafficRecvStats(const void * closure, 164static int getTrafficRecvStats(const void * closure,
144 gfloat ** data) { 165 gfloat ** data) {
145 long long total; 166 long long total;
@@ -427,7 +448,7 @@ static void updateStatValues(void * unused) {
427 448
428 449
429StatEntry stats[] = { 450StatEntry stats[] = {
430 { 451 {
431 gettext_noop("Connectivity"), 452 gettext_noop("Connectivity"),
432 gettext_noop("# connected nodes (100% = connection table size)"), 453 gettext_noop("# connected nodes (100% = connection table size)"),
433 &getConnectedNodesStat, 454 &getConnectedNodesStat,
@@ -444,6 +465,14 @@ StatEntry stats[] = {
444 NO, 465 NO,
445 }, 466 },
446 { 467 {
468 gettext_noop("Datastore capacity"),
469 gettext_noop("Data in datastore (in percent of allowed quota)"),
470 &getQuotaStat,
471 NULL,
472 1,
473 NO,
474 },
475 {
447 gettext_noop("Inbound Traffic"), 476 gettext_noop("Inbound Traffic"),
448 gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos (blue), other (gray)"), 477 gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos (blue), other (gray)"),
449 &getTrafficRecvStats, 478 &getTrafficRecvStats,