Coder Social home page Coder Social logo

Comments (6)

pegasusearl avatar pegasusearl commented on July 23, 2024 2

When I tried stop vnstat.service , delete, create, start vnstat.service.
It works, it got reset. But I'm still confused with the vnstat -r.
thank you. :D

from vnstat.

Sim4n6 avatar Sim4n6 commented on July 23, 2024 1

Can you provide us with the output of :
vnstat -D -r
whoami
ls -la /var/lib/vnstat
sudo service vnstat status
sudo chown -R vnstat:vnstat /var/lib/vnstat

from vnstat.

vergoh avatar vergoh commented on July 23, 2024 1

The service (vnstatd) needs to be stopped when modifying the databases directly or with the vnstat command. Otherwise, the daemon will overwrite any modifications with the data it keeps in a memory buffer.

from vnstat.

pegasusearl avatar pegasusearl commented on July 23, 2024

Sure

# vnstat -D -r

Config file: /etc/vnstat.conf
  c: Interface "wlp3s0"
   -> "Interface": "wlp3s0"
  c: DatabaseDir "/var/lib/vnstat"
   -> "DatabaseDir": "/var/lib/vnstat"
  c: Locale "-"
   -> "Locale": "-"
  i: MonthRotate 1
   -> "MonthRotate": 1
  c: DayFormat    "%x"
   -> "DayFormat": "%x"
  c: MonthFormat  "%b '%y"
   -> "MonthFormat": "%b '%y"
  c: TopFormat    "%x"
   -> "TopFormat": "%x"
  c: RXCharacter       "%"
   -> "RXCharacter": "%"
  c: TXCharacter       ":"
   -> "TXCharacter": ":"
  c: RXHourCharacter   "r"
   -> "RXHourCharacter": "r"
  c: TXHourCharacter   "t"
   -> "TXHourCharacter": "t"
  i: UnitMode 0
   -> "UnitMode": 0
  i: RateUnitMode 1
   -> "RateUnitMode": 1
  i: OutputStyle 3
   -> "OutputStyle": 3
  i: RateUnit 1
   -> "RateUnit": 1
  i: BandwidthDetection 1
   -> "BandwidthDetection": 1
  i: MaxBandwidth 1000
   -> "MaxBandwidth": 1000
  i: Sampletime 5
   -> "Sampletime": 5
  i: QueryMode 0
   -> "QueryMode": 0
  i: CheckDiskSpace 1
   -> "CheckDiskSpace": 1
  i: UseFileLocking 1
   -> "UseFileLocking": 1
  i: BootVariation 15
   -> "BootVariation": 15
  i: TrafficlessDays 1
   -> "TrafficlessDays": 1
  c: DaemonUser ""
   -> "DaemonUser" with no value, keeping default.
  c: DaemonGroup ""
   -> "DaemonGroup" with no value, keeping default.
  i: UpdateInterval 30
   -> "UpdateInterval": 30
  i: PollInterval 5
   -> "PollInterval": 5
  i: SaveInterval 5
   -> "SaveInterval": 5
  i: OfflineSaveInterval 30
   -> "OfflineSaveInterval": 30
  i: BandwidthDetectionInterval 5
   -> "BandwidthDetectionInterval": 5
  i: SaveOnStatusChange 1
   -> "SaveOnStatusChange": 1
  i: UseLogging 2
   -> "UseLogging": 2
  i: CreateDirs 1
   -> "CreateDirs": 1
  i: UpdateFileOwner 1
   -> "UpdateFileOwner": 1
  c: LogFile "/var/log/vnstat/vnstat.log"
   -> "LogFile": "/var/log/vnstat/vnstat.log"
  c: PidFile "/var/run/vnstat/vnstat.pid"
   -> "PidFile": "/var/run/vnstat/vnstat.pid"
  c: HeaderFormat "%x %H:%M"
   -> "HeaderFormat": "%x %H:%M"
  i: HourlyRate 1
   -> "HourlyRate": 1
  i: SummaryRate 1
   -> "SummaryRate": 1
  i: SummaryLayout 1
   -> "SummaryLayout": 1
  i: TransparentBg 0
   -> "TransparentBg": 0
  c: CBackground     "FFFFFF"
   -> "CBackground": "FFFFFF"
  c: CEdge           "AEAEAE"
   -> "CEdge": "AEAEAE"
  c: CHeader         "606060"
   -> "CHeader": "606060"
  c: CHeaderTitle    "FFFFFF"
   -> "CHeaderTitle": "FFFFFF"
  c: CHeaderDate     "FFFFFF"
   -> "CHeaderDate": "FFFFFF"
  c: CText           "000000"
   -> "CText": "000000"
  c: CLine           "B0B0B0"
   -> "CLine": "B0B0B0"
  c: CLineL          "-"
   -> "CLineL": "-"
  c: CRx             "92CF00"
   -> "CRx": "92CF00"
  c: CTx             "606060"
   -> "CTx": "606060"
  c: CRxD            "-"
   -> "CRxD": "-"
  c: CTxD            "-"
   -> "CTxD": "-"
Config file: /etc/vnstat.conf
ibw list is empty.
arg 1: "-D"
arg 2: "-r"
Dir OK
2 file(s) found
bsize 4096
blocks 15218054
bfree 12043256
bavail 11883887
ffree 3283795
47535548 free space left
db: Database loaded for interface "wlp3s0"...
validating loaded database
db: Database "/var/lib/vnstat/wlp3s0" saved.
Counters reseted for "wlp3s0"

# whoami
root

# ls -la /var/lib/vnstat

total 24
drwxr-xr-x  2 root root 4096 Jul  1 15:45 .
drwxr-xr-x 35 root root 4096 Jul  1 17:05 ..
-rw-r--r--  1 root root 2792 Jul  1 18:15 enp2s0
-rw-r--r--  1 root root 2792 Jul  1 18:15 .enp2s0
-rw-r--r--  1 root root 2792 Jul  1 18:15 wlp3s0
-rw-r--r--  1 root root 2792 Jul  1 18:15 .wlp3s0

$ sudo service vnstat status .. has no output, I guess you mean this? $ sudo systemctl status vnstat

 ● vnstat.service - vnStat network traffic monitor
   Loaded: loaded (/usr/lib/systemd/system/vnstat.service; enabled; vendor prese
   Active: active (running) since Sat 2017-07-01 16:55:41 WIB; 1h 25min ago
     Docs: man:vnstatd(1)
           man:vnstat(1)
           man:vnstat.conf(5)
 Main PID: 513 (vnstatd)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/vnstat.service
           └─513 /usr/sbin/vnstatd -n

Jul 01 16:55:41 pierot systemd[1]: Started vnStat network traffic monitor.
Jul 01 16:55:42 pierot vnstatd[513]: Info: vnStat daemon 1.17 started. (pid:513 
Jul 01 16:55:42 pierot vnstatd[513]: Info: Monitoring: wlp3s0 (1000 Mbit) enp2s0 

$ sudo chown -R vnstat:vnstat /var/lib/vnstat
chown: invalid user: ‘vnstat:vnstat’

from vnstat.

pegasusearl avatar pegasusearl commented on July 23, 2024

I tried 'disable and reboot'; stopped, and masked the vnstat.service (one by one) but somehow It still run. (maybe)
I forgot to mention, I'm in antergos/archlinux.
Am I doing it wrong again?

[root@pierot hitman]# systemctl stop vnstat
[root@pierot hitman]# systemctl status vnstat
● vnstat.service - vnStat network traffic monitor
   Loaded: loaded (/usr/lib/systemd/system/vnstat.service; enabled; vendor prese
   Active: inactive (dead) since Sat 2017-07-01 19:14:49 WIB; 15s ago
     Docs: man:vnstatd(1)
           man:vnstat(1)
           man:vnstat.conf(5)
 Main PID: 1281 (code=exited, status=0/SUCCESS)

Jul 01 19:14:05 pierot systemd[1]: Started vnStat network traffic monitor.
Jul 01 19:14:05 pierot vnstatd[1281]: Info: vnStat daemon 1.17 started. (pid:128
Jul 01 19:14:05 pierot vnstatd[1281]: Info: Monitoring: wlp3s0 (1000 Mbit) enp2s
Jul 01 19:14:49 pierot vnstatd[1281]: Info: SIGTERM received, exiting.
Jul 01 19:14:49 pierot systemd[1]: Stopping vnStat network traffic monitor...
Jul 01 19:14:49 pierot systemd[1]: Stopped vnStat network traffic monitor.

[root@pierot hitman]# vnstat -r -D
Config file: /etc/vnstat.conf
  c: Interface "wlp3s0"
   -> "Interface": "wlp3s0"
  c: DatabaseDir "/var/lib/vnstat"
   -> "DatabaseDir": "/var/lib/vnstat"
  c: Locale "-"
   -> "Locale": "-"
  i: MonthRotate 1
   -> "MonthRotate": 1
  c: DayFormat    "%x"
   -> "DayFormat": "%x"
  c: MonthFormat  "%b '%y"
   -> "MonthFormat": "%b '%y"
  c: TopFormat    "%x"
   -> "TopFormat": "%x"
  c: RXCharacter       "%"
   -> "RXCharacter": "%"
  c: TXCharacter       ":"
   -> "TXCharacter": ":"
  c: RXHourCharacter   "r"
   -> "RXHourCharacter": "r"
  c: TXHourCharacter   "t"
   -> "TXHourCharacter": "t"
  i: UnitMode 0
   -> "UnitMode": 0
  i: RateUnitMode 1
   -> "RateUnitMode": 1
  i: OutputStyle 3
   -> "OutputStyle": 3
  i: RateUnit 1
   -> "RateUnit": 1
  i: BandwidthDetection 1
   -> "BandwidthDetection": 1
  i: MaxBandwidth 1000
   -> "MaxBandwidth": 1000
  i: Sampletime 5
   -> "Sampletime": 5
  i: QueryMode 0
   -> "QueryMode": 0
  i: CheckDiskSpace 1
   -> "CheckDiskSpace": 1
  i: UseFileLocking 1
   -> "UseFileLocking": 1
  i: BootVariation 15
   -> "BootVariation": 15
  i: TrafficlessDays 1
   -> "TrafficlessDays": 1
  c: DaemonUser ""
   -> "DaemonUser" with no value, keeping default.
  c: DaemonGroup ""
   -> "DaemonGroup" with no value, keeping default.
  i: UpdateInterval 30
   -> "UpdateInterval": 30
  i: PollInterval 5
   -> "PollInterval": 5
  i: SaveInterval 5
   -> "SaveInterval": 5
  i: OfflineSaveInterval 30
   -> "OfflineSaveInterval": 30
  i: BandwidthDetectionInterval 5
   -> "BandwidthDetectionInterval": 5
  i: SaveOnStatusChange 1
   -> "SaveOnStatusChange": 1
  i: UseLogging 2
   -> "UseLogging": 2
  i: CreateDirs 1
   -> "CreateDirs": 1
  i: UpdateFileOwner 1
   -> "UpdateFileOwner": 1
  c: LogFile "/var/log/vnstat/vnstat.log"
   -> "LogFile": "/var/log/vnstat/vnstat.log"
  c: PidFile "/var/run/vnstat/vnstat.pid"
   -> "PidFile": "/var/run/vnstat/vnstat.pid"
  c: HeaderFormat "%x %H:%M"
   -> "HeaderFormat": "%x %H:%M"
  i: HourlyRate 1
   -> "HourlyRate": 1
  i: SummaryRate 1
   -> "SummaryRate": 1
  i: SummaryLayout 1
   -> "SummaryLayout": 1
  i: TransparentBg 0
   -> "TransparentBg": 0
  c: CBackground     "FFFFFF"
   -> "CBackground": "FFFFFF"
  c: CEdge           "AEAEAE"
   -> "CEdge": "AEAEAE"
  c: CHeader         "606060"
   -> "CHeader": "606060"
  c: CHeaderTitle    "FFFFFF"
   -> "CHeaderTitle": "FFFFFF"
  c: CHeaderDate     "FFFFFF"
   -> "CHeaderDate": "FFFFFF"
  c: CText           "000000"
   -> "CText": "000000"
  c: CLine           "B0B0B0"
   -> "CLine": "B0B0B0"
  c: CLineL          "-"
   -> "CLineL": "-"
  c: CRx             "92CF00"
   -> "CRx": "92CF00"
  c: CTx             "606060"
   -> "CTx": "606060"
  c: CRxD            "-"
   -> "CRxD": "-"
  c: CTxD            "-"
   -> "CTxD": "-"
Config file: /etc/vnstat.conf
ibw list is empty.
arg 1: "-r"
arg 2: "-D"
Dir OK
2 file(s) found
bsize 4096
blocks 15218054
bfree 12043176
bavail 11883807
ffree 3283795
47535228 free space left
db: Database loaded for interface "wlp3s0"...
validating loaded database
db: Database "/var/lib/vnstat/wlp3s0" saved.
Counters reseted for "wlp3s0"
[root@pierot hitman]# 
[root@pierot hitman]# vnstat

                      rx      /      tx      /     total    /   estimated
 enp2s0: Not enough data available yet.
 wlp3s0:
       Jul '17    887.69 MiB  /  102.94 MiB  /  990.63 MiB  /   58.57 GiB
         today    887.69 MiB  /  102.94 MiB  /  990.63 MiB  /    1.20 GiB
[root@pierot hitman]# vnstat -l
Monitoring wlp3s0...    (press CTRL-C to stop)

   rx:        0 kbit/s     0 p/s          tx:        0 kbit/s     0 p/s^C


 wlp3s0  /  traffic statistics

                           rx         |       tx
--------------------------------------+------------------
  bytes                       24 KiB  |          11 KiB
--------------------------------------+------------------
          max              55 kbit/s  |       33 kbit/s
      average           16.11 kbit/s  |     7.50 kbit/s
          min               0 kbit/s  |        0 kbit/s
--------------------------------------+------------------
  packets                         63  |              63
--------------------------------------+------------------
          max                 18 p/s  |          18 p/s
      average                  5 p/s  |           5 p/s
          min                  0 p/s  |           0 p/s
--------------------------------------+------------------
  time                    12 seconds
[root@pierot hitman]# systemctl start vnstat
[root@pierot hitman]# systemctl status vnstat
● vnstat.service - vnStat network traffic monitor
   Loaded: loaded (/usr/lib/systemd/system/vnstat.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2017-07-01 19:25:56 WIB; 1min 19s ago
     Docs: man:vnstatd(1)
           man:vnstat(1)
           man:vnstat.conf(5)
 Main PID: 1979 (vnstatd)
   CGroup: /system.slice/vnstat.service
           └─1979 /usr/sbin/vnstatd -n

Jul 01 19:25:56 pierot systemd[1]: Started vnStat network traffic monitor.
Jul 01 19:25:56 pierot vnstatd[1979]: Info: vnStat daemon 1.17 started. (pid:1979 uid:0 gid:0)
Jul 01 19:25:56 pierot vnstatd[1979]: Info: Monitoring: wlp3s0 (1000 Mbit) enp2s0 (10 Mbit)
[root@pierot hitman]# vnstat

                      rx      /      tx      /     total    /   estimated
 enp2s0: Not enough data available yet.
 wlp3s0:
       Jul '17    887.69 MiB  /  102.94 MiB  /  990.63 MiB  /   58.57 GiB
         today    887.69 MiB  /  102.94 MiB  /  990.63 MiB  /    1.20 GiB


from vnstat.

vergoh avatar vergoh commented on July 23, 2024

When in doubt, check the man page :)

   -r, --reset
          Reset  the  internal counters in the database for the selected interface. Use this if the interface goes down and back up,
          otherwise that interface will get some extra traffic to its database.  Not needed when the daemon is used.

But thanks for pointing out what caused confusion. I'll either rephrase the help output or drop this parameter in case it has no use with the upcoming sql database.

from vnstat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.