Git Product home page Git Product logo

Comments (3)

ccinoo avatar ccinoo commented on July 17, 2024

这里的版本实现了使用vnstat来统计月度使用量
https://github.com/P3TERX/ServerStatus-V
大佬要不要考虑下也使用vnstat?

这个可以有,我支持!!

from serverstatus.

stardock avatar stardock commented on July 17, 2024

只需要把client.py的代码修正如下即可,感谢大佬的开发。
使用前一定要调试好vnstat,避免报错

def liuliang():
	NET_IN = 0
	NET_OUT = 0
	vnstat=os.popen('vnstat --dumpdb').readlines()
	for line in vnstat:
		if line[0:4] == "m;0;":
			mdata=line.split(";")
			NET_IN=int(mdata[3])*1024*1024
			NET_OUT=int(mdata[4])*1024*1024
			break
	return NET_IN, NET_OUT

from serverstatus.

xiaolugu avatar xiaolugu commented on July 17, 2024

vnstat更新版本(2.0以上)已经不支持--dumpdb参数,请使用:

def liuliang():
        NET_IN = 0
        NET_OUT = 0
        vnstat=os.popen('vnstat --oneline b').readline()
        mdata=vnstat.split(";")
        NET_IN=int(mdata[8])
        NET_OUT=int(mdata[9])
        return NET_IN, NET_OUT

from serverstatus.

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.