Hello.
A while ago, I had the opportunity to try the platform itself and the virtual load balancer on the SDN / NFV platform, and I thought it would be uninteresting to just capture how the traffic was relayed and balanced, so it's just for viewing. I made a simple traffic monitor on CentOS 6.x.
Actually, I just refer to the interface statistics file (text) under / sys / class / net every second and update the screen with ncurses, but when I actually flow traffic, I can monitor it as it is (traffic) It feels like it's flowing), so it's interesting.
I'm looking at the files around here. There are many other collisions, so it's a good idea to take a look at the directory. Replace "eth0" with your interface name. These files simply contain numbers such as the number of packets and the number of bytes.
/sys/class/net/eth0/statistics/rx_packets
/sys/class/net/eth0/statistics/rx_bytes
/sys/class/net/eth0/statistics/rx_errors
/sys/class/net/eth0/statistics/rx_dropped
/sys/class/net/eth0/statistics/tx_packets
/sys/class/net/eth0/statistics/tx_bytes
/sys/class/net/eth0/statistics/tx_errors
/sys/class/net/eth0/statistics/tx_dropped
It's not "modern" because I used ncurses on the assumption that it will be viewed on the console from Horizon of OpenStack.
Although it deviates from the main subject, I wanted to imitate L2 transparent VNF (Virtual Network Function) for testing on the NFV platform, and I connected the left and right interfaces with a Linux bridge on Linux that runs this monitor, so I hit the command Make a note of it. The "brvnf" below is an optional bridge name. In the example below, it is connected to [eth1-brvnf-eth2] to operate transparently.
brctl addbr brvnf
brctl addif brvnf eth1
brctl addif brvnf eth2
ifconfig brvnf up
At first glance, the traffic monitor may seem cumbersome to implement, but on Linux you can easily refer to these files. Since it is plain text, it can be easily handled by shell scripts.
The entire source is posted here (github) [https://github.com/msozawa/simple-tools/tree/master/simple_tra_mon), so feel free to take it if you are interested.
Well then.
Recommended Posts