rrd-ffi 0.2.13 → 0.2.14
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +24 -14
- data/lib/rrd/graph.rb +2 -2
- data/lib/rrd/version.rb +1 -1
- metadata +8 -8
data/README.rdoc
CHANGED
@@ -8,11 +8,11 @@ rrd-ffi uses ffi to wrap the librrd C bindings, not system calls.
|
|
8
8
|
|
9
9
|
IMPORTANT: You need librrd installed (version 1.3.1 or above, version 1.4.2 RECOMMENDED) in your system for this gem to work
|
10
10
|
|
11
|
-
= Basics
|
11
|
+
= Basics
|
12
12
|
|
13
13
|
Here's what you need to know before starting.
|
14
14
|
|
15
|
-
== Installation
|
15
|
+
== Installation
|
16
16
|
|
17
17
|
=== Notes
|
18
18
|
|
@@ -49,7 +49,7 @@ From source:
|
|
49
49
|
rrd = RRD::Base.new("myrrd.rrd")
|
50
50
|
# Restoring a rrd file from xml
|
51
51
|
# Notice that all '-' on flags become '_' like --force-overwrite => :force_overwrite
|
52
|
-
rrd.restore("myrrd.xml", :force_overwrite => true)
|
52
|
+
rrd.restore("myrrd.xml", :force_overwrite => true)
|
53
53
|
|
54
54
|
# Fetching data from rrd
|
55
55
|
rrd.fetch(:average).each {|line| puts line.inspect}
|
@@ -59,11 +59,11 @@ From source:
|
|
59
59
|
|
60
60
|
# Updating rrd (this rrd example has 3 datasources)
|
61
61
|
rrd.update Time.now, 500, nil, 30
|
62
|
-
|
63
|
-
# Looking for the first and last entered dates
|
62
|
+
|
63
|
+
# Looking for the first and last entered dates
|
64
64
|
puts rrd.starts_at
|
65
65
|
puts rrd.ends_at
|
66
|
-
|
66
|
+
|
67
67
|
# Growing or Shrinking a rrd_file (create a resize.rrd file)
|
68
68
|
# You need to know the RRA number (starting from 0)
|
69
69
|
rrd.resize(0, :grow => 10.days)
|
@@ -73,6 +73,9 @@ From source:
|
|
73
73
|
rrd.fetch(:unknown_function) # should return false
|
74
74
|
puts rrd.error
|
75
75
|
|
76
|
+
# For raising exceptions in methods, use the '!' at its end
|
77
|
+
rrd.fetch!(:unknown_function) # raises an error
|
78
|
+
|
76
79
|
=== DSLs
|
77
80
|
|
78
81
|
# Creating a new rrd
|
@@ -81,7 +84,7 @@ From source:
|
|
81
84
|
datasource "memory", :type => :gauge, :heartbeat => 10.minutes, :min => 0, :max => :unlimited
|
82
85
|
archive :average, :every => 10.minutes, :during => 1.year
|
83
86
|
end
|
84
|
-
|
87
|
+
|
85
88
|
# Generating a graph with memory and cpu usage from myrrd.rrd file
|
86
89
|
RRD.graph "graph.png", :title => "Test", :width => 800, :height => 250, :color => ["FONT#000000", "BACK#FFFFFF"] do
|
87
90
|
area "myrrd.rrd", :cpu0 => :average, :color => "#00FF00", :label => "CPU 0"
|
@@ -89,6 +92,13 @@ From source:
|
|
89
92
|
line "myrrd.rrd", :memory => :average, :color => "#0000FF", :label => "Memory"
|
90
93
|
end
|
91
94
|
|
95
|
+
# Generating a graph or raising an exception if something bad happens
|
96
|
+
RRD.graph! "graph.png", :title => "Test", :width => 800, :height => 250, :color => ["FONT#000000", "BACK#FFFFFF"] do
|
97
|
+
area "myrrd.rrd", :cpu0 => :average, :color => "#00FF00", :label => "CPU 0"
|
98
|
+
line "myrrd.rrd", :cpu0 => :average, :color => "#007f3f"
|
99
|
+
line "myrrd.rrd", :memory => :average, :color => "#0000FF", :label => "Memory"
|
100
|
+
end
|
101
|
+
|
92
102
|
# Generating a more complex graph using advanced DSL
|
93
103
|
RRD.graph IMG_FILE, :title => "Test", :width => 800, :height => 250, :start => Time.now - 1.day, :end => Time.now do
|
94
104
|
for_rrd_data "cpu0", :cpu0 => :average, :from => RRD_FILE
|
@@ -121,7 +131,7 @@ Normal methods return false on error, or the expected result otherwise.
|
|
121
131
|
# Fetching average data
|
122
132
|
RRD::Wrapper.fetch "myrrd.rrd", "AVERAGE"
|
123
133
|
|
124
|
-
# Looking for the first entered dates
|
134
|
+
# Looking for the first entered dates
|
125
135
|
RRD::Wrapper.first "myrrd.rrd"
|
126
136
|
|
127
137
|
# Creating a graph
|
@@ -130,21 +140,21 @@ Normal methods return false on error, or the expected result otherwise.
|
|
130
140
|
# Getting info on a rrd file
|
131
141
|
RRD::Wrapper.info("myrrd.rrd")
|
132
142
|
|
133
|
-
# Looking for the last entered dates
|
143
|
+
# Looking for the last entered dates
|
134
144
|
RRD::Wrapper.last "myrrd.rrd"
|
135
|
-
|
136
|
-
# Getting last data inserted on a rrd
|
145
|
+
|
146
|
+
# Getting last data inserted on a rrd
|
137
147
|
RRD::Wrapper.last_update "myrrd.rrd"
|
138
|
-
|
148
|
+
|
139
149
|
# Resizing a rrd file RRA
|
140
150
|
RRD::Wrapper.resize "myrrd.rrd", "0", "GROW", "10"
|
141
|
-
|
151
|
+
|
142
152
|
# Restoring a rrd file from xml
|
143
153
|
RRD::Wrapper.restore "myrrd.xml", "myrrd.rrd"
|
144
154
|
|
145
155
|
# Tuning a rrd file
|
146
156
|
RRD::Wrapper.tune "myrrd.rrd", "--minimum", "memory:5"
|
147
|
-
|
157
|
+
|
148
158
|
# Updating rrd with a new value
|
149
159
|
RRD::Wrapper.update "myrrd.rrd", "N:500000000"
|
150
160
|
|
data/lib/rrd/graph.rb
CHANGED
@@ -5,7 +5,7 @@ module RRD
|
|
5
5
|
DEF_OPTIONS= [:from]
|
6
6
|
GRAPH_FLAGS = [:only_graph, :full_size_mode, :rigid, :alt_autoscale, :no_gridfit,
|
7
7
|
:alt_y_grid, :logarithmic, :no_legend, :force_rules_legend, :lazy,
|
8
|
-
:pango_markup, :slope_mode, :interlaced]
|
8
|
+
:pango_markup, :slope_mode, :interlaced, :disable_rrdtool_tag]
|
9
9
|
|
10
10
|
attr_accessor :output, :parameters, :definitions, :printables
|
11
11
|
|
@@ -123,4 +123,4 @@ module RRD
|
|
123
123
|
printable
|
124
124
|
end
|
125
125
|
end
|
126
|
-
end
|
126
|
+
end
|
data/lib/rrd/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rrd-ffi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.14
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153919560 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153919560
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153918020 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2153918020
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &2153913680 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2153913680
|
47
47
|
description: Provides bindings for many RRD functions (using ffi gem and librrd),
|
48
48
|
as well as DSLs for graphic and rrd building. You must have librrd in your system!
|
49
49
|
email:
|