Added last changes for MIB counters

This commit is contained in:
Michiel Broek
2008-02-10 13:29:41 +00:00
parent 5603bf0e87
commit fa5f6ab150
5 changed files with 323 additions and 20 deletions

View File

@@ -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.

View File

@@ -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;
}

View File

@@ -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