http://zewaren.net/site/node/141
Playing with rrdtool counter resets
Fri, 2014-12-05 09:10 — ZeWaren
Now let's update it with some values.
Let's graph!
So far, so good.
The dreaded spike appears!
Folder http://oss.oetiker.ch/rrdtool/pub/contrib/ contains many tools to remove spikes from rrd data files. My favorite one is spikekill (spikekill-1.1-1.tar.gz).
The spike is then replaced by a small innocent glitch.
To prevent counter reset spikes, you should use DERIVE instead of COUNTER. Tuning the rrd file solves the problem.
Not so frequently asked questions and stuff:
Creating and plotting some data normally
Let's create a standard rdd file, with a counter:
1
| rrdtool create test.rrd --start $start --step 60 DS:something:COUNTER:600:0:U RRA:AVERAGE:0.5:1:1440 |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| #!/usr/bin/env perl -w use strict; use warnings; my $start = 1417392000; my $counter = 0; for my $x (1..60*24) { my $time = $start + 60* $x ; $counter += 1000+ int (250* sin (1/(48)* $x )); my $command = "rrdtool update test.rrd $time:$counter" ; system ( $command ); } |
1
2
3
| rrdtool graph test.png -a PNG --start 1417392000 --end 1417478400 -t "Sure looks like a sine" -v "avg potato per second" \ DEF:something=test.rrd:something:AVERAGE \ LINE1:something#111111:"My superb value" |
So far, so good.
Having a counter reset
Now, let's recreate the same data, but with a counter reset in the middle.
1
2
3
| if ( $x == 1000) { $counter = 0; } |
Folder http://oss.oetiker.ch/rrdtool/pub/contrib/ contains many tools to remove spikes from rrd data files. My favorite one is spikekill (spikekill-1.1-1.tar.gz).
1
| php removespikes.php -d -A=avg -M=variance -P=5000 -R=test.rrd |
To prevent counter reset spikes, you should use DERIVE instead of COUNTER. Tuning the rrd file solves the problem.
1
| rrdtool tune test.rrd --data-source-type something:DERIVE |
0 comentários:
Postar um comentário