Permalink
Browse files

rescue alerts when gsub fails

  • Loading branch information...
1 parent 50e5fc4 commit d33f9d1bd8dc465f41a1d8859a864bccf36fc5b4 @obfuscurity committed Apr 5, 2013
Showing with 6 additions and 2 deletions.
  1. +6 −2 bin/pagerduty_to_graphite.rb
@@ -78,9 +78,13 @@
when 'nagios'
data = alert['trigger_summary_data']
outage = data['SERVICEDESC'] === '' ? 'host_down' : data['SERVICEDESC']
- metric = "nagios.#{data['HOSTNAME'].gsub(/\./, '_')}.#{outage}"
+ begin
+ metric = "nagios.#{data['HOSTNAME'].gsub(/\./, '_')}.#{outage}"
+ rescue
+ puts "UNKNOWN ALERT: #{alert.to_json}"
+ end
when 'Enterprise Zendesk'
- metric = "enterprise.zendesk.#{alert['service']['id']}"
+ metric = "enterprise.zendesk.#{alert['service']['id']}"
else
puts "UNKNOWN ALERT: #{alert.to_json}"
end

0 comments on commit d33f9d1

Please sign in to comment.