Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
mutators/graphite.rbの修正
root@sensu:~# diff -u /tmp/graphite.rb /etc/sensu/mutators/graphite.rb
--- /tmp/graphite.rb 2014-10-09 10:45:00.774510474 +0900
+++ /etc/sensu/mutators/graphite.rb 2014-10-07 13:21:55.672353581 +0900
@@ -31,8 +31,10 @@
# parse event
event = JSON.parse(STDIN.read, :symbolize_names => true)
-if ARGV[0] == "-r" || ARGV[0] == "--reverse"
- puts event[:check][:output].gsub(event[:client][:name], event[:client][:name].split('.').reverse.join("."))
-else
- puts event[:check][:output].gsub(event[:client][:name], event[:client][:name].gsub('.', '_'))
+event[:check][:output].split(/\r?\n/).each do |l|
+ if ARGV[0] == "-r" || ARGV[0] == "--reverse"
+ puts l.gsub(event[:client][:name], event[:client][:name].split('.').reverse.join("."))
+ else
+ puts l.gsub(event[:client][:name], event[:client][:name].gsub('.', '_'))
+ end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment