From 24f43175fa3932480ccaf3f0dbf2a030bb3622e1 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 1 May 2005 09:18:17 +0000 Subject: [PATCH] Added IBC stats in mbmon --- mbmon/mbmon.c | 34 +++++++++++++++++++++++++--------- mbtask/Makefile | 2 +- mbtask/taskstat.c | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 59 insertions(+), 11 deletions(-) diff --git a/mbmon/mbmon.c b/mbmon/mbmon.c index 3bd90773..28fc14ca 100644 --- a/mbmon/mbmon.c +++ b/mbmon/mbmon.c @@ -256,25 +256,34 @@ void system_stat(void) mbse_mvprintw( 5, 6, "2. SERVER STATISTICS"); set_color(CYAN, BLACK); mbse_mvprintw( 7, 6, "First date started"); - mbse_mvprintw( 7,62, "BBS Open"); + mbse_mvprintw( 7,59, "BBS Open"); mbse_mvprintw( 8, 6, "Last date started"); - mbse_mvprintw( 8,62, "ZMH"); + mbse_mvprintw( 8,59, "ZMH"); mbse_mvprintw( 9, 6, "Total server starts"); - mbse_mvprintw( 9,62, "Internet"); + mbse_mvprintw( 9,59, "Internet up"); mbse_mvprintw(10, 6, "Connected clients"); - mbse_mvprintw(10,62, "Need inet"); - mbse_mvprintw(11,62, "Running"); + mbse_mvprintw(10,59, "Need inet"); + mbse_mvprintw(11,59, "Running"); mbse_mvprintw(12,30, "Total Today"); - mbse_mvprintw(12,62, "Load avg"); + mbse_mvprintw(12,59, "Load average"); hor_lin(13,30,8); hor_lin(13,45,8); - mbse_mvprintw(13,62, "Diskspace"); + mbse_mvprintw(13,59, "Diskspace"); mbse_mvprintw(14, 6, "Client connects"); +#ifdef USE_EXPERIMENT + mbse_mvprintw(14,59, "IBC servers"); +#endif mbse_mvprintw(15, 6, "Peak connections"); +#ifdef USE_EXPERIMENT + mbse_mvprintw(15,59, "IBC channels"); +#endif mbse_mvprintw(16, 6, "Protocol syntax errors"); +#ifdef USE_EXPERIMENT + mbse_mvprintw(16,59, "IBC users"); +#endif mbse_mvprintw(17, 6, "Communication errors"); mbse_mvprintw(19, 6, "Next sequence number"); - mbse_mvprintw(19,62, "Press any key"); + mbse_mvprintw(lines -3,59, "Press any key"); IsDoing("System Statistics"); do { @@ -306,7 +315,14 @@ void system_stat(void) mbse_mvprintw(10,72,"%s", atoi(strtok(NULL, ",")) == 1?"Yes":"No "); mbse_mvprintw(11,72,"%s", atoi(strtok(NULL, ",")) == 1?"Yes":"No "); mbse_mvprintw(12,72, "%s ", strtok(NULL, ",")); +#ifdef USE_EXPERIMENT + mbse_mvprintw(19,30, (char *)"%s", strtok(NULL, ",")); + mbse_mvprintw(14,72, (char *)"%s ", strtok(NULL, ",")); + mbse_mvprintw(15,72, (char *)"%s ", strtok(NULL, ",")); + mbse_mvprintw(16,72, (char *)"%s ", strtok(NULL, ";")); +#else mbse_mvprintw(19,30, (char *)"%s", strtok(NULL, ";")); +#endif } switch (enoughspace(CFG.freespace)) { @@ -320,7 +336,7 @@ void system_stat(void) break; } - ch = testkey(19,76); + ch = testkey(lines -3,73); } while (ch == '\0'); } diff --git a/mbtask/Makefile b/mbtask/Makefile index cb49c64b..4cd88799 100644 --- a/mbtask/Makefile +++ b/mbtask/Makefile @@ -72,7 +72,7 @@ callstat.o: ../config.h ../lib/mbselib.h taskutil.h callstat.h scanout.o: ../config.h ../lib/mbselib.h taskutil.h scanout.h taskcomm.o: ../config.h ../lib/mbselib.h taskstat.h taskregs.h taskdisk.h taskinfo.h taskutil.h taskchat.h taskcomm.h taskinfo.o: ../config.h ../lib/mbselib.h taskinfo.h -taskstat.o: ../config.h ../lib/mbselib.h taskstat.h callstat.h outstat.h taskutil.h +taskstat.o: ../config.h ../lib/mbselib.h taskstat.h callstat.h outstat.h taskibc.h taskutil.h taskibc.o: ../config.h ../lib/mbselib.h taskstat.h taskutil.h taskchat.h taskibc.h mbtask.o: ../config.h ../lib/mbselib.h ../paths.h signame.h taskstat.h taskutil.h taskregs.h taskcomm.h taskdisk.h taskibc.h callstat.h outstat.h ../lib/nodelist.h ports.h calllist.h ping.h taskchat.h mbtask.h outstat.o: ../config.h ../lib/mbselib.h taskutil.h taskstat.h scanout.h ../lib/nodelist.h callstat.h ports.h outstat.h diff --git a/mbtask/taskstat.c b/mbtask/taskstat.c index 04dc69f9..f01f317a 100644 --- a/mbtask/taskstat.c +++ b/mbtask/taskstat.c @@ -33,6 +33,7 @@ #include "taskstat.h" #include "callstat.h" #include "outstat.h" +#include "taskibc.h" #include "taskutil.h" @@ -87,6 +88,12 @@ static status_r status; /* Status data */ extern double Load; /* System Load */ extern int Processing; /* Is system running */ +#ifdef USE_EXPERIMENT +extern srv_list *servers; /* Connected servers */ +extern usr_list *users; /* Connected users */ +extern chn_list *channels; /* Connected channels */ +#endif + /************************************************************************ * @@ -301,16 +308,41 @@ void stat_inc_cerr() char *stat_status() { static char buf[160]; +#ifdef USE_EXPERIMENT + int srvcnt = 0, chncnt = 0, usrcnt = 0; + srv_list *tmps; + chn_list *tmpc; + usr_list *tmpu; +#endif buf[0] = '\0'; - sprintf(buf, "100:20,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%d,%d,%d,%d,%d,%2.2f,%lu;", + +#ifdef USE_EXPERIMENT + for (tmps = servers; tmps; tmps = tmps->next) + srvcnt++; + for (tmpc = channels; tmpc; tmpc = tmpc->next) + chncnt++; + for (tmpu = users; tmpu; tmpu = tmpu->next) + usrcnt++; + sprintf(buf, "100:23,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%d,%d,%d,%d,%d,%2.2f,%lu,%d,%d,%d;", (long)status.start, (long)status.laststart, (long)status.daily, status.startups, status.clients, status.total.tot_clt, status.total.peak_clt, status.total.s_error, status.total.c_error, status.today.tot_clt, status.today.peak_clt, status.today.s_error, status.today.c_error, + status.open, get_zmh(), internet, s_do_inet, Processing, Load, status.sequence, + srvcnt, chncnt, usrcnt); +#else + sprintf(buf, "100:20,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%d,%d,%d,%d,%d,%2.2f,%lu;", + (long)status.start, (long)status.laststart, (long)status.daily, + status.startups, status.clients, + status.total.tot_clt, status.total.peak_clt, + status.total.s_error, status.total.c_error, + status.today.tot_clt, status.today.peak_clt, + status.today.s_error, status.today.c_error, status.open, get_zmh(), internet, s_do_inet, Processing, Load, status.sequence); +#endif return buf; }