Giter Club home page Giter Club logo

rrd-ffi's Issues

Exception: FFI::NotFoundError when rrdtool was compiled without graphics support

rrdtool can be compiled without graphics support with the configure command "./configure --disable-rrdcgi --disable-rrd_graph". If this was the case, then the rrd-ffi gem will throw an exception on import because it can't attach the :rrd_graph method. The attached patch will make that method optional. Tested on FreeBSD 9.1 amd64 with rrdtool version 1.4.7

--- lib/rrd/wrapper.rb.orig 2013-09-23 09:58:04.142000098 -0600
+++ lib/rrd/wrapper.rb 2013-09-23 09:58:42.762000022 -0600
@@ -47,7 +47,11 @@
attach_function :rrd_create, [:int, :pointer], :int
attach_function :rrd_dump, [:int, :pointer], :int
attach_function :rrd_first, [:int, :pointer], :time_t

  •  attach_function :rrd_graph, [:int, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer], :int
    
  •  begin
    
  •    attach_function :rrd_graph, [:int, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer], :int
    
  •  rescue FFI::NotFoundError => e
    
  •    warn "rrdtool was compiled without graphics support"
    
  •  end
    
    attach_function :rrd_info, [:int, :pointer], :pointer
    attach_function :rrd_last, [:int, :pointer], :time_t

:start not working?

I cant set start date. It is set to -24 hours.

This is working with rrdtool:


> ```
>      --start 1326067200 \
>      --step 86400 \
>      DS:mem:GAUGE:600:0:1001 \
>      RRA:LAST:0.5:1:10
> ```
> 
> ```
> ```

Produces:

rrdtool fetch target.rrd LAST --start 1326067200
mem

1326153600: -nan
1326240000: -nan
1326326400: -nan
1326412800: -nan
1326499200: -nan
1326585600: -nan
1326672000: -nan
1326758400: -nan
1326844800: -nan


How expected.

But RAW API:

RRD::Wrapper.create "myrrd.rrd","--start", "1326067200", "--step", "86400", "DS:values:GAUGE:172800:0:1001", "RRA:LAST:0.5:1:10"


Produces:

RRD::Wrapper.fetch "myrrd.rrd", "LAST"
=> [["time", "values"], [0, NaN]]


And DSLs:
```rrd.create :start => -10.days,  :step => 1.day do
ruby-1.9.2-p290 :124 >     datasource "values", :type => :gauge, :heartbeat => 2.days, :min => 0, :max => 1001
ruby-1.9.2-p290 :125?>   archive :last, :every => 1.day, :during => 11.days
ruby-1.9.2-p290 :126?>   end

Produces:

["time", "values"]
[1326672000, NaN]
[1326758400, NaN]
 => [["time", "values"], [1326672000, NaN], [1326758400, NaN]] 

I thought Im using DSLs archive wrong, or thats problem in DSLs, but it looks like problem in something else.

Can you try it, please and check it?

//EDIT: Actually it looks like problem with fetch. Fetch from rrdtool displays expected values also from databases created with steps described upper.

Segfault on wrapper.rb:121 get_array_of_string

I am getting this segfault pretty often, mac os x running rrdtool 1.4.4, rvm'd ruby 1.9.2-p136. The code that is executing is a series of consecutive rrd.fetch instructions. It is fairly reproducible (it happens almost every time I try a few things), but I haven't found a specific sequence that causes it. In particular, none of the steps on their own cause the segfault, it just happens.

/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/rrd-ffi-0.2.7/lib/rrd/wrapper.rb:121: [BUG] Segmentation fault
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0]

-- control frame ----------
c:0043 p:---- s:0223 b:0223 l:000222 d:000222 CFUNC  :get_array_of_string
c:0042 p:0235 s:0218 b:0218 l:000217 d:000217 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/rrd-ffi-0.2.7/lib/rrd/wrapper.rb:121
c:0041 p:0167 s:0199 b:0199 l:000198 d:000198 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/rrd-ffi-0.2.7/lib/rrd/base.rb:52
c:0040 p:0141 s:0193 b:0193 l:000192 d:000192 METHOD /sandbox/skycharts/lib/skycharts.rb:183
c:0039 p:0286 s:0182 b:0182 l:0014f8 d:000181 LAMBDA webapp.rb:92
c:0038 p:---- s:0174 b:0174 l:000173 d:000173 FINISH
c:0037 p:---- s:0172 b:0172 l:000171 d:000171 CFUNC  :call
c:0036 p:0018 s:0169 b:0169 l:002620 d:000168 BLOCK  /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:1165
c:0035 p:---- s:0167 b:0167 l:000166 d:000166 FINISH
c:0034 p:---- s:0165 b:0165 l:000164 d:000164 CFUNC  :instance_eval
c:0033 p:0016 s:0162 b:0160 l:000159 d:000159 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:738
c:0032 p:0012 s:0156 b:0156 l:000124 d:000155 BLOCK  /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:722
c:0031 p:0017 s:0154 b:0154 l:000145 d:000153 BLOCK  /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:772
c:0030 p:---- s:0152 b:0152 l:000151 d:000151 FINISH
c:0029 p:---- s:0150 b:0150 l:000149 d:000149 CFUNC  :catch
c:0028 p:0203 s:0146 b:0146 l:000145 d:000145 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:769
c:0027 p:0018 s:0136 b:0136 l:000124 d:000135 BLOCK  /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:721
c:0026 p:---- s:0130 b:0130 l:000129 d:000129 FINISH
c:0025 p:---- s:0128 b:0128 l:000127 d:000127 CFUNC  :each
c:0024 p:0050 s:0125 b:0125 l:000124 d:000124 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:720
c:0023 p:0078 s:0119 b:0119 l:000118 d:000118 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:857
c:0022 p:0009 s:0115 b:0115 l:0007e8 d:000114 BLOCK  /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:648
c:0021 p:---- s:0113 b:0113 l:000112 d:000112 FINISH
c:0020 p:---- s:0111 b:0111 l:000110 d:000110 CFUNC  :instance_eval
c:0019 p:0012 s:0108 b:0108 l:000099 d:000107 BLOCK  /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:822
c:0018 p:---- s:0106 b:0106 l:000105 d:000105 FINISH
c:0017 p:---- s:0104 b:0104 l:000103 d:000103 CFUNC  :catch
c:0016 p:0013 s:0100 b:0100 l:000099 d:000099 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:822
c:0015 p:0155 s:0093 b:0093 l:0007e8 d:0007e8 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:648
c:0014 p:0019 s:0086 b:0086 l:000085 d:000085 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:633
c:0013 p:0032 s:0082 b:0082 l:000081 d:000081 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@global/gems/rack-1.2.2/lib/rack/commonlogger.rb:18
c:0012 p:0015 s:0074 b:0074 l:000073 d:000073 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/showexceptions.rb:21
c:0011 p:0155 s:0066 b:0066 l:000065 d:000065 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@global/gems/rack-1.2.2/lib/rack/methodoverride.rb:24
c:0010 p:0018 s:0060 b:0060 l:002550 d:000059 BLOCK  /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:1284
c:0009 p:0032 s:0058 b:0058 l:000057 d:000057 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:1315
c:0008 p:0011 s:0054 b:0054 l:002550 d:002550 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:1284
c:0007 p:0015 s:0050 b:0050 l:000049 d:000049 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@global/gems/rack-1.2.2/lib/rack/content_length.rb:13
c:0006 p:0338 s:0042 b:0042 l:000041 d:000041 METHOD /Users/dan/.rvm/gems/ruby-1.9.2-p136@global/gems/rack-1.2.2/lib/rack/handler/webrick.rb:52
c:0005 p:0257 s:0030 b:0030 l:000029 d:000029 METHOD /Users/dan/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/webrick/httpserver.rb:111
c:0004 p:0393 s:0020 b:0020 l:000019 d:000019 METHOD /Users/dan/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/webrick/httpserver.rb:70
c:0003 p:0126 s:0009 b:0009 l:001c48 d:000008 BLOCK  /Users/dan/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/webrick/server.rb:183
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP   
---------------------------
-- Ruby level backtrace information ----------------------------------------
/Users/dan/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
/Users/dan/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/Users/dan/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@global/gems/rack-1.2.2/lib/rack/handler/webrick.rb:52:in `service'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@global/gems/rack-1.2.2/lib/rack/content_length.rb:13:in `call'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:1284:in `call'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:1315:in `synchronize'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:1284:in `block in call'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@global/gems/rack-1.2.2/lib/rack/methodoverride.rb:24:in `call'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/showexceptions.rb:21:in `call'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@global/gems/rack-1.2.2/lib/rack/commonlogger.rb:18:in `call'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:633:in `call'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:648:in `call!'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:822:in `invoke'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:822:in `catch'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:822:in `block in invoke'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:822:in `instance_eval'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:648:in `block in call!'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:857:in `dispatch!'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:720:in `route!'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:720:in `each'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:721:in `block in route!'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:769:in `process_route'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:769:in `catch'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:772:in `block in process_route'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:722:in `block (2 levels) in route!'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:738:in `route_eval'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:738:in `instance_eval'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:1165:in `block in compile!'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/sinatra-1.2.3/lib/sinatra/base.rb:1165:in `call'
webapp.rb:92:in `block in <main>'
/sandbox/skycharts/lib/skycharts.rb:183:in `fetch_time_data'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/rrd-ffi-0.2.7/lib/rrd/base.rb:52:in `fetch'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/rrd-ffi-0.2.7/lib/rrd/wrapper.rb:121:in `fetch'
/Users/dan/.rvm/gems/ruby-1.9.2-p136@skycharts/gems/rrd-ffi-0.2.7/lib/rrd/wrapper.rb:121:in `get_array_of_string'

-- C level backtrace information -------------------------------------------

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap

RRD database Archive with 1 year problem real number

Hello, Excuse me, I have a question:

When I create a new database like;

@rrd.create :start => Time.now.utc - 1.hour, :step => 20.minutes do
datasource 'temp_c', :type => :gauge, :heartbeat => 30.minutes, :min => -70, :max => 50
datasource 'humidity', :type => :gauge, :heartbeat => 30.minutes, :min => 0, :max => 100
datasource 'pressure', :type => :gauge, :heartbeat => 30.minutes, :min => 850, :max => 1100
archive :average, :every => 20.minutes, :during => 1.day
archive :average, :every => 1.day, :during => 1.month
archive :average, :every => 1.week, :during => 1.years

Builder function return:

"DS:temp_c:GAUGE:1800:-70:50"
"DS:humidity:GAUGE:1800:0:100"
"DS:pressure:GAUGE:1800:850:1100"
"RRA:AVERAGE:0.5:1:72"
"RRA:AVERAGE:0.5:72:30"
"RRA:AVERAGE:0.5:504:52.17857142857143"

Or, I my opinion, RRA can't have real number (52.17857142857143 value.)
with option
archive :average, :every => 1.week, :during => 365.days
there isn't problem with value.

I don't know why, but in ruby:
ruby-1.9.2-p136 :159 > 1.years/365.days
=> 1.0006849315068493

Is there need add "to_i" in Builder class to avoid this phenomen? Like:

  archive = "RRA:#{consolidation_function.to_s.upcase}:0.5:#{archive_steps.to_i}:#{archive_rows.to_i}"

Please exuce my my english, and I'm newbe in Ruby...
Thanks you for rrd-ffi, thanks you for reading.

SyntaxError: rrd.rb:47 during require

Looks like there is an issue with the rrd.rb file when you try to require it.

require 'rrd.rb'
SyntaxError: rrd.rb:47: , unexpected ','
from rrd.rb:3
from rrd.rb:3:in `require'
from (irb):3

Fetching data from a rrd

I am trying to fetch data from a rrd via, but don't know how ?
Here is some code

rrd = RRD::Base.new("myrrd.rrd")
tend = Time.now
tstart = tend - 1.month
tstep = 5.minutes
rrd.create :start => Time.now - 1.year, :step => tstep do
datasource "idle", :type => :gauge, :heartbeat => tstep, :min => 0, :max => 100
datasource "irq", :type => :gauge, :heartbeat => tstep, :min => 0, :max => 100
datasource "softirq", :type => :gauge, :heartbeat => tstep, :min => 0, :max => 100
archive :average, :every => 10.minutes, :during => 1.year
end
t = tstart
while t <= tend
rrd.update t, rand(100),rand(100),rand(100)
t = t + tstep
end

now fetch data each datasource ????

rrd.fetch("idle").each do |line|
.....
end

Add support for "--daemon" option

RRD::Wrapper.fetch and RRD::Wrapper.last_update, among others possibly, do not support the "rrdtool fetch"'s and "rrdtool lastupdate"'s --daemon argument (so a flush command can be sent to the daemon prior to reading the RRD files). I see 2 options:

  1. Use rrd_fetch/lastupdate, instead of rrd_fetch_r/rrd_lastupdate_r and let those handle the --daemon option.

  2. Continue using the rrd_fetch_r/rrd_lastupdate_r functions and handle the --daemon options in Ruby by calling rrdc_flush if the option is present.

RRD::Wrapper.info does support it since it passes all options directly to rrd_info.

Opening an existing RRD

Please pardon what must seem like a ridiculous question, but how does one open an existing RRD file? I can see how new ones are created, but what about rrds that are already there? I've been through the docs on this one can can't seem the find the answer.

Thanks.

RRD::Wrapper.graph PRINTs

Does the RRD::Wrapper.graph method eat up all of the PRINT output from the graph call? Using PRINT in graph is only way to get calculated data out of an RRD, but it looks like the wrapper method just returns true and I never get any of the stats I need.

RRD::Base#fetch returns different values in the "time" column than 'rrdtool fetch'

Take this file:

require 'rrd'

rrd = RRD::Base.new("test.rrd")

time = Time.now.to_i / 300 * 300

rrd.create!(start: time, step: 5.minutes) do
  datasource "foo", type: :gauge, heartbeat: 10.minutes, min: 0.0, max: 1000000000.0
  archive :max, every: 5.minutes, during: (5*115200).minutes
end

rrd.update(time, 500)
rrd.update(time + 300, 600)
rrd.update(time + 600, 700)

puts "#{time} to #{time + 600}"

rrd.fetch!(:max, start: time, end: time + 600).each do |row|
  puts row.join("\t")
end

Compare its output with the command-line tool:

$ ruby test.rb
1392837600 to 1392838200
time    foo
1392837600  600.0
1392837900  700.0
1392838200  NaN
$ rrdtool fetch test.rrd MAX -s 1392837600 -e 1392838200
                            foo

1392837900: 6,0000000000e+02
1392838200: 7,0000000000e+02
1392838500: -nan

All time values returned by #fetch are smaller by the value of step.

Undefined constant RRD_FILE in example

./rrd_graph_sample.rb:5:in `block in <main>': uninitialized constant RRD_FILE (NameError)
        from /var/lib/gems/1.9.1/gems/rrd-ffi-0.2.13/lib/rrd.rb:18:in `instance_eval'
        from /var/lib/gems/1.9.1/gems/rrd-ffi-0.2.13/lib/rrd.rb:18:in `graph'
        from ./rrd_graph_sample.rb:4:in `<main>'

Will try to guess what it is and where it should be defined...

Stack graph

Im not able to find any information about use of stack feature. Is this feature included? How to use it... I tried it witd DSL, but I got an error.

Option for using wrapper bang methods

I was debugging why my graphs didn't generate, and only after changing the Graph.save method to use the wrapper bang method, i got an error. Took my a while to figure out.

So maybe an option for turning on bang methods during development?

Support for rrdtool 1.6?

Any chance on supporting rrdtool 1.6.0?

I ran into this error:

dyld: lazy symbol binding failed: Symbol not found: _rrd_get_context
  Referenced from: /usr/local/lib/librrd.dylib
  Expected in: flat namespace

dyld: Symbol not found: _rrd_get_context
  Referenced from: /usr/local/lib/librrd.dylib
  Expected in: flat namespace

Downgrading rrdtool (to 1.4.8_1 in my case) fixed it for me.

(The error above my actually be unrelated to rrd-ffi?)

Dependency problem with ActiveSupport > 3.0.9?

Sorry for spamming your issue list but think I found another problem. When I install the gem it installs the latest version of ActiveSupport as well as this is a dependency of the gem. No problem there if it wouldn't be for the new version of ActiveSupport. It installs 3.1.3 (at the time of writing) and that one doesn't seem to have the Time#advance method that is used in the gem. I downgraded ActiveSupport to 3.0.9 (as that's the stable version released before your last commit) and indeed, that one does not error out.

Memory leak

I use RRD-FFI in a Rails 3 application to fetch data from RRD files, and the RAM used by the thin process is growing over time (my application fetch data from a RRD file every 10 seconds).
My code works like this :

rrd = RRD::Base.new(path)
results = rrd.fetch(:average, :start => start_date, :end => end_date)
info = rrd.info
# ... some processing
rrd = nil

Adding rrd = nil at the end helps a bit, but there is still some memory leaking.
I think there can be the same problem as here : http://stackoverflow.com/questions/181406/ruby-memory-management/181433#181433. Maybe a rrd.destroy! method can be added, to force the release of all librrd + rrd-ffi memory ?

Variable as datasource name

Hi Thiago,

While checking the fix you released I ran in another problem... It seems you can't assign a datasource with a variable.

some_var = "memory"
rrd.create :start => start_time, :step => 10.minutes do
  datasource some_var, :type => :gauge, :heartbeat => 15.minutes, :min => 0, :max => 100
  archive :average, :every => 20.minutes, :during => 1.month
end

The some_var in the example is the problem. Everything works fine as long as it is a string but once I replace it with a variable he won't create the RRD file anymore:

Invalid DS name

I traced back the problem to the builder in the gem. I suppose the builder.instance_eval does something weird with the variable.

generating graph sometimes loops glib on OSX 10.7.5

Hi,

Having all latest libraries (glib 2.36.0, pango 1.34.0, rrdtool 1.4.7).
I'm trying to generate an rrdgraph using very simple command

    RRD.graph! tmp.path, :title => "graf", :start => 1.hour.ago do
      line filename, :sum => :average, :color => "#ff0000", :label => "test"
    end

it sometimes generates graph instantly but quite often command hungs up and looping output:

(process:3461): GLib-GObject-CRITICAL **: g_object_get_qdata: assertion `G_IS_OBJECT (object)' failed

(process:3461): GLib-GObject-CRITICAL **: g_object_replace_qdata: assertion `G_IS_OBJECT (object)' failed

(process:3461): GLib-GObject-CRITICAL **: g_object_get_qdata: assertion `G_IS_OBJECT (object)' failed

(process:3461): GLib-GObject-CRITICAL **: g_object_replace_qdata: assertion `G_IS_OBJECT (object)' failed

It never ends, just showing these information, I have to kill -9 whole rails app to terminate it.

Using rrdtool command from console never behaved like this.

Any idea why it goes like this?

Cheers

I18n dependency

Hi, when I install the gem and run a simple Ruby script that tries to render a RRD graph it breaks because it needs the i18n gem. Installing the gem from RubyGems solves that problem but I was wondering why it isn't specified as a dependency in the gemspec? Seems I don't need the gem if all I want to do is write data to a RRD file.

For future reference:

/usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': no such file to load -- i18n (LoadError)
    from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p290@rrd/gems/activesupport-3.1.3/lib/active_support/i18n.rb:2:in `<top (required)>'
    from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from /usr/local/rvm/gems/ruby-1.9.2-p290@rrd/gems/activesupport-3.1.3/lib/active_support/inflector/transliterate.rb:3:in `<top (required)>'

add HRULE

This is a monkey-patch, but allows for basic HRULE usage:

module RRD
  class Graph
    def draw_hrule(options)
      options = {:width => 1}.merge options
      type = "HRULE"
      draw(type, options)
    end
  end
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.