lib/riemann/babbler/plugin.rb in riemann-babbler-0.2.6 vs lib/riemann/babbler/plugin.rb in riemann-babbler-0.2.7
- old
+ new
@@ -31,11 +31,14 @@
@configatron
end
alias :opts :options
def report(event)
- report_with_diff(event) and return if event[:is_diff]
+ case event[:metric]
+ when Hash
+ report_with_diff(event) and return
+ end
event[:tags] = options.riemann.tags unless options.riemann.tags.nil?
event[:host] = host
log.debug "Report status: #{event.inspect}"
riemann << event
end
@@ -43,10 +46,10 @@
def report_with_diff(event)
current_metric = event[:metric][:value]
event[:metric][:value] = current_metric - @storage[ event[:service] ] if @storage.has_key? event[:service]
@storage[ event[:service] ] = current_metric
event[:state] = state(current_metric) unless plugin.states.critical.nil?
- event.delete(:is_diff)
+ event[:metric] = event[:metric][:value]
report(event)
end
def host
hostname = `hostname`.chomp.downcase