Code Monkey home page Code Monkey logo

Comments (5)

SilentFlower avatar SilentFlower commented on June 19, 2024

没事了已经解决

from serverstatus-hotaru.

laogui2008 avatar laogui2008 commented on June 19, 2024

今天遇到类似问题,网速统计不正确,写下自己的解决方法,以后有碰到同样问题的朋友,可参考下

修改方法:修改status-client.py文件的代码,具体代码在类Traffic的get方法中,将不需要统计流量的网卡接口排除即可

根据status.sh可知,status-client.py文件在/usr/local/ServerStatus/client目录下

先用 cat /proc/net/dev 命令查看网卡有哪些,我的是:lo、eth0、docker0、br-1bfaa12c35f1、vethf0edf50、veth9b7a34d
实际上,我只需要统计eth0的流量,其他都不要,在代码中排除即可

将原代码
if dev[0].strip() == "lo" or dev[0].find("tun") > -1
改成
if dev[0].strip() == "lo" or dev[0].strip() == "docker0" or dev[0].find("br-") > -1 or dev[0].find("veth") > -1 or dev[0].find("tun") > -1

最后用 bash status.sh c 命令重启客户端

from serverstatus-hotaru.

cokemine avatar cokemine commented on June 19, 2024

@laogui2008 谢谢,这个issue打开后直接关闭了。我没有看到这个issue,如果使用vnStat计算流量的话应该不会存在这个问题,因为是指定网口的。或许我们把流量计算默认直接排除掉docker的流量比较好?

from serverstatus-hotaru.

laogui2008 avatar laogui2008 commented on June 19, 2024

@cokemine 一般来说,大部分人在使用过程中应该是很少关注docker内网的流量使用情况的,更多的是关注对外的流量使用情况。理论上,为了适应大部分人的使用习惯,是应该排除掉docker内网的流量比较好。但使用docker虚拟出来的网卡,不同的机子得到的可能是不一样的,排除起来可能有一些困难。该怎么排除,需要考虑考虑。
事实上,可能同时使用docker和探针的人比较少,所以提出相关issue不多。
如果真要做,就要辛苦大佬你了。

from serverstatus-hotaru.

cokemine avatar cokemine commented on June 19, 2024

fix in 56b5587

from serverstatus-hotaru.

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.