summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorlaf <neil@lathwood.co.uk>2017-11-10 14:12:13 +0000
committerlaf <neil@lathwood.co.uk>2017-11-10 14:12:13 +0000
commit29704b5f2721a742d312ced784a8076e27e8063b (patch)
tree8a6906e1a78fee80e3ffd520996bde892689939d /lib
parentd156ac397beffabe3f0cb045f923050a3ab74887 (diff)
Added sql support for calling for single host
Diffstat (limited to 'lib')
-rw-r--r--lib/oxidized/source/http.rb6
-rw-r--r--lib/oxidized/source/sql.rb3
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/oxidized/source/http.rb b/lib/oxidized/source/http.rb
index e4cb58e..73df6f7 100644
--- a/lib/oxidized/source/http.rb
+++ b/lib/oxidized/source/http.rb
@@ -15,7 +15,7 @@ class HTTP < Source
require "uri"
require "json"
- def load node=nil
+ def load node_want=nil
nodes = []
uri = URI.parse(@cfg.url)
http = Net::HTTP.new(uri.host, uri.port)
@@ -29,8 +29,8 @@ class HTTP < Source
end
req_uri = uri.request_uri
- if node
- req_uri = "#{req_uri}/#{node}"
+ if node_want
+ req_uri = "#{req_uri}/#{node_want}"
end
request = Net::HTTP::Get.new(req_uri, headers)
if (@cfg.user? && @cfg.pass?)
diff --git a/lib/oxidized/source/sql.rb b/lib/oxidized/source/sql.rb
index 13fc39b..7e2824d 100644
--- a/lib/oxidized/source/sql.rb
+++ b/lib/oxidized/source/sql.rb
@@ -18,11 +18,12 @@ class SQL < Source
end
end
- def load
+ def load node_want=nil
nodes = []
db = connect
query = db[@cfg.table.to_sym]
query = query.with_sql(@cfg.query) if @cfg.query?
+ query = qeury.where(@cfg.map.name.to_sym node_want)
query.each do |node|
# map node parameters
keys = {}