• 统计网卡流量


    #!/bin/bash

    #This is the script for statistical traffic

    Eth2_RX=$(ifconfig | grep -A8 eth2 | grep "RX" | tail -n 1 | awk -F '(' '{print $2}' | awk '{print $1}') Eth2_TX=$(ifconfig | grep -A8 eth2 | grep "RX" | tail -n 1 | awk -F '(' '{print $3}' | awk '{print $1}')

    Eth4_RX=$(ifconfig | grep -A8 eth2 | grep RX | tail -n 1 | awk -F '(' '{print $2}' | awk '{print $1}') Eth4_TX=$(ifconfig | grep -A8 eth2 | grep RX | tail -n 1 | awk -F '(' '{print $3}' | awk '{print $1}')

    Eth3_RX=$(ifconfig | grep -A 8 eth3 | grep "RX" | awk -F '(' '{print $2}' | awk '{print $1}') Eth3_TX=$(ifconfig | grep -A 8 eth3 | grep "RX" | awk -F '(' '{print $3}' | awk '{print $1}')

    In_RX=`echo "$Eth2_RX+$Eth4_RX"|bc`

    echo "The total internally accepted traffic is $In_RX "

    In_TX=`echo "$Eth2_RX+$Eth4_RX"|bc`

    echo "The total Internally sent traffic is

    $In_TX" echo "The received traffic outside the network is $Eth3_RX"

    echo "The outer network sends the flow is $Eth3_TX"

    NetSave_RX=`echo "$In_RX-$Eth3_RX"|bc`

    echo "The public network accepts traffic and saves $NetSave_RX"

    NetSave_TX=`echo "$In_TX-$Eth3_TX"|bc`

    echo "The public network sends traffic to saves $NetSave_TX"

    We are down, but not beaten. tested but not defeated.
  • 相关阅读:
    POJ 3278 Catch That Cow (附有Runtime Error和Wrong Answer的常见原因)
    POJ 2251 Dungeon Master (三维BFS)
    HDU 1372 Knight moves
    [Ubuntu] <uptime>命令
    【C】哈夫曼编码
    【C++】开辟数组未初始化问题
    免费下载IEEE论文
    随机换装
    BFS解迷宫问题(Go实现)
    DFS解迷宫问题(Go实现)
  • 原文地址:https://www.cnblogs.com/guniang/p/6890802.html
Copyright © 2020-2023  润新知