]> granicus.if.org Git - vnstat/commitdiff
rename TrafficlessDays -> TrafficlessEntries configuration option as the setting...
authorTeemu Toivola <git@humdi.net>
Thu, 13 Sep 2018 17:55:21 +0000 (20:55 +0300)
committerTeemu Toivola <git@humdi.net>
Thu, 13 Sep 2018 17:55:21 +0000 (20:55 +0300)
UPGRADE
cfg/vnstat.conf
man/vnstat.conf.5
src/cfg.c
src/cfgoutput.c
src/common.h
src/daemon.c
tests/daemon_tests.c

diff --git a/UPGRADE b/UPGRADE
index 281cf80dbcda979ad24a04e3a7e654b37ff1d34e..e3de390f483a11f8f7b2924c055fda585d5b1b3c 100644 (file)
--- a/UPGRADE
+++ b/UPGRADE
@@ -4,7 +4,7 @@ New configuration settings
 
 2.0: List5Mins, ListHours, ListDays, ListMonths, ListYears, ListTop,
      5MinuteHours, HourlyDays, DailyDays, MonthlyMonths, YearlyYears,
-     TopDayEntries, MonthRotateAffectsYears
+     TopDayEntries, MonthRotateAffectsYears, TrafficlessEntries
 
 1.18: TimeSyncWait, DefaultDecimals, HourlyDecimals, HourlySectionStyle
 
index 3c06f1803131fafa75fb07601614867806619b7b..8de17d8e1fd5a57f239a71816ddd5be8e2100792 100644 (file)
@@ -116,8 +116,8 @@ CheckDiskSpace 1
 # how much the boot time can variate between updates (seconds)
 BootVariation 15
 
-# log days without traffic to daily list (1 = enabled, 0 = disabled)
-TrafficlessDays 1
+# create database entries even when there is no traffic (1 = enabled, 0 = disabled)
+TrafficlessEntries 1
 
 # how many minutes to wait during daemon startup for system clock to
 # sync time if most recent database update appears to be in the future
index b8bc30d6f1c793ed23c4176b3eabf5c58a56ebc1..3ca6b8346462d3a48fbb7babb2b047290f411a08 100644 (file)
@@ -293,8 +293,9 @@ unlimited entries or to 0 to disable the data collection of this
 resolution.
 
 .TP
-.B TrafficlessDays
-Log days without any traffic to daily list. 1 = enabled, 0 = disabled.
+.B TrafficlessEntries
+Create database entries even when there is no traffic during the entry's time
+period. 1 = enabled, 0 = disabled.
 
 .TP
 .B UpdateFileOwner
index dd67988c843433ff551d129b6f5dff17913ecbbc..a6f4dbe47905bd2f3644f0a3beb5938412be7add 100644 (file)
--- a/src/cfg.c
+++ b/src/cfg.c
@@ -36,7 +36,7 @@ int loadcfg(const char *cfgfile)
                { "QueryMode", 0, &cfg.qmode, 0, 0 },
                { "CheckDiskSpace", 0, &cfg.spacecheck, 0, 0 },
                { "BootVariation", 0, &cfg.bvar, 0, 0 },
-               { "TrafficlessDays", 0, &cfg.traflessday, 0, 0 },
+               { "TrafficlessEntries", 0, &cfg.trafficlessentries, 0, 0 },
                { "List5Mins", 0, &cfg.listfivemins, 0, 0 },
                { "ListHours", 0, &cfg.listhours, 0, 0 },
                { "ListDays", 0, &cfg.listdays, 0, 0 },
@@ -324,9 +324,9 @@ void validatecfg(void)
                printe(PT_Config);
        }
 
-       if (cfg.traflessday<0 || cfg.traflessday>1) {
-               cfg.traflessday = TRAFLESSDAY;
-               snprintf(errorstring, 1024, "%s TrafficlessDays, %s \"%d\".", invalidvalue, resettingto, cfg.traflessday);
+       if (cfg.trafficlessentries<0 || cfg.trafficlessentries>1) {
+               cfg.trafficlessentries = TRAFFICLESSENTRIES;
+               snprintf(errorstring, 1024, "%s TrafficlessEntries, %s \"%d\".", invalidvalue, resettingto, cfg.trafficlessentries);
                printe(PT_Config);
        }
 
@@ -437,7 +437,7 @@ void defaultcfg(void)
        cfg.spacecheck = USESPACECHECK;
        cfg.hourlyrate = HOURLYRATE;
        cfg.summaryrate = SUMMARYRATE;
-       cfg.traflessday = TRAFLESSDAY;
+       cfg.trafficlessentries = TRAFFICLESSENTRIES;
        cfg.utflocale = UTFLOCALE;
 
        cfg.listfivemins = LISTFIVEMINS;
index e4545656e01a6a19e9c7c8f33d8298ce9d8cbf67..19c5a652beaaa9be207ac736e54272f02cce2c33 100644 (file)
@@ -131,8 +131,8 @@ void printcfgfile(void)
        printf("# how much the boot time can variate between updates (seconds)\n");
        printf("BootVariation %d\n\n", cfg.bvar);
 
-       printf("# log days without traffic to daily list (1 = enabled, 0 = disabled)\n");
-       printf("TrafficlessDays %d\n\n", cfg.traflessday);
+       printf("# create database entries even when there is no traffic (1 = enabled, 0 = disabled)\n");
+       printf("TrafficlessEntries %d\n\n", cfg.trafficlessentries);
 
        printf("# how many minutes to wait during daemon startup for system clock to\n");
        printf("# sync time if most recent database update appears to be in the future\n");
index d53b07d028cb4746158444bd8d5a9602b017fa0b..527c48591f8f33da6b51893cd13c3df2d233ae14 100644 (file)
@@ -161,8 +161,8 @@ and most can be changed later from the config file.
 /* check disk space by default */
 #define USESPACECHECK 1
 
-/* log trafficless days by default */
-#define TRAFLESSDAY 1
+/* create trafficless entries by default */
+#define TRAFFICLESSENTRIES 1
 
 /* list outputs */
 #define LISTFIVEMINS 24
@@ -267,7 +267,7 @@ typedef struct {
        char cbg[8], cedge[8], cheader[8], cheadertitle[8], cheaderdate[8], ctext[8];
        char cline[8], clinel[8], cvnstat[8], crx[8], crxd[8], ctx[8], ctxd[8];
        int32_t unitmode, rateunitmode, rateunit, bvar, qmode, sampletime, hourlyrate, summaryrate;
-       int32_t monthrotate, monthrotateyears, maxbw, spacecheck, traflessday, transbg, ostyle;
+       int32_t monthrotate, monthrotateyears, maxbw, spacecheck, trafficlessentries, transbg, ostyle;
        int32_t defaultdecimals, hourlydecimals, hourlystyle;
        char cfgfile[512], logfile[512], pidfile[512];
        char daemonuser[33], daemongroup[33];
index 789cb13158690756289d06838f0e5f82b07b9e29..ad853f41492855ad9b8378966a485be6e27dc58b 100644 (file)
@@ -549,7 +549,7 @@ int processifinfo(DSTATE *s, datacache **dc)
                        }
                }
 
-               if (rxchange || txchange || cfg.traflessday) {
+               if (rxchange || txchange || cfg.trafficlessentries) {
                        xferlog_add(&(*dc)->log, ifinfo.timestamp - (ifinfo.timestamp % 300), rxchange, txchange);
                }
        }
index e4e69576ed8fa2e95527451b03313ae78752d3c1..d6a98f5a0ea001e93a364dceb9c4c639f90b4313 100644 (file)
@@ -1314,7 +1314,7 @@ START_TEST(processifinfo_does_not_add_traffic_when_over_limit)
        ifinfo.rx = 1111111;
        ifinfo.tx = 2222222;
        ifinfo.timestamp = 250;
-       cfg.traflessday = 0;
+       cfg.trafficlessentries = 0;
 
        ck_assert_int_eq(datacache_count(&s.dcache), 0);
        ret = datacache_add(&s.dcache, "ethsomething", 0);
@@ -1349,7 +1349,7 @@ START_TEST(processifinfo_adds_zero_traffic_when_over_limit)
        ifinfo.rx = 1111111;
        ifinfo.tx = 2222222;
        ifinfo.timestamp = 250;
-       cfg.traflessday = 1;
+       cfg.trafficlessentries = 1;
 
        ck_assert_int_eq(datacache_count(&s.dcache), 0);
        ret = datacache_add(&s.dcache, "ethsomething", 0);