of command execution
- Fix: Live traffic meter occasionally showing higher minimum than average
in end statistics (Debian Bug #687812)
- - Fix: Cppcheck findings
+ - Fix: Cppcheck findings (may fix Debian Bug #692330)
- Improve traffic meter output accuracy
- Add tests and debug compilation target
- Remove use of -D parameter in Makefile install commands in order to
- Add support for database import from text file (--importdb)
(based on patch by Tilmann Bubeck)
- Rename --dumpdb to --exportdb
- - Code refactoring
+ - Add example systemd service file
+ - Add example launchd plist file for OS X
+ - Use ISO YYYY-MM-DD date format timestamps if logfile is used
+ - Improve daemon startup prints
1.11 / 1-Jun-11
dbshow.o: dbshow.c dbshow.h misc.h common.h
dbaccess.o: dbaccess.c dbaccess.h common.h
dbmerge.o: dbmerge.c dbmerge.h dbaccess.h common.h
-dbcache.o: dbcache.c dbcache.h dbaccess.h common.h ifinfo.h
+dbcache.o: dbcache.c dbcache.h dbaccess.h common.h ifinfo.h cfg.h
common.o: common.c common.h
misc.o: misc.c misc.h common.h
cfg.o: cfg.c cfg.h common.h
}
current = time(NULL);
- strftime(timestamp, 22, "%Y.%m.%d %H:%M:%S", localtime(¤t));
+ strftime(timestamp, 22, "%Y-%m-%d %H:%M:%S", localtime(¤t));
switch (type) {
case PT_Info:
#include "ifinfo.h"
#include "dbaccess.h"
#include "dbcache.h"
+#include "cfg.h"
int cacheadd(const char *iface, int sync)
{
void cachestatus(void)
{
- char buffer[512];
- int b = 13, count = 0;
+ char buffer[512], bwtemp[8];
+ int b = 13, count = 0, bwlimit = 0;
datanode *p = dataptr;
snprintf(buffer, b, "Monitoring: ");
if (p != NULL) {
while (p != NULL) {
- if ((b+strlen(p->data.interface)+1) < 508) {
+ if ((b+strlen(p->data.interface)+8) < 508) {
+ bwlimit = ibwget(p->data.interface);
+ if (bwlimit < 0) {
+ bwlimit = 0;
+ }
+ snprintf(bwtemp, 8, " (%d) ", bwlimit);
strncat(buffer, p->data.interface, strlen(p->data.interface));
- strcat(buffer, " ");
- b = b+strlen(p->data.interface)+1;
+ strncat(buffer, bwtemp, strlen(bwtemp));
+ b += strlen(p->data.interface) + strlen(bwtemp);
} else {
strcat(buffer, "...");
break;
if (showhelp) {
printf(" vnStat daemon %s by Teemu Toivola <tst at iki dot fi>\n\n", VNSTATVERSION);
printf(" -d, --daemon fork process to background\n");
- printf(" -n, --nodaemon stay in foreground attached to the terminal\n");
+ printf(" -n, --nodaemon stay in foreground attached to the terminal\n\n");
printf(" -s, --sync sync interface counters on first update\n");
printf(" -D, --debug show additional debug and disable daemon\n");
printf(" -?, --help show this help\n");
printf(" -v, --version show version\n");
printf(" -p, --pidfile select used pid file\n");
- printf(" --config select used config file\n\n");
- printf(" --noadd don't add found interfaces if no dbs are found\n");
+ printf(" --config select used config file\n");
+ printf(" --noadd don't add found interfaces if no dbs are found\n\n");
printf("See also \"man vnstatd\".\n");
return 0;
}
updateinterval = cfg.updateinterval;
if (debug) {
+ debugtimestamp();
cacheshow();
}
int addinterfaces(const char *dirname)
{
char *ifacelist, interface[32];
- int index = 0, count = 0;
+ int index = 0, count = 0, bwlimit = 0;
/* get list of currently visible interfaces */
if (getiflist(&ifacelist)==0) {
continue;
}
count++;
- printf("\"%s\" added, %d Mbit bandwidth limit.\n", interface, ibwget(interface));
+ bwlimit = ibwget(interface);
+ if (bwlimit > 0) {
+ printf("\"%s\" added with %d Mbit bandwidth limit.\n", interface, bwlimit);
+ } else {
+ printf("\"%s\" added. Warning: no bandwidth limit has been set.\n", interface);
+ }
}
if (count==1) {
}
if (count) {
- printf(" Limits can be modified using the configuration file.");
+ printf(" Limits can be modified using the configuration file. See \"man vnstat.conf\".");
}
printf("\n");
free(ifacelist);
return count;
}
+
+void debugtimestamp()
+{
+ time_t now;
+ char timestamp[22];
+
+ now = time(NULL);
+ strftime(timestamp, 22, "%Y-%m-%d %H:%M:%S", localtime(&now));
+ printf("%s\n", timestamp);
+}
void daemonize(void);
int addinterfaces(const char *dirname);
+void debugtimestamp();
#endif
common.o: common.c common.h
ifinfo.o: ifinfo.c ifinfo.h common.h dbaccess.h misc.h cfg.h
dbaccess.o: dbaccess.c dbaccess.h common.h
-dbcache.o: dbcache.c dbcache.h dbaccess.h common.h ifinfo.h
+dbcache.o: dbcache.c dbcache.h dbaccess.h common.h ifinfo.h cfg.h
cfg.o: cfg.c cfg.h common.h
misc.o: misc.c misc.h common.h