# Vi/etc/yum.repos.d/dag.repo
[Dag]
Name=dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
Gpgcheck=1
Gpgkey=http://dag.wieers.com/rpm/packages/rpm-gpg-key.dag.txt
Enabled=1
Once done, the direct Yum installation is as follows:
#yum Install RRDtool
can be installed successfully.
Installing Python-rrdtool
1.yum install-y GCC
2.Yum Install Rrdtool-python
3.yum Install Python-psutil
Requirements: verifying ddttool as the network performance monitoring database is appropriate
Technology:RRDtool
Requirements:
A Requirements for Append insertion speed
Two. Query speed requirements to meet
Three. Queue form, the history of exceeding the time set is removed to meet
Description
RRDtool represents "Round Robin Database Tool", and the author is also the inventor of MRTG software. The official site is located in http://oss.oetiker.ch/rrdtool/. The so-called "Round Robin" is actually a way of storing data, using a fixed-size space to store the data, and a pointer to the location of the most recent data. We can think of the space of the database used to store the data as a circle with many ticks on it. Where these ticks are located represents where the data is stored. The so-called pointers can be thought of as a straight line pointing at these scales from the center point. The pointer moves automatically as the data reads and writes. Note that the circle has no start and end points, so the pointer can be moved all the time without worrying about the inability to move forward after reaching the end. After a period of time, when all the space is filled with data, it is stored again from the beginning. The size of the entire storage space is a fixed value. So RRDtool is a tool for storing data in a similar way, with the suffix of the database file used by RRDtool.
Test
Test Host: 192.168.1.141
Test Catalog:/root/hujin/*
Test process:
#1创建一个rrd文件 create_rrd.py
#coding =utf-8
Import Rrdtool,time
Rrdb=rrdtool.create (' mysql.rrd ', '--step ', ' 3 ', '--start ', ' 1402643365 ',
' Ds:mysqlselect:counter:5:0:u ',
' rra:average:0.5:1:28800 ',
' rra:average:0.5:10:2880 ',
' rra:max:0.5:10:2880 ',
' rra:last:0.5:10:2880 ')
Update network card traffic getselect.sh #2使用rrdtool update
While true; Do
select= ' snmpget-v 2c-c public 192.168.1.141 ifinoctets.2 | Sed-e ' S/.*ter32: \ (. *\)/\1/'
RRDtool update mysql.rrd N: $SELECT
Sleep 3
Done
#3绘图 graph_rrd.py
#coding =utf-8
Import RRDtool
Rrdtool.graph (' mysql.png ', '--start ', ' 1402645825 ',
'--title ', ' MySQL select ',
'--vertical-label ', ' SELECTS/3 ',
' Def:select3=mysql.rrd:mysqlselect:average:step=3 ',
' Line1:select3#ff0000:select ',)
#4查询, check data from 2014.6.12 15:50:25 to 2014.6.12 15:51:25
Import RRDtool
Print Rrdtool.fetch (' mysql.rrd ', ' AVERAGE ', '--start ', ' 1402645825 ', '--end ', ' 1402645885 ')
:
Reference:
http://my.oschina.net/guol/blog/136023
http://freeloda.blog.51cto.com/2033581/1307492
Http://bbs.hexun.com/money/post_568_6335152_1_d.html