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.c32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/plugins/stats/functions.c b/src/plugins/stats/functions.c
index 488a8410..08bb125c 100644
--- a/src/plugins/stats/functions.c
+++ b/src/plugins/stats/functions.c
@@ -168,11 +168,13 @@ static int getTrafficRecvStats(const void * closure,
168 long long content; 168 long long content;
169 long long queries; 169 long long queries;
170 long long hellos; 170 long long hellos;
171 long long rlimit;
171 long long ltotal; 172 long long ltotal;
172 long long lnoise; 173 long long lnoise;
173 long long lcontent; 174 long long lcontent;
174 long long lqueries; 175 long long lqueries;
175 long long lhellos; 176 long long lhellos;
177 long long lrlimit;
176 cron_t dtime; 178 cron_t dtime;
177 char * buffer; 179 char * buffer;
178 180
@@ -220,6 +222,13 @@ static int getTrafficRecvStats(const void * closure,
220 queries = 0; 222 queries = 0;
221 lqueries = 0; 223 lqueries = 0;
222 } 224 }
225 if (OK != getStatValue(&rlimit,
226 &lrlimit,
227 NULL,
228 "# total advertised bytes per minute received limit")) {
229 rlimit = 0;
230 lrlimit = 0;
231 }
223 FREE(buffer); 232 FREE(buffer);
224 if (banddown == 0) 233 if (banddown == 0)
225 return SYSERR; 234 return SYSERR;
@@ -235,6 +244,7 @@ static int getTrafficRecvStats(const void * closure,
235 data[0][2] = 0.0; 244 data[0][2] = 0.0;
236 data[0][3] = 0.0; 245 data[0][3] = 0.0;
237 data[0][4] = 0.0; 246 data[0][4] = 0.0;
247 data[0][5] = 0.0;
238 return OK; 248 return OK;
239 } 249 }
240 data[0][0] = ((gfloat) noise) / (banddown * dtime / cronSECONDS); /* red */ 250 data[0][0] = ((gfloat) noise) / (banddown * dtime / cronSECONDS); /* red */
@@ -242,6 +252,7 @@ static int getTrafficRecvStats(const void * closure,
242 data[0][2] = ((gfloat)(queries+content+noise)) / (banddown * dtime / cronSECONDS); /* yellow */ 252 data[0][2] = ((gfloat)(queries+content+noise)) / (banddown * dtime / cronSECONDS); /* yellow */
243 data[0][3] = ((gfloat)(queries+content+noise+hellos)) / (banddown * dtime / cronSECONDS); /* blue */ 253 data[0][3] = ((gfloat)(queries+content+noise+hellos)) / (banddown * dtime / cronSECONDS); /* blue */
244 data[0][4] = ((gfloat) total) / (banddown * dtime / cronSECONDS); /* gray */ 254 data[0][4] = ((gfloat) total) / (banddown * dtime / cronSECONDS); /* gray */
255 data[0][5] = ((gfloat) rlimit) / (banddown * dtime / cronSECONDS); /* magenta */
245#if 0 256#if 0
246 printf("I: %f %f %f %f\n", 257 printf("I: %f %f %f %f\n",
247 data[0][0], 258 data[0][0],
@@ -258,11 +269,13 @@ static int getTrafficSendStats(const void * closure,
258 long long content; 269 long long content;
259 long long queries; 270 long long queries;
260 long long hellos; 271 long long hellos;
272 long long slimit;
261 long long ltotal; 273 long long ltotal;
262 long long lnoise; 274 long long lnoise;
263 long long lcontent; 275 long long lcontent;
264 long long lqueries; 276 long long lqueries;
265 long long lhellos; 277 long long lhellos;
278 long long lslimit;
266 cron_t dtime; 279 cron_t dtime;
267 char * buffer; 280 char * buffer;
268 281
@@ -310,6 +323,13 @@ static int getTrafficSendStats(const void * closure,
310 queries = 0; 323 queries = 0;
311 lqueries = 0; 324 lqueries = 0;
312 } 325 }
326 if (OK != getStatValue(&slimit,
327 &lslimit,
328 NULL,
329 "# total allowed bytes per minute transmission limit")) {
330 slimit = 0;
331 lslimit = 0;
332 }
313 FREE(buffer); 333 FREE(buffer);
314 if (bandup == 0) 334 if (bandup == 0)
315 return SYSERR; 335 return SYSERR;
@@ -324,13 +344,15 @@ static int getTrafficSendStats(const void * closure,
324 data[0][2] = 0.0; 344 data[0][2] = 0.0;
325 data[0][3] = 0.0; 345 data[0][3] = 0.0;
326 data[0][4] = 0.0; 346 data[0][4] = 0.0;
347 data[0][5] = 0.0;
327 return OK; 348 return OK;
328 } 349 }
329 data[0][0] = ((gfloat) noise) / (bandup * dtime / cronSECONDS); /* red */ 350 data[0][0] = ((gfloat) noise) / (bandup * dtime / cronSECONDS); /* red */
330 data[0][1] = ((gfloat) (noise + content)) / (bandup*dtime / cronSECONDS); /* green */ 351 data[0][1] = ((gfloat) (noise + content)) / (bandup*dtime / cronSECONDS); /* green */
331 data[0][2] = ((gfloat) (noise + content + queries)) / (bandup*dtime / cronSECONDS); /* yellow */ 352 data[0][2] = ((gfloat) (noise + content + queries)) / (bandup*dtime / cronSECONDS); /* yellow */
332 data[0][3] = ((gfloat) (noise + content + queries + hellos)) / (bandup*dtime / cronSECONDS); /* blue */ 353 data[0][3] = ((gfloat) (noise + content + queries + hellos)) / (bandup*dtime / cronSECONDS); /* blue */
333 data[0][4] = ((gfloat) total) / (bandup*dtime / cronSECONDS); /* blue */ 354 data[0][4] = ((gfloat) total) / (bandup*dtime / cronSECONDS); /* grey */
355 data[0][5] = ((gfloat) slimit) / (bandup*dtime / cronSECONDS); /* magenta */
334#if 0 356#if 0
335 printf("O: %f %f %f %f\n", 357 printf("O: %f %f %f %f\n",
336 data[0][0], 358 data[0][0],
@@ -474,19 +496,19 @@ StatEntry stats[] = {
474 }, 496 },
475 { 497 {
476 gettext_noop("Inbound Traffic"), 498 gettext_noop("Inbound Traffic"),
477 gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos (blue), other (gray)"), 499 gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos (blue), other (gray), limit (magenta)"),
478 &getTrafficRecvStats, 500 &getTrafficRecvStats,
479 NULL, 501 NULL,
502 6,
480 5, 503 5,
481 YES,
482 }, 504 },
483 { 505 {
484 gettext_noop("Outbound Traffic"), 506 gettext_noop("Outbound Traffic"),
485 gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos (blue), other (gray)"), 507 gettext_noop("Noise (red), Content (green), Queries (yellow), Hellos (blue), other (gray), limit (magenta)"),
486 &getTrafficSendStats, 508 &getTrafficSendStats,
487 NULL, 509 NULL,
510 6,
488 5, 511 5,
489 YES,
490 }, 512 },
491 { 513 {
492 gettext_noop("Routing Effectiveness"), 514 gettext_noop("Routing Effectiveness"),