lib/riemann/babbler/plugin.rb in riemann-babbler-0.2.2 vs lib/riemann/babbler/plugin.rb in riemann-babbler-0.2.3
- old
+ new
@@ -31,10 +31,11 @@
@configatron
end
alias :opts :options
def report(event)
+ report_with_diff(event) and return if event[:is_diff]
event[:tags] = options.riemann.tags unless options.riemann.tags.nil?
event[:host] = host
log.debug "Report status: #{event.inspect}"
riemann << event
end
@@ -42,9 +43,10 @@
def report_with_diff(event)
current_metric = event[:metric]
event[:metric] = 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)
report(event)
end
def host
hostname = `hostname`.chomp.downcase