From fa5f6ab150d848753675b17f4538ab5eb8192640 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sun, 10 Feb 2008 13:29:41 +0000 Subject: [PATCH] Added last changes for MIB counters --- ChangeLog | 3 + html/programs/mbtask.html | 59 +++++++++++++-- mbtask/taskcomm.c | 150 ++++++++++++++++++++++++++++++++++---- mbtask/taskstat.c | 119 +++++++++++++++++++++++++++++- mbtask/taskstat.h | 12 +++ 5 files changed, 323 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3143ab6e..5fb81ac6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ $Id$ v0.95.1 07-Jan-2008 + mbtask: + Added last changes for MIB counters. + script: Added support for Zenwalk. diff --git a/html/programs/mbtask.html b/html/programs/mbtask.html index d90e7554..6619ecea 100644 --- a/html/programs/mbtask.html +++ b/html/programs/mbtask.html @@ -14,7 +14,7 @@
-
Last update 17-Oct-2005
+
Last update 10-Feb-2008

mbtask - MBSE BBS Taskmanager

Sysopsis.

@@ -173,7 +173,7 @@ this condition. Replies can also contain optional data. Examples:
Because data fields in commands and replies are separated and terminated by , and ; characters these characters need to be escaped. Also characters outside -the us-ascii range must be escaped. This is done by ttranslating the character +the us-ascii range must be escaped. This is done by translating the character to a backslash followed by the hexadecimal number of the character. The server has a 10 minute timeout for receiving data when a connection is established. The clients need to "ping" the server at regular intervals @@ -192,6 +192,7 @@ Axxx Accounting, system monitor info etc. Cxxx Chatting Dxxx Disk watch Gxxx Global commands. +Mxxx MIB commands. Sxxx Status commands. @@ -320,9 +321,6 @@ Command: GMON:1,n; Get registration info line, 1=First, 0=N Reply: 100:7,pid,tty,user,program,city,isdoing,starttime; 100:0; No more lines. -Command: GDST:0; Get filesystem status. Obsolete, use DGFS instead. - 100:n,data1, ..., data10; Maximum 10 filesystems datalines. - Command: GSYS:0; Get bbs statistics. 100:7,calls,pots_calls,isdn_calls,network_calls,local_calls,startdate,lastcaller; @@ -334,6 +332,57 @@ Command: GLCR:1,recno; Get Lastcaller record 201:1,16; Not available. + Group M, MIB commands. + +Command: MSMS:6,kbrcvd,kbsent,direction,state,itype,freqs; Set Mailer Session +Reply: 100,0; + +Command: MGMS:0; Get Mailer Session +Reply: 100:12,kbrcvd,kbsent,sessin,sessout,sess_sec,sess_unseq,sess_bad,ftsc,yoohoo,emsi,binkp,freqs; + +Command: MSTN:3,in,out,bad; Set Tosser Netmail +Reply: 100,0; + +Command: MGTN:0; Get Tosser Netmail +Reply: 100:3,in,out,bad; + +Command: MSTI:3,in,out,bad; Set Tosser Internet-email +Reply: 100,0; + +Command: MGTI:0; Get Tosser Internet-email +Reply: 100:3,in,out,bad; + +Command: MSTE:4,in,out,bad,dupe; Set Tosser Echomail +Reply: 100:0; + +Command: MGTE:0; Get Tosser Echomail +Reply: 100:4,in,out,bad,dupe; + +Command: MSTR:4,in,out,bad,dupe; Set Tosser RFC-news +Reply: 100:0; + +Command: MGTR:0; Get Tosser RFC-news +Reply: 100:4,in,out,bad,dupe; + +Command: MGTT:0; Get Tosser Totals +Reply: 100:4,in,out,bad,dupe; + +Command: MSFF:6,in,out,bad,dupe,magics,hatched; Set Tosser Files +Reply: 100:0; + +Command: MGFF:0; Get Tosser Files +Reply: 100:6,in,out,bad,dupe,magics,hatched; + +Command: MSBB:9,sessions,minutes,posted,uploads,kbupload,downloads,kbdownload,chats,chatminutes; Set BBS +Reply: 100:0; + +Command: MGBB:0; Get BBS +Reply: 100:9,sessions,minutes,posted,uploads,kbupload,downloads,kbdownload,chats,chatminutes + +Command: MGOB:0; Get Outbound Size +Reply: 100:1,size; + + Group S, Status commands. Command: SBBS:0; Get BBS Status (open, zmh, shutdown). diff --git a/mbtask/taskcomm.c b/mbtask/taskcomm.c index b8af8321..1bf4266f 100644 --- a/mbtask/taskcomm.c +++ b/mbtask/taskcomm.c @@ -4,7 +4,7 @@ * Purpose ...............: MBSE BBS Daemon * ***************************************************************************** - * Copyright (C) 1997-2007 + * Copyright (C) 1997-2008 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -490,18 +490,6 @@ char *exe_cmd(char *in) return obuf; } - /* - * GDST:0; Obsolete! - * 100:n,data1,..,data10; - */ -// if (strncmp(cmd, "GDST", 4) == 0) { -// buf = calloc(SS_BUFSIZE, sizeof(char)); -// disk_getfs_r(buf); -// snprintf(obuf, SS_BUFSIZE, "%s", buf); -// free(buf); -// return obuf; -// } - /* * GSYS:0; * 100:7,calls,pots_calls,isdn_calls,network_calls,local_calls,startdate,last_caller; @@ -565,6 +553,20 @@ char *exe_cmd(char *in) return obuf; } + /* + * MIB Get Mailer Session + * + * MGMS:0; + * 100:12,kbrcvd,kbsent,sessin,sessout,sess_sec,sess_unseq,sess_bad,ftsc,yoohoo,emsi,binkp,freqs; + */ + if (strncmp(cmd, "MGMS", 4) == 0) { + buf = calloc(SS_BUFSIZE, sizeof(char)); + mib_get_mailer_r(buf); + snprintf(obuf, SS_BUFSIZE, "%s", buf); + free(buf); + return obuf; + } + /* * MIB Set Tosser Netmail * @@ -576,6 +578,20 @@ char *exe_cmd(char *in) return obuf; } + /* + * MIB Get Tosser Netmail + * + * MGTN:0; + * 100:3,in,out,bad; + */ + if (strncmp(cmd, "MGTN", 4) == 0) { + buf = calloc(SS_BUFSIZE, sizeof(char)); + mib_get_netmail_r(buf); + snprintf(obuf, SS_BUFSIZE, "%s", buf); + free(buf); + return obuf; + } + /* * MIB Set Tosser Internet-email * @@ -587,6 +603,20 @@ char *exe_cmd(char *in) return obuf; } + /* + * MIB Get Tosser Internet-email + * + * MGTI:0; + * 100:3,in,out,bad; + */ + if (strncmp(cmd, "MGTI", 4) == 0) { + buf = calloc(SS_BUFSIZE, sizeof(char)); + mib_get_netmail_r(buf); + snprintf(obuf, SS_BUFSIZE, "%s", buf); + free(buf); + return obuf; + } + /* * MIB Set Tosser Echomail * @@ -598,6 +628,20 @@ char *exe_cmd(char *in) return obuf; } + /* + * MIB Get Tosser Echomail + * + * MGTE:0; + * 100:4,in,out,bad,dupe; + */ + if (strncmp(cmd, "MGTE", 4) == 0) { + buf = calloc(SS_BUFSIZE, sizeof(char)); + mib_get_echo_r(buf); + snprintf(obuf, SS_BUFSIZE, "%s", buf); + free(buf); + return obuf; + } + /* * MIB Set Tosser RFC-news * @@ -609,6 +653,34 @@ char *exe_cmd(char *in) return obuf; } + /* + * MIB Get Tosser RFC-news + * + * MGTR:0; + * 100:4,in,out,bad,dupe; + */ + if (strncmp(cmd, "MGTR", 4) == 0) { + buf = calloc(SS_BUFSIZE, sizeof(char)); + mib_get_news_r(buf); + snprintf(obuf, SS_BUFSIZE, "%s", buf); + free(buf); + return obuf; + } + + /* + * MIB Get Tosser Totals + * + * MGTT:0; + * 100:4,in,out,bad,dupe; + */ + if (strncmp(cmd, "MGTT", 4) == 0) { + buf = calloc(SS_BUFSIZE, sizeof(char)); + mib_get_tosser_r(buf); + snprintf(obuf, SS_BUFSIZE, "%s", buf); + free(buf); + return obuf; + } + /* * MIB Set Tosser Files * @@ -620,6 +692,58 @@ char *exe_cmd(char *in) return obuf; } + /* + * MIB Get Tosser Files + * + * MGFF:0; + * 100:6,in,out,bad,dupe,magics,hatched; + */ + if (strncmp(cmd, "MGTT", 4) == 0) { + buf = calloc(SS_BUFSIZE, sizeof(char)); + mib_get_files_r(buf); + snprintf(obuf, SS_BUFSIZE, "%s", buf); + free(buf); + return obuf; + } + + /* + * MIB Set BBS + * + * MSBB:9,sessions,minutes,posted,uploads,kbupload,downloads,kbdownload,chats,chatminutes; + * 100:0; + */ + if (strncmp(cmd, "MSBB", 4) == 0) { + mib_set_bbs(token); + return obuf; + } + + /* + * MIB Get BBS + * + * MGBB:0; + * 100:9,sessions,minutes,posted,uploads,kbupload,downloads,kbdownload,chats,chatminutes; + */ + if (strncmp(cmd, "MGBB", 4) == 0) { + buf = calloc(SS_BUFSIZE, sizeof(char)); + mib_get_bbs_r(buf); + snprintf(obuf, SS_BUFSIZE, "%s", buf); + free(buf); + return obuf; + } + + /* + * MIB Get Outbound Size + * + * MGOB:0; + * 100:1,size; + */ + if (strncmp(cmd, "MGOB", 4) == 0) { + buf = calloc(SS_BUFSIZE, sizeof(char)); + mib_get_outsize_r(buf); + snprintf(obuf, SS_BUFSIZE, "%s", buf); + free(buf); + return obuf; + } /* * The (S)tatus commands. diff --git a/mbtask/taskstat.c b/mbtask/taskstat.c index 0baf94ec..751c835e 100644 --- a/mbtask/taskstat.c +++ b/mbtask/taskstat.c @@ -4,7 +4,7 @@ * Purpose ...............: Keep track of server status * ***************************************************************************** - * Copyright (C) 1997-2007 + * Copyright (C) 1997-2008 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -558,6 +558,18 @@ void mib_set_mailer(char *data) +void mib_get_mailer_r(char *buf) +{ + + snprintf(buf, 127, "100:12,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d;", + status.mkbrcvd, status.mkbsent, status.msessin, + status.msessout, status.msesssecure, status.msessunsec, status.msessbad, + status.mftsc, status.myoohoo, status.memsi, status.mbinkp, status.mfreqs); + return; +} + + + void mib_set_netmail(char *data) { unsigned int in, out, bad; @@ -582,6 +594,14 @@ void mib_set_netmail(char *data) +void mib_get_netmail_r(char *buf) +{ + snprintf(buf, 127, "100:3,%d,%d,%d;", status.tnetin, status.tnetout, status.tnetbad); + return; +} + + + void mib_set_email(char *data) { unsigned int in, out, bad; @@ -599,7 +619,7 @@ void mib_set_email(char *data) status.tmsgsbad += bad; status.temailbad += bad; - Syslog('m', "MIB netmail: in=%d out=%d bad=%d in=%d out=%d bad=%d", status.tmsgsin, status.tmsgsout, status.tmsgsbad, + Syslog('m', "MIB email: in=%d out=%d bad=%d in=%d out=%d bad=%d", status.tmsgsin, status.tmsgsout, status.tmsgsbad, status.temailin, status.temailout, status.temailbad); status_write(); @@ -607,6 +627,14 @@ void mib_set_email(char *data) +void mib_get_email_r(char *buf) +{ + snprintf(buf, 127, "100:3,%d,%d,%d;", status.temailin, status.temailout, status.temailbad); + return; +} + + + void mib_set_news(char *data) { unsigned int in, out, bad, dupe; @@ -637,6 +665,14 @@ void mib_set_news(char *data) +void mib_get_news_r(char *buf) +{ + snprintf(buf, 127, "100:4,%d,%d,%d,%d;", status.tnewsin, status.tnewsout, status.tnewsbad, status.tnewsdupe); + return; +} + + + void mib_set_echo(char *data) { unsigned int in, out, bad, dupe; @@ -666,6 +702,22 @@ void mib_set_echo(char *data) +void mib_get_echo_r(char *buf) +{ + snprintf(buf, 127, "100:4,%d,%d,%d,%d;", status.techoin, status.techoout, status.techobad, status.techodupe); + return; +} + + + +void mib_get_tosser_r(char *buf) +{ + snprintf(buf, 127, "100:4,%d,%d,%d,%d;", status.tmsgsin, status.tmsgsout, status.tmsgsbad, status.tmsgsdupe); + return; +} + + + void mib_set_files(char *data) { unsigned int in, out, bad, dupe, magics, hatched; @@ -695,6 +747,15 @@ void mib_set_files(char *data) +void mib_get_files_r(char *buf) +{ + snprintf(buf, 127, "100:6,%d,%d,%d,%d,%d,%d;", status.tfilesin, status.tfilesout, status.tfilesbad, status.tfilesdupe, + status.tfilesmagic, status.tfileshatched); + return; +} + + + void mib_set_outsize(unsigned int size) { status.ooutsize = size; @@ -703,3 +764,57 @@ void mib_set_outsize(unsigned int size) status_write(); } + + +void mib_get_outsize_r(char *buf) +{ + snprintf(buf, 127, "100:1,%d;", status.ooutsize); + return; +} + + + +void mib_set_bbs(char *data) +{ + unsigned int sessions, minutes, posted, uploads, kbupload, downloads, kbdownload, chats, chatminutes; + + Syslog('m', "MIB set bbs %s", data); + strtok(data, ","); + sessions = atoi(strtok(NULL, ",")); + minutes = atoi(strtok(NULL, ",")); + posted = atoi(strtok(NULL, ",")); + uploads = atoi(strtok(NULL, ",")); + kbupload = atoi(strtok(NULL, ",")); + downloads = atoi(strtok(NULL, ",")); + kbdownload = atoi(strtok(NULL, ",")); + chats = atoi(strtok(NULL, ",")); + chatminutes = atoi(strtok(NULL, ";")); + + status.bsessions += sessions; + status.bminutes += minutes; + status.bposted += posted; + status.buploads += uploads; + status.bkbupload += kbupload; + status.bdownloads += downloads; + status.bkbdownload += kbdownload; + status.bchats += chats; + status.bchatminutes += chatminutes; + + Syslog('m', "MIB bbs: sess=%d mins=%d posted=%d upls=%d kbup=%d downs=%d kbdown=%d chat=%d chatmins=%d", + status.bsessions, status.bminutes, status.bposted, status.buploads, status.bkbupload, + status.bdownloads, status.bkbdownload, status.bchats, status.bchatminutes); + + status_write(); +} + + + +void mib_get_bbs_r(char *buf) +{ + snprintf(buf, 127, "100:9,%d,%d,%d,%d,%d,%d,%d,%d,%d;", + status.bsessions, status.bminutes, status.bposted, status.buploads, status.bkbupload, + status.bdownloads, status.bkbdownload, status.bchats, status.bchatminutes); + return; +} + + diff --git a/mbtask/taskstat.h b/mbtask/taskstat.h index 1dad175a..addf6dc1 100644 --- a/mbtask/taskstat.h +++ b/mbtask/taskstat.h @@ -24,12 +24,24 @@ void sem_status_r(char *, char *); /* Get semafore status */ void sem_create_r(char *, char *); /* Create semafore */ void sem_remove_r(char *, char *); /* Remove semafore */ void mib_set_mailer(char *); /* MIB set mailer data */ +void mib_get_mailer_r(char *); /* MIB get mailer data */ void mib_set_netmail(char *); /* MIB set netmail data */ +void mib_get_netmail_r(char *); /* MIB get netmail data */ void mib_set_email(char *); /* MIB set email data */ +void mib_get_email_r(char *); /* MIB get email data */ void mib_set_news(char *); /* MIB set news data */ +void mib_get_news_r(char *); /* MIB get news data */ void mib_set_echo(char *); /* MIB set echomail data */ +void mib_get_echo_r(char *); /* MIB get echomail data */ void mib_set_files(char *); /* MIB set files data */ +void mib_get_files_r(char *); /* MIB get files data */ void mib_set_outsize(unsigned int); /* MIB set outbound size */ +void mib_get_outsize_r(char *); /* MIB get outbound size */ +void mib_get_tosser_r(char *); /* MIB get tosser data */ +void mib_set_bbs(char *); /* MIB set bbs data */ +void mib_get_bbs_r(char *); /* MIB get bbs data */ + + #endif