sfpprxy / portmon Goto Github PK
View Code? Open in Web Editor NEWSimple tool to get network traffic statistics of each port; Port traffic monitor
License: MIT License
Simple tool to get network traffic statistics of each port; Port traffic monitor
License: MIT License
安装环境:Centos 7 通过GIT拉取项目
步骤:
1、拉取文件,添加权限
2、修改ini文件中的端口,执行安装
3、curl localhost:9000
奇怪的是只要我不修改默认监视端口(22和9000)就不会出现这个错误,但我修改了ini文件中的监视端口后就会报错。
报错内容:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>Error: 500 Internal Server Error</title>
<style type="text/css">
html {background-color: #eee; font-family: sans-serif;}
body {background-color: #fff; border: 1px solid #ddd;
padding: 15px; margin: 15px;}
pre {background-color: #eee; border: 1px solid #ddd; padding: 5px;}
</style>
</head>
<body>
<h1>Error: 500 Internal Server Error</h1>
<p>Sorry, the requested URL <tt>'http://localhost:9000/'</tt>
caused an error:</p>
<pre>Internal Server Error</pre>
</body>
</html>
日志文件:
2020-07-22 05:22:02,998 [MainThread ] {/usr/bin/portmon.py:153} [INFO ] get_statistic of
2020-07-22 05:22:18,710 [TrafficMonit] {/usr/bin/portmon.py:115} [DEBUG] {'10', '1'}
2020-07-22 05:22:18,724 [TrafficMonit] {/usr/bin/portmon.py:126} [DEBUG] init usage_disk{'22': 0, '9000': 0}
2020-07-22 05:22:18,725 [TrafficMonit] {/usr/bin/portmon.py:141} [DEBUG] {'22': 0, '9000': 0}
2020-07-22 05:23:18,793 [TrafficMonit] {/usr/bin/portmon.py:115} [DEBUG] {'10', '1'}
2020-07-22 05:23:18,807 [TrafficMonit] {/usr/bin/portmon.py:126} [DEBUG] init usage_disk{'22': 0, '9000': 0}
2020-07-22 05:23:18,808 [TrafficMonit] {/usr/bin/portmon.py:141} [DEBUG] {'22': 0, '9000': 0}
2020-07-22 05:24:18,879 [TrafficMonit] {/usr/bin/portmon.py:115} [DEBUG] {'10', '1'}
2020-07-22 05:24:18,891 [TrafficMonit] {/usr/bin/portmon.py:126} [DEBUG] init usage_disk{'22': 0, '9000': 0}
2020-07-22 05:24:18,892 [TrafficMonit] {/usr/bin/portmon.py:141} [DEBUG] {'22': 0, '9000': 0}
2020-07-22 05:25:18,961 [TrafficMonit] {/usr/bin/portmon.py:115} [DEBUG] {'10', '1'}
2020-07-22 05:25:18,971 [TrafficMonit] {/usr/bin/portmon.py:126} [DEBUG] init usage_disk{'22': 0, '9000': 0}
2020-07-22 05:25:18,972 [TrafficMonit] {/usr/bin/portmon.py:141} [DEBUG] {'22': 0, '9000': 0}
今天刚好遇到了,看了下service status里面好像有错误提示,麻烦帮忙看看。
Apr 05 13:03:28 robot python3[6583]: @ÀrÀv
Apr 05 13:03:28 robot python3[6583]: ¾
Apr 05 13:03:28 robot python3[6583]: ½À" 400 -
Apr 05 13:03:28 robot python3[6583]: 47.102.184.30 - - [05/Apr/2020 13:03:28] "GET /HNAP1 HTTP/1.1" 404 -
Apr 05 13:03:28 robot python3[6583]: 47.102.184.30 - - [05/Apr/2020 13:03:28] code 400, message Bad request syntax ('\x16\x03\x01\x02\x00\x01\x00\x01ü\x03\x03\x0ejQüMÍ\x89¦9')
Apr 05 13:03:28 robot python3[6583]: [46B blob data]
Apr 05 13:03:28 robot python3[6583]: [1B blob data]
Apr 05 13:03:28 robot python3[6583]: [25B blob data]
Apr 05 13:03:28 robot python3[6583]: 47.102.184.30 - - [05/Apr/2020 13:03:28] "GET /nmaplowercheck1586063006 HTTP/1.1" 404 -
Apr 05 13:03:28 robot python3[6583]: 47.102.184.30 - - [05/Apr/2020 13:03:28] code 400, message Bad request syntax ("\x16\x03\x01\x02\x00\x01\x00\x01ü\x03\x03æbp\x05Ô\x052\x19µ\x90\x1dÜü\x8a_bÐ×S\x89)\x015\x88°ÇËKþ\x82Cè Ô\x83k\x165P0«¼
eïÙ0G#\x0e¬ÿ8{Ë\x12]\xad9ßÝ(6\x0c\x89\x85\x00\x9c\x13\x02\x13\x03\x13\x01\x003\x009\x005\x00/À,À0\x00£\x00\x9f̨̩̪À¯À\xadÀ£À\x9fÀ]ÀaÀWÀSÀ+À/\x00¢\x00\x9eÀ®À¬À¢À\x9eÀ\À`ÀVÀRÀ$À(\x00k\x00jÀsÀw\x00Ä\x00ÃÀ#À'\x00g\x00@ÀrÀv\x00¾\x00½À")
新版还是会偶尔卡死curl不出数据,
service portmon status里面没有提示什么错误,restart以后正常。
提示这个curl: (7) Failed to connect to 161...* port 9000: Timed out,服务器是正常的。
清零以后的几天是准确的,我也不知道具体多久开始统计的数据不准,我一般30天清零一次,就差不多快到30天的样子,我发现统计的数据和实际的流量数据是对不上的。
文本部分是这个月还没执行清零的数据,图片也是这个月的数据,实际算下来的话是对不上的,清零的时候是否要把data,data_daily也一起删除?
Chain INPUT (policy ACCEPT 46090006 packets, 63728590995 bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 36573161 packets, 65242725295 bytes)
pkts bytes target prot opt in out source destination
1521 61036 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:18025
1412290 1968559626 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:18005
26776 68875716 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:18045
180038 54744811 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:18103
1286295 3761795276 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:18111
29763 68148337 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:18154
463320 132358757 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:18165
2 88 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:18125
28 1120 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:18022
230118 780653216 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:18063
11 440 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:18130
7655412 19841725442 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:18094
1874 10494223 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:18174
4909092 13449168273 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:18066
5678177 20011020505 tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp spt:18023
能否增加一个清零数据功能?
手动清零数据还是弄不太懂具体怎么操作。
最新版安装以后 反倒无法正常工作了
1 安装以后指定端口后,不会更新端口的流量信息,我用iptable -nxvL看了下,指定的端口没有加入到规则里面
2 如果之前有~/.portmon 下有data和portmon.log 这两个文件里面有数据,会导致程序出错,curl出来的数据变成错误500
<html>
<head>
<title>Error: 500 Internal Server Error</title>
<style type="text/css">
html {background-color: #eee; font-family: sans-serif;}
body {background-color: #fff; border: 1px solid #ddd;
padding: 15px; margin: 15px;}
pre {background-color: #eee; border: 1px solid #ddd; padding: 5px;}
</style>
</head>
<body>
<h1>Error: 500 Internal Server Error</h1>
<p>Sorry, the requested URL <tt>'http://**.**.152.200:9000/'</tt>
caused an error:</p>
<pre>Internal Server Error</pre>
</body>
</html>
Is there an easy way to monitor the port range like ‘4000:9000’ with the config?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.