lib/riemann/babbler/plugin_helpers.rb in riemann-babbler-0.6.1 vs lib/riemann/babbler/plugin_helpers.rb in riemann-babbler-0.6.2

- old
+ new

@@ -15,11 +15,12 @@ def shell(*cmd) exit_status=nil err=nil out=nil begin - Timeout::timeout(5) { + timeout_shell = ( plugin.interval * 2 ).to_f/3 + Timeout::timeout(timeout_shell) { Open3.popen3(*cmd) do |stdin, stdout, stderr, wait_thread| err = stderr.gets(nil) out = stdout.gets(nil) [stdin, stdout, stderr].each{|stream| stream.send('close')} exit_status = wait_thread.value @@ -40,10 +41,10 @@ end # db get # http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html # - def db_get(connection_string, query) + def sql(connection_string, query) begin db = Sequel.connect connection_string db.fetch(query) rescue => e helper_error "#{e.class} #{e}\n#{e.backtrace.join "\n"}"