RRD start 1 -- Understanding RRD through examples)

Source: Internet
Author: User
Tags rrd rrdtool server memory

By: ysuncn (You are welcome to reprint it. Please indicate the translator)

The structure of the RRD database is different from that of other linear databases. Other databases define tables using columns or other parameters. This definition is sometimes very complex, especially when the database is large. The rrdtool database is mainly used for monitoring. Therefore, the structure is very simple. The parameters that need to be defined are the variables with values and the files of these values. Due to the close relationship with time, some time-related parameters are also defined here. In view of this structure, the rrdtool database definition also provides specific actions that should be taken in the absence of updated data. Terms related to the rrdtool database include: data source (DS), heartbeat, date source type (DST), round robin archive (RRA), and validation lidation function (CF.

An example can be used to explain the structure of the rrdtool database and its related terms:

rrdtool create target.rrd /
        --start 1023654125 /
        --step 300 /
        DS:mem:GAUGE:600:0:671744 /
        RRA:AVERAGE:0.5:12:24 /
        RRA:AVERAGE:0.5:288:31

In this example, target is created. RRD database, the start time (1 '023' 654 '125) is the number of seconds from. During database update, the update time must be later than the start time, it must be expressed in seconds from.

The interval of 300 seconds indicates that the database requires new data every 300 seconds. The script used to generate data should run at this interval to ensure timely updates.

DS (Data Source) is an actual variable related to the parameters of the monitored device. Its syntax is as follows:

DS:variable_name:DST:heartbeat:min:max

DSIs a keyword,variable_nameIs the name of the parameter in the database. If necessary, a database may have many Ds. After each interval, a new value of DS is provided to the database for update. This value is also called primary data point (PDP ). In our above example, the new PDP is generated every 300 seconds.

DSTThe data source type is definedDSType. The optional parameters includeCounter, derive, absolute, gauge. DS declared as counter stores the change rate of the value at intervals. It can be used only when the value of the variable increases continuously. The traffic flowing through the vro is suitable for the counter type. The same is true for derive and counter, however, it allows negative values. If you want to check the change rate of the available space on your server, you may use derive; absolute also saves the change rate, but it assumes that the data on the front side is set to 0, the difference between the current data and the previous data is the same as the current value, so that it only stores the quotient of the current value and the time interval; gauge does not store the change rate, it stores the value itself, there is no separate computing. server memory consumption is a typical example of gauge. The following example can be used to explain the differences between DST:

Values       = 300, 600, 900, 1200
Step         = 300 seconds
COUNTER DS   =    1,  1,   1,    1
DERIVE DS    =    1,  1,   1,    1
ABSOLUTE DS  =    1,  2,   3,    4
GAUGE DS     = 300, 600, 900, 1200

The next parameter isHeartbeat. In our example, heartbeat is set to 600. If the database does not get a new PDP within 300 seconds, it will save unknown to the database. Unknown is a special value of rrdtool, it is much better than assuming that the lost value is 0 or other possible values. For example, the flow counter of the vro keeps increasing. If a value is lost, 0 instead of unknown is stored, in this way, when the next value arrives, it will calculate the difference between the current value and the previous value (0) to generate data. This is obviously not suitable. It can be seen that it is very important to insert unknown.

The two values below are minimum and maximum, respectively. The values in the interval are stored in the variable, and other values are stored in the unknown variable.

The next line declares round robin archive (RRA). The syntax is as follows:

RRA:CF:xff:step:rows

RRA is a keyword. CF (Adjustment lidation function) can be an average, minimum, maximum, or last keyword. Introduce the term "Publish lidated data point (CDP)", which is the result of several PDP actions after CF (averaged, Maximum/minimum value or last value, RRA will save multiple rows of CDP.

Finally, let's look at the example above. For the average value (averageed (CF) of the First RRA, 12 (interval) PDP (DS variable), a CDP, 24 (ROW) is constructed) this CDP is archived. Each pd300s is generated, 12 PDP stands for 300 seconds × 12 = 1 hour, and 24 such CDP stands for 1 day, which means that the RRA gets once every day, 25th CDP will replace 1st CDP; the second RRA stores 31 CDP, each CDP represents the average value of one day (288 PDP), so this RRA is a one-month archive, A database can have multiple files. If there are multiple ds, each individual RRA will save all DS data. For example, a database declares three Ds, every RRA contains three variables: day, week, month, and year.

PS: personal understanding, DS is only a variable, provided to DS (data)-PDP will not be stored in the database, archived is CDP--CF processed PDP, of course, if the step of an RRA is set to 1, PDP directly archives the action of this RRA, for example:

RRA: average: 0: 1: 600. Each PDP is archived as a CDP and stores 600 rows. Therefore, the data you can retrieve from the database is CDP (which will be covered by loops). If PDP does not contribute to all RRA (CDP), it is estimated that it will be released automatically.

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.