Get cacti rrd file daily peak shell

Source: Internet
Author: User
Tags rrd rrdtool

The code is as follows:

Url= "/VAR/WWW/HTML/RRA/150/9517.RRD/VAR/WWW/HTML/RRA/256/11345.RRD/VAR/WWW/HTML/RRA/150/9518.RRD" fff= ' echo   $url  | awk  ' {print nf} ' for ((i=1;i<=3;i++)) docriqi= ' date +%s -d  ' 2016-04-11 00:00:00 "' eriqi= ' date +%s -d " 2016-04-11 23:59:00 "' ccriqi= ' echo " $ criqi - 86400 *  $i "&NBSP;|&NBSP;BC ' eeriqi= ' echo " $eriqi  - 86400 *   $i "&NBSP;|&NBSP;BC ' dt= ' date -d " 1970-01-01 utc  $eeriqi  seconds " +%f" for ((x =1;x<= $fff; x + +) douu= ' echo  $url  | awk -v a=${x}  ' {print  $a} '/usr/local/ rrdtool/bin/rrdtool fetch  $uu  MAX --start  $ccriqi  --end  $eeriqi  |  sed -e  '/^$/d '  | grep -v  ' traffic_out '  | awk  ' {printf  "%f\n", "$"  | sed  ' s/\-nan/0.0000000000e+00/g '  >> /tmp/test${x}done                            ff= ' Cat /tmp/test1 | wc -l '                            for ((n=1 ; n<= $ff; n++))                             do                                  for ((y=1;y<= $fff; y++))                                   do                                  tt= ' Cat /tmp/test${y} | sed -n ${n}p '                                   echo  $tt  >> /tmp/fud                                  done                                  aa= ' cat /tmp/fud | awk  ' {sum+=$0}END{print sum} '                        &Nbsp;         re= ' echo  ' $aa  | awk  ' {sum=$0* 8/1000000}end{printf  "%.2f", sum} '                                   echo  $re  >> /tmp/testz                                  rm -rf /tmp/fud                            done                                 td= ' cat /tmp/ Testz | sort -nr |  sed -n 1p '                                   if [  ' echo  ' $td  > 1000 "|BC"  -eq 1 ];then                                  tpt= ' echo  ' scale=3; $td  / 1000 " | bc | awk  ' {printf "%.2f ", $ A} '                                   echo  $tpt "G"   $DT                                   echo  "$TPT" G "  $DT"  >> /root/qz.txt                                  else                                  echo  $td "M"   $DT                                   echo  "$TD" M "  $DT"  >> /root/qz.txt                                  fifor ((b=1;b<= $fff; b++)) Dorm &NBSP;-RF&NBSP;/TMP/TEST${B}donerm -rf /tmp/testzdone; 

The results of the operation are as follows:

[Email protected]]# sh get_in2.35g 2016-04-103.69g 2016-04-096.84g 2016-04-08[[email protected]]#


Get cacti rrd file daily peak shell

Related Article

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.