|
Internet Protocol, Transport Control Protocol, Network protocols, Routing, Routers, IP aliases, Routes, Ethernet
Author |
Message |
admin
|
 |
Post subject: Linux script for interface network bandwidth monitoring | Posted: Mon Feb 09, 2015 7:05 pm |
|
Site Admin
Joined: Mon Aug 03, 2009 8:43 am Posts: 104
|
Linux script for interface network bandwidth monitoring
This is a simple script that gets RX / TX values of an interface from /sys pseudo filesystem and calculate difference between current and old values displaying a bandwidth output for kilobytes per second. Code: #!/bin/bash INT="1" # every INT seconds
while true do RX1=`cat /sys/class/net/$1/statistics/rx_bytes` TX1=`cat /sys/class/net/$1/statistics/tx_bytes` sleep $INT RX2=`cat /sys/class/net/$1/statistics/rx_bytes` TX2=`cat /sys/class/net/$1/statistics/tx_bytes` TXBPS=`expr $TX2 - $TX1` RXBPS=`expr $RX2 - $RX1` TXKBPS=`expr $TXBPS / 1024` RXKBPS=`expr $RXBPS / 1024` echo "TX $1: $TXKBPS kb/s RX $1: $RXKBPS kb/s" done
_________________ VPSie - SSD VPS servers in AMS-IX, LINX, DE-CIX https://vpsie.com
|
|
|
|
|
|
|
Topics related to - "Linux script for interface network bandwidth monitoring" |
Topics |
Author |
Replies | Views |
Last post |
 |
|
FreeBSD show network interface statistics
|
mandrei99 |
0 |
5645 |
Wed Sep 25, 2013 9:30 am
mandrei99
|
 |
|
Linux How to change hardware MAC address of an interface
|
debuser |
1 |
3563 |
Tue Dec 06, 2011 6:26 am
Zettie49
|
 |
|
Linux list the outgoing interface for packets to a specific IP destination
|
mandrei99 |
0 |
3251 |
Mon Jul 22, 2013 10:17 am
mandrei99
|
 |
 |
"OSPF not enabled on this interface" FreeBSD Quagga ospfd interface status
|
debuser |
1 |
5479 |
Thu Apr 01, 2010 5:55 am
debuser
|
 |
|
KVM: List MAC address table and interface that learned them.
|
mandrei99 |
0 |
4525 |
Sun Feb 01, 2015 6:26 am
mandrei99
|
 |
|
FreeBSD list interface multicast group membership
|
mandrei99 |
0 |
4618 |
Tue Dec 03, 2013 9:02 am
mandrei99
|
 |
|
How to accept IPv6 Router Advertisements on interface in FreeBSD
|
mandrei99 |
0 |
3757 |
Wed Apr 29, 2015 3:54 am
mandrei99
|
 |
|
FreeBSD list the outgoing interface for packets to a specific IP destination
|
mandrei99 |
0 |
2905 |
Mon Jul 22, 2013 10:12 am
mandrei99
|
 |
|
FreeBSD + IPerf send multicast source traffic via specific interface
|
mandrei99 |
3 |
6184 |
Sat Apr 11, 2015 5:28 am
areeba
|
 |
|
FreeBSD + IPERF sending IGMP v2 multicast group join / leave via specific interface
|
mandrei99 |
0 |
7202 |
Mon Jul 22, 2013 10:41 am
mandrei99
|
|
Users browsing this forum: No registered users and 1 guest |
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
 News Site map SitemapIndex RSS Feed Channel list
|
|