Added MIB counters

This commit is contained in:
Michiel Broek 2008-02-12 19:59:45 +00:00
parent dd96d2da2b
commit bb7e43b630
11 changed files with 140 additions and 27 deletions

View File

@ -6,6 +6,9 @@ v0.95.1 07-Jan-2008
mbtask:
Added last changes for MIB counters.
mbsebbs:
Added MIB counters.
script:
Added support for Zenwalk.

View File

@ -4,7 +4,7 @@
include ../Makefile.global
SRCS = signature.c filesub.c language.c \
SRCS = signature.c filesub.c language.c mib.c \
msgutil.c oneline.c morefile.c \
email.c fsedit.c page.c \
bye.c funcs.c mail.c term.c ttyio.c openport.c \
@ -15,7 +15,7 @@ SRCS = signature.c filesub.c language.c \
door.c dispfile.c userlist.c timestats.c logentry.c \
ymsend.c ymrecv.c zmmisc.c zmsend.c zmrecv.c
HDRS = signature.h filesub.h language.h mbsebbs.h misc.h offline.h \
timeout.h email.h fsedit.h \
timeout.h email.h fsedit.h mib.h \
msgutil.h oneline.h user.h bye.h morefile.h \
funcs.h mail.h page.h term.h ttyio.h openport.h \
change.h exitinfo.h newuser.h \
@ -23,7 +23,7 @@ HDRS = signature.h filesub.h language.h mbsebbs.h misc.h offline.h \
pop3.h timecheck.h mbnewusr.h input.h whoson.h \
door.h dispfile.h userlist.h timestats.h logentry.h lastcallers.h \
ymsend.h ymrecv.h zmmisc.h zmsend.h zmrecv.h
MBSEBBS_OBJS = signature.o chat.o file.o funcs.o mail.o menu.o \
MBSEBBS_OBJS = signature.o chat.o file.o funcs.o mail.o menu.o mib.o \
misc.o pinfo.o oneline.o page.o fsedit.o transfer.o \
bye.o change.o mbsebbs.o timeout.o user.o timecheck.o \
exitinfo.o filesub.o offline.o language.o msgutil.o \
@ -31,7 +31,7 @@ MBSEBBS_OBJS = signature.o chat.o file.o funcs.o mail.o menu.o \
logentry.o morefile.o lastcallers.o term.o ttyio.o openport.o \
ymsend.o ymrecv.o zmmisc.o zmsend.o zmrecv.o
MBSEBBS_LIBS = ../lib/libmbse.a ../lib/libmsgbase.a ../lib/libdbase.a ../lib/libmbinet.a ../lib/libnodelist.a
MBNEWUSR_OBJS = mbnewusr.o newuser.o language.o timeout.o dispfile.o oneline.o ttyio.o \
MBNEWUSR_OBJS = mbnewusr.o newuser.o language.o timeout.o dispfile.o oneline.o ttyio.o mib.o \
timecheck.o input.o exitinfo.o funcs.o misc.o change.o door.o term.o openport.o \
filesub.o mail.o email.o msgutil.o pop3.o fsedit.o whoson.o
MBNEWUSR_LIBS = ../lib/libmbse.a ../lib/libmsgbase.a ../lib/libdbase.a ../lib/libmbinet.a ../lib/libnodelist.a
@ -94,13 +94,14 @@ depend:
signature.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h signature.h funcs.h input.h language.h timeout.h term.h ttyio.h
filesub.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/mbsedb.h filesub.h funcs.h language.h input.h misc.h timeout.h exitinfo.h change.h term.h ttyio.h
language.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h input.h language.h term.h ttyio.h
mib.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h mib.h
msgutil.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msgtext.h ../lib/msg.h oneline.h msgutil.h
oneline.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h oneline.h funcs.h input.h language.h term.h ttyio.h
morefile.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h input.h language.h morefile.h timeout.h term.h ttyio.h
email.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msgtext.h ../lib/msg.h ../lib/mbinet.h exitinfo.h language.h mail.h timeout.h msgutil.h input.h email.h whoson.h term.h ttyio.h
fsedit.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h mail.h input.h language.h timeout.h pinfo.h fsedit.h term.h ttyio.h
page.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h dispfile.h input.h chat.h page.h timeout.h mail.h language.h term.h ttyio.h
bye.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/nodelist.h dispfile.h misc.h language.h bye.h term.h openport.h ttyio.h
bye.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/nodelist.h dispfile.h misc.h language.h bye.h term.h openport.h ttyio.h mib.h
funcs.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msgtext.h ../lib/msg.h funcs.h term.h ttyio.h
mail.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/nodelist.h ../lib/msgtext.h ../lib/msg.h mail.h funcs.h input.h language.h misc.h timeout.h oneline.h exitinfo.h fsedit.h filesub.h msgutil.h pop3.h email.h door.h whoson.h term.h ttyio.h openport.h
term.o: ../config.h ../lib/mbselib.h ../lib/users.h term.h ttyio.h

View File

@ -40,6 +40,7 @@
#include "term.h"
#include "openport.h"
#include "ttyio.h"
#include "mib.h"
extern pid_t mypid;
@ -47,6 +48,10 @@ extern time_t t_start;
extern char *StartTime;
extern int hanged_up;
extern unsigned int mib_sessions;
extern unsigned int mib_minutes;
int do_mailout = FALSE;
@ -101,6 +106,15 @@ void Good_Bye(int onsig)
}
}
/*
* Update mib counters
*/
t_end = time(NULL);
mib_minutes = (unsigned int) ((t_end - t_start) / 60);
mib_sessions++;
sendmibs();
/*
* Flush all data to the user, wait 5 seconds to
* be sure the user received all data.

View File

@ -4,7 +4,7 @@
* Purpose ...............: Sysop to user chat utility
*
*****************************************************************************
* Copyright (C) 1997-2007
* Copyright (C) 1997-2008
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -53,6 +53,8 @@ int rsize = 5; /* Chat receive size */
extern pid_t mypid;
extern int cols;
extern int rows;
extern unsigned int mib_chats;
extern unsigned int mib_chatminutes;
@ -180,6 +182,8 @@ void Chat(char *username, char *channel)
unsigned char ch;
char sbuf[81], resp[128], *name, *mname;
static char buf[200];
time_t c_start, c_end;
WhosDoingWhat(SYSOPCHAT, NULL);
clear();
@ -268,6 +272,7 @@ void Chat(char *username, char *channel)
}
chatting = TRUE;
c_start = time(NULL);
while (stop == FALSE) {
@ -354,6 +359,10 @@ void Chat(char *username, char *channel)
}
}
chatting = FALSE;
c_end = time(NULL);
mib_chats++;
mib_chatminutes += (unsigned int) ((c_end - c_start) / 60);
/*
* Before sending the close command, purge all outstanding messages.

View File

@ -4,7 +4,7 @@
* Purpose ...............: Internet email
*
*****************************************************************************
* Copyright (C) 1997-2007
* Copyright (C) 1997-2008
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -54,6 +54,7 @@ extern char *Message[];
extern int Line;
extern int do_mailout;
extern int LC_Wrote;
extern unsigned int mib_posted;
/*
@ -346,6 +347,7 @@ int Save_Email(int IsReply)
ReadExitinfo();
exitinfo.iPosted++;
mib_posted++;
WriteExitinfo();
do_mailout = TRUE;

View File

@ -4,7 +4,7 @@
* Purpose ...............: All the file functions.
*
*****************************************************************************
* Copyright (C) 1997-2007
* Copyright (C) 1997-2008
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -55,6 +55,10 @@ extern int arecno; /* File area number in xxxScan() functions */
int Strlen = 0;
int FileRecno = 0;
extern int rows;
extern unsigned int mib_downloads;
extern unsigned int mib_kbdownload;
extern unsigned int mib_uploads;
int CheckFile(char *, int);
@ -392,7 +396,9 @@ void Download(void)
ReadExitinfo();
exitinfo.Downloads += Count; /* Increase download counter */
mib_downloads += Count;
exitinfo.DownloadK += (Size / 1024); /* Increase amount download today */
mib_kbdownload += (Size / 1024);
/*
* Minus the amount downloaded today from downloadktoday
@ -1027,6 +1033,7 @@ int DownloadDirect(char *Name, int Wait)
*/
ReadExitinfo();
exitinfo.Downloads++; /* Increase download counter */
mib_downloads++;
WriteExitinfo();
}
@ -1328,6 +1335,7 @@ int Upload_Home()
ReadExitinfo();
exitinfo.Uploads += Count;
mib_uploads += Count;
WriteExitinfo();
tidy_upload(&up);

View File

@ -4,7 +4,7 @@
* Purpose ...............: All the file sub functions.
*
*****************************************************************************
* Copyright (C) 1997-2007
* Copyright (C) 1997-2008
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -49,6 +49,9 @@ extern pid_t mypid;
int arecno = 1; /* Area record number */
int Hcolor = 9; /* Color of area line in xxxScan() functions */
extern int rows;
extern unsigned int mib_uploads;
extern unsigned int mib_kbupload;
/*
@ -821,7 +824,9 @@ int ImportFile(char *fn, int Area, int fileid, off_t Size)
*/
if (Size) {
exitinfo.Uploads++;
mib_uploads++;
exitinfo.UploadK += (Size / 1024);
mib_kbupload += (Size / 1024);
exitinfo.UploadKToday += (Size / 1024);
Syslog('b', "Uploads %d, Kb %d, Kb today %d", exitinfo.Uploads, exitinfo.UploadK, exitinfo.UploadKToday);
/* You have */ /* extra download KBytes. */

View File

@ -5,7 +5,7 @@
* Todo ..................: Implement message groups.
*
*****************************************************************************
* Copyright (C) 1997-2007
* Copyright (C) 1997-2008
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -74,6 +74,7 @@ FILE *qf; /* Quote file */
extern int do_mailout;
extern int LC_Wrote; /* Lastcaller info write message */
extern int rows;
extern unsigned int mib_posted;
/*
@ -836,6 +837,7 @@ int Save_Msg(int IsReply, faddr *Dest)
ReadExitinfo();
exitinfo.iPosted++;
mib_posted ++;
WriteExitinfo();
LC_Wrote = TRUE;

57
mbsebbs/mib.c Normal file
View File

@ -0,0 +1,57 @@
/*****************************************************************************
*
* $Id$
* Purpose ...............: snmp MIB counters
*
*****************************************************************************
* Copyright (C) 1997-2008
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
* 1971 BV IJmuiden
* the Netherlands
*
* This file is part of MBSE BBS.
*
* This BBS is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* MBSE BBS is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with MBSE BBS; see the file COPYING. If not, write to the Free
* Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*****************************************************************************/
#include "../config.h"
#include "../lib/mbselib.h"
#include "../lib/mbse.h"
#include "../lib/users.h"
#include "mib.h"
unsigned int mib_sessions = 0;
unsigned int mib_minutes = 0;
unsigned int mib_posted = 0;
unsigned int mib_uploads = 0;
unsigned int mib_kbupload = 0;
unsigned int mib_downloads = 0;
unsigned int mib_kbdownload = 0;
unsigned int mib_chats = 0;
unsigned int mib_chatminutes = 0;
void sendmibs(void)
{
SockS("MSBB:9,%d,%d,%d,%d,%d,%d,%d,%d,%d;", mib_sessions, mib_minutes, mib_posted,
mib_uploads, mib_kbupload, mib_downloads, mib_kbdownload, mib_chats, mib_chatminutes);
}

9
mbsebbs/mib.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef _MIB_H
#define _MIB_H
/* $Id$ */
void sendmibs(void);
#endif

View File

@ -4,7 +4,7 @@
* Purpose ...............: Offline Reader
*
*****************************************************************************
* Copyright (C) 1997-2007
* Copyright (C) 1997-2008
*
* Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10
@ -63,6 +63,7 @@ extern int do_mailout;
extern int cols;
extern int rows;
char *newtear = NULL;
extern unsigned int mib_posted;
typedef struct _msg_high {
@ -1613,6 +1614,7 @@ void BlueWave_Fetch()
poutCR(CFG.TextColourF, CFG.TextColourB, temp);
ReadExitinfo();
exitinfo.iPosted += i;
mib_posted += i;
WriteExitinfo();
do_mailout = TRUE;
}
@ -2430,6 +2432,7 @@ void QWK_Fetch()
poutCR(CFG.TextColourF, CFG.TextColourB, temp);
ReadExitinfo();
exitinfo.iPosted += nPosted;
mib_posted += nPosted;
WriteExitinfo();
do_mailout = TRUE;
}