[Distributed cross-platform monitoring system] Monitoring network traffic and network speed under linux-python script application

Since the level1 and level2 financial data servers of the Shanghai Stock Exchange and the Shenzhen Stock Exchange have relatively large traffic during the 5 hours from 9:00 a.m. to 11:30 and 13:00 to 15:30, the network flow rate of the monitored server is considered to be An important indicator to be monitored. The average network speed during this period can be calculated by accumulating the uplink and downlink traffic of each network card in a period of time and dividing by this time interval. My current collection frequency is once a minute. The network obtained during the actual opening period is running. The speed monitoring information is relatively accurate, and it is maintained at a speed of 5M/S. Sometimes when the network speed of a certain server's internal network card reaches 5M/S during the usual non-service period, it is true that someone is making a big transfer.

 

The independent monitoring script returns a list of nested tuples in the data structure, and finally summarizes it into a complete XML data island. In order to facilitate debugging, each intermediate result of the script is exported to a temporary text.

 

Run the following script to make sure your Linux is installed with the ethtool tool, and the test passes on ubuntu2.6.27-7-server, ubuntu22.6.27.19-5-default, and suse 2.6.27.19-5-default.

 

Code:

 

 

Examples of use:

 

1 

 

The first field of the second element in each list element tuple is the network speed Bytes/S. For example, the network speed of the eth1 network card is 3.3KB/s, and the network speed of eth0 is 2.9KB/s. Today is Saturday. The traffic is very high. normal

Guess you like

Origin blog.csdn.net/jrckkyy/article/details/5376462