Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

rescue alerts when gsub fails

  • Loading branch information...
commit d33f9d1bd8dc465f41a1d8859a864bccf36fc5b4 1 parent 50e5fc4
@obfuscurity authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 bin/pagerduty_to_graphite.rb
View
8 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
Please sign in to comment.
Something went wrong with that request. Please try again.