lib/riemann/babbler/plugin_helpers.rb in riemann-babbler-0.6.0 vs lib/riemann/babbler/plugin_helpers.rb in riemann-babbler-0.6.1
- old
+ new
@@ -37,9 +37,21 @@
# статус 0, вывода stdout нет
return ""
end
end
+ # db get
+ # http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html
+ #
+ def db_get(connection_string, query)
+ begin
+ db = Sequel.connect connection_string
+ db.fetch(query)
+ rescue => e
+ helper_error "#{e.class} #{e}\n#{e.backtrace.join "\n"}"
+ end
+ end
+
# http rest
def rest_get(url)
begin
RestClient.get url
rescue