lib/zabbix_pusher/jmx.rb in zabbix_pusher-0.0.6 vs lib/zabbix_pusher/jmx.rb in zabbix_pusher-0.1.0
- old
+ new
@@ -52,20 +52,20 @@
def read(mbean,attribute,path=nil,config={})
payload = { "type" => "READ", "mbean" => mbean, "attribute" => attribute}
payload["path"] = path if path
payload["config"] = config if config.length > 0
ap payload.to_json
- self.class.post('/jolokia', :body => payload.to_json)
+ self.class.post('/jolokia', :body => payload.to_json, :timeout => 5)
end
def version
self.class.post('/jolokia', :body => { "type" => "VERSION"}.to_json)
end
def processed_items
- data = self.class.post('/jolokia', :body => @payload.to_json)
+ data = self.class.post('/jolokia', :body => @payload.to_json, :timeout => 5) rescue nil
result = Hash.new
- data.each{|datum| result[result_key(datum)] = datum['value'] if datum['request']}
+ data.each{|datum| result[result_key(datum)] = datum['value'] if datum['request']} if data
result
end
private
\ No newline at end of file