-# vnStat 1.12 config file
+# vnStat 1.13 config file
##
# default interface
# how often (in minutes) data is saved when all interface are offline
OfflineSaveInterval 30
+# how often (in minutes) bandwidth detection is redone when
+# BandwidthDetection is enabled (0 = disabled)
+BandwidthDetectionInterval 5
+
# force data save when interface status changes (1 = enabled, 0 = disabled)
SaveOnStatusChange 1
printf("# how often (in minutes) data is saved when all interface are offline\n");
printf("OfflineSaveInterval %d\n\n", cfg.offsaveinterval);
+ printf("# how often (in minutes) bandwidth detection is redone when\n");
+ printf("# BandwidthDetection is enabled (0 = disabled)\n");
+ printf("BandwidthDetectionInterval %d\n\n", cfg.bwdetectioninterval);
+
printf("# force data save when interface status changes (1 = enabled, 0 = disabled)\n");
printf("SaveOnStatusChange %d\n\n", cfg.savestatus);
{ "PollInterval", 0, &cfg.pollinterval, 0, 0 },
{ "SaveInterval", 0, &cfg.saveinterval, 0, 0 },
{ "OfflineSaveInterval", 0, &cfg.offsaveinterval, 0, 0 },
+ { "BandwidthDetectionInterval", 0, &cfg.bwdetectioninterval, 0, 0 },
{ "SaveOnStatusChange", 0, &cfg.savestatus, 0, 0 },
{ "UseLogging", 0, &cfg.uselogging, 0, 0 },
{ "CreateDirs", 0, &cfg.createdirs, 0, 0 },
} /* while */
+ fclose(fd);
+
/* validate config */
validatecfg();
snprintf(errorstring, 512, "Invalid value for BandwidthDetection, resetting to \"%d\".", cfg.bwdetection);
printe(PT_Config);
}
+
+ if (cfg.bwdetectioninterval<0 || cfg.bwdetectioninterval>30) {
+ cfg.bwdetectioninterval = BWDETECTINTERVAL;
+ snprintf(errorstring, 512, "Invalid value for BandwidthDetectionInterval, resetting to \"%d\".", cfg.bwdetectioninterval);
+ printe(PT_Config);
+ }
}
void defaultcfg(void)
cfg.ostyle = OSTYLE;
cfg.rateunit = RATEUNIT;
cfg.bwdetection = BWDETECT;
+ cfg.bwdetectioninterval = BWDETECTINTERVAL;
cfg.maxbw = DEFMAXBW;
cfg.spacecheck = USESPACECHECK;
cfg.flock = USEFLOCK;
/* bandwidth detection, 0 = feature disabled */
#define BWDETECT 1
+#define BWDETECTINTERVAL 5
/* default maximum bandwidth (Mbit) for all interfaces */
/* 0 = feature disabled */
char logfile[512], pidfile[512];
char daemonuser[33], daemongroup[33];
short updateinterval, pollinterval, saveinterval, offsaveinterval, savestatus, uselogging;
- short createdirs, updatefileowner, bwdetection;
+ short createdirs, updatefileowner, bwdetection, bwdetectioninterval;
} CFG;
/* internal interface information structure */