rrdtool + ruby dsl = rrd-ffi
TRANSCRIPT
WRUG 14.01.2015
rrd-ffiRRDTool + RUBY DSL
-> krótki wstęp :)
Kamil Grabowski [email protected]
@y3tiRebased
Whitestream
Czym jest RRDTool?• Round Robin Database
• Time series data
WRUG 14.01.2015
Timestamp Total Used Free
2015-01-14 00:01:00 7981 7732 2492015-01-14 00:02:00 7981 7632 3492015-01-14 00:03:00 7981 7832 1492015-01-14 00:04:00 7981 7032 949
Czym jest RRDTool?• Round Robin Database
• Time series data
• Round Robin Archives (RRA)
WRUG 14.01.2015
MAX() MAX()
Czym jest RRDTool?• Round Robin Database
• Time series data
• Round Robin Archives
• Logging and graphic
• Can be easily integrated in shell scripts, perl, python, ruby, lua or tcl applications.
WRUG 14.01.2015
Typy danych w RRD• Counter
• Derive
• Absolute
• Gauge
• Compute
WRUG 14.01.2015
1 godzina 2 godzina
60 km 120 km
120 km - 60 km 60 km ———————— = ————= 60 km/h 2 godz. - 1 godz. 1 godz
Timestamp
Counter
Instalacja - krok po kroku
$ gem install rrd-ffi
WRUG 14.01.2015
Instalacja gemu rrd-ffi
# apt-get install rrdtool librrd-devInstalacja rrdtool w systemie (wraz z bibliotekami)
Ręczne tworzenie bazy RRD
WRUG 14.01.2015
$ rrdtool create memory.rrd --step 60 \ --start 1421230929 \ DS:usage:GAUGE:120:0:U \ DS:free:GAUGE:120:0:U \ RRA:MAX:0.5:2:720 \ RRA:MAX:0.5:60:720
Ręczne tworzenie wykresu
WRUG 14.01.2015
$ rrdtool graph memory.png \ --start 1421145830 --end 1421232230 \ --title "Memory stats" \ --width 720 --height 220 \ DEF:free_max=memory.rrd:free:MAX \ DEF:usage_max=memory.rrd:usage:MAX \ LINE1:free_max#00FF00:" Free:" \ LINE1:usage_max#FF0000:"Usage:"
rrd-ffi - tworzenie bazy rrd
WRUG 14.01.2015
require 'rrd'
rrd = RRD::Base.new("memory.rrd")
rrd.create :start => Time.now - 10.seconds, :step => 1.minute do datasource "usage", :type => :gauge, :heartbeat => 2.minutes, :min => 0 datasource "free", :type => :gauge, :heartbeat => 2.minutes, :min => 0 archive :max, :every => 2.minute, :during => 1.day archive :max, :every => 60.minutes, :during => 1.monthend
rrd-ffi - tworzenie wykresu
WRUG 14.01.2015
require 'rrd'
RRD.graph "memory.png", :title => "Memory stats", :width => 720, :height => 220 do line "memory.rrd", :free => :max, :color => "#00FF00", :label => " Free: " line "memory.rrd", :usage => :max, :color => "#FF0000", :label => "Usage: "end
I to już koniec? Ale co dalej?
• rrd-ffi - https://github.com/morellon/rrd-ffi
• rrdtool - http://oss.oetiker.ch/rrdtool/
• collectd wiki: https://collectd.org/wiki/
• wykresy z collectd & munin
WRUG 14.01.2015