{"id":751,"date":"2016-08-11T09:35:01","date_gmt":"2016-08-11T08:35:01","guid":{"rendered":"http:\/\/www.haxed.me.uk\/?p=751"},"modified":"2016-08-11T09:35:01","modified_gmt":"2016-08-11T08:35:01","slug":"grabbing-network-activity-server-without-network-utility","status":"publish","type":"post","link":"https:\/\/haxed.me.uk\/index.php\/2016\/08\/11\/grabbing-network-activity-server-without-network-utility\/","title":{"rendered":"Grabbing network activity from server without network utility"},"content":{"rendered":"<p>So, is it possible to look at a network interfaces activity without bwm-ng, iptraf, or other tools? Yes.<\/p>\n<pre>\r\nwhile true do\r\nRX1=`cat \/sys\/class\/net\/${INTERFACE}\/statistics\/rx_bytes`\r\nTX1=`cat \/sys\/class\/net\/${INTERFACE}\/statistics\/tx_bytes`\r\nDOWN=$(($RX1-$RX2))\r\nUP=$(($TX1-$TX2))\r\nDOWN_Bits=$(($DOWN * 8 ))\r\nUP_Bits=$(($UP * 8 ))\r\nDOWNmbps=$(( $DOWN_Bits >> 20 ))\r\nUPmbps=$(($UP_Bits >> 20 ))\r\necho -e \"RX:${DOWN}\\tTX:${UP} B\/s | RX:${DOWNmbps}\\tTX:${UPmbps} Mb\/s\"\r\nRX2=$RX1; TX2=$TX1\r\nsleep 1; done\r\n<\/pre>\n<p>I found this little gem yesterday, but couldn&#8217;t understand why they had not used clear. I guess they wanted to log activity or something&#8230; still this was a really nice find. I can&#8217;t remember where I found it yesterday but googling part of it should lead you to the original source \ud83d\ude00<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, is it possible to look at a network interfaces activity without bwm-ng, iptraf, or other tools? Yes. while true do RX1=`cat \/sys\/class\/net\/${INTERFACE}\/statistics\/rx_bytes` TX1=`cat \/sys\/class\/net\/${INTERFACE}\/statistics\/tx_bytes` DOWN=$(($RX1-$RX2)) UP=$(($TX1-$TX2)) DOWN_Bits=$(($DOWN * 8 )) UP_Bits=$(($UP * 8 )) DOWNmbps=$(( $DOWN_Bits >> 20 )) &hellip; <a href=\"https:\/\/haxed.me.uk\/index.php\/2016\/08\/11\/grabbing-network-activity-server-without-network-utility\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58,9,7,29,4,20],"tags":[66,65,67,68],"class_list":["post-751","post","type-post","status-publish","format-standard","hentry","category-benchmarking","category-linux","category-management-tools","category-monitoring","category-networking","category-webhosting","tag-bandwidth","tag-network-interface","tag-without-bwm-ng","tag-without-iptraf"],"_links":{"self":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/751","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/comments?post=751"}],"version-history":[{"count":1,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/751\/revisions"}],"predecessor-version":[{"id":752,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/751\/revisions\/752"}],"wp:attachment":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/media?parent=751"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/categories?post=751"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/tags?post=751"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}