Zabbix Traffic Summary Script

Source: Internet
Author: User

Zabbix powerful, have to mention. The planned use of its own calculate function to summarize the Host_group network card traffic, as follows:

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/7F/11/wKiom1cR0qKTli4AAAA7i_AjmqQ309.png "title=" Qq20160416134950.png "alt=" Wkiom1cr0qktli4aaaa7i_ajmqq309.png "/>

But the results of data acquisition and the actual difference is very large (not generally large, very outrageous), so only through the script to obtain, the script is as follows:

#/bin/bash#descript:calculate group trafficqzqm_list= "192.168.1.101 192.168.1.102" jsqm_list= " 172.16.100.101 172.16.100.102 172.16.100.103 "Function get_data ()  {     traffic=0    trac_dire=$1    for host in  $host _list     do#       echo  $host          case  $trac _dire in             inband)                  command= "/sbin/zabbix_get -s  $host  -k net.if.in[\" ${host}\ "]"              ;;             outband)                  command= "/sbin/zabbix_get -s  $host  -k net.if.out[\ "${host}\" "             ;;             *)                  echo  "Destination errot"                  exit 5         esac#       echo  $command          trac=$ (eval  $command) #        echo  $trac         traffic=$[traffic+trac]     done    echo  $traffic}group=$1direct=$2case  $group  in     fujian)         host_list= $qzqm _list        get_data  $direct     ;;     JIANGSU)         host_list= $jsqm _list         get_data  $direct     ;;     *)         echo  "please check  Host group and directory "        exit 4esac

or through the Zabbix_get tool to obtain the host traffic, and then perform the calculation, the results are as follows:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/7F/11/wKiom1cR1R6wHWsPAAAnIsAVPLQ427.png "title=" Picture 3.png "alt=" Wkiom1cr1r6whwspaaanisavplq427.png "/>

And the traffic that each host gets to calculate again is still relatively close.

If a friend knows, how to use the Calculate method to accurately summarize the traffic, but also hope message guidance.

This article from the "11414123" blog, reproduced please contact the author!

Zabbix Traffic Summary Script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.