<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://jackxiang.com/post//</link>
<title><![CDATA[Linux下网络流量监控netuse使用]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Unix/LinuxC技术]]></category>
<pubDate>Sun, 26 Jun 2016 03:35:35 +0000</pubDate> 
<guid>http://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	git clone https://github.com/dufferzafar/netuse /usr/local/netuse<br/>cd /usr/local/netuse<br/>cp config.py.example config.py<br/>ln -s netuse.py /usr/bin/netuse<br/><br/>Crontab：<br/><textarea name="code" class="php" rows="15" cols="100">
#linux network watch&nbsp;&nbsp;netuse
*/2 * * * * /usr/local/netuse/dumper
</textarea><br/><br/><br/>vi /usr/bin/netuse <br/>#!/usr/bin/python3&nbsp;&nbsp;<br/>不存在python3怎么办？<br/> ln -s /usr/bin/python /usr/bin/python3<br/><br/><br/>vi /usr/local/netuse/dumper 把网卡修改成自己的网卡eth1：<br/># which registers itself as a ppp device.<br/>echo $(cat /sys/class/net/ppp0/statistics/rx_bytes)&quot;;&quot;$(date +%s) &gt;&gt; ~/.net/$year/$month/down/$date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>echo $(cat /sys/class/net/ppp0/statistics/tx_bytes)&quot;;&quot;$(date +%s) &gt;&gt; ~/.net/$year/$month/up/$date<br/>修改为：<br/><textarea name="code" class="php" rows="15" cols="100">
echo $(cat /sys/class/net/eth1/statistics/rx_bytes)&quot;;&quot;$(date +%s) &gt;&gt; ~/.net/$year/$month/down/$date
echo $(cat /sys/class/net/eth1/statistics/tx_bytes)&quot;;&quot;$(date +%s) &gt;&gt; ~/.net/$year/$month/up/$date
</textarea><br/>修改为：eth1<br/><br/><br/>标准统计（主要看看vps一天多少流量）：<br/>[root@iZ25z0ugwgtZ netuse]# netuse <br/>Downloaded:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;5 MB<br/>Uploaded:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;0 MB<br/><br/>Data Left:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;10235 MB<br/>Days Left:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 Days<br/>End Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2016-06-29 (11:59 PM)<br/><br/>Suggested:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3411 MB (Per Day)<br/><br/>一周一瞥（好像有点问题）：<br/>[root@iZ25z0ugwgtZ netuse]# netuse -w<br/>Data downloaded this week:<br/><br/>Traceback (most recent call last):<br/>&nbsp;&nbsp;File &quot;/bin/netuse&quot;, line 277, in &lt;module&gt;<br/>&nbsp;&nbsp;&nbsp;&nbsp;weekly()<br/>&nbsp;&nbsp;File &quot;/bin/netuse&quot;, line 186, in weekly<br/>&nbsp;&nbsp;&nbsp;&nbsp;format=&quot;&#123;:&gt;5.0f&#125;&quot;,<br/>&nbsp;&nbsp;File &quot;/usr/local/netuse/termgraph.py&quot;, line 56, in chart<br/>&nbsp;&nbsp;&nbsp;&nbsp;print_blocks(labels[i], data[i], step, args)<br/>&nbsp;&nbsp;File &quot;/usr/local/netuse/termgraph.py&quot;, line 63, in print_blocks<br/>&nbsp;&nbsp;&nbsp;&nbsp;blocks = int(count / step)<br/>ZeroDivisionError: integer division or modulo by zero
]]>
</description>
</item><item>
<link>http://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] Linux下网络流量监控netuse使用]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>