Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- pagerduty example

  • Loading branch information...
commit 69ec564891dc15c8927b0394b1c3db3bf50aa37c 1 parent 9f08efa
@carimura carimura authored
Showing with 3 additions and 3 deletions.
  1. +2 −3 ruby/pagerduty/pagerduty_worker.rb
  2. +1 −0  ruby/pagerduty/runner.rb
View
5 ruby/pagerduty/pagerduty_worker.rb
@@ -1,13 +1,12 @@
class PagerdutyWorker < IronWorker::Base
merge_gem 'httparty'
- attr_accessor :pd_token
+ attr_accessor :api_key
def run
begin
# Your worker code in here
-
rescue => ex
trigger_alert(ex)
raise ex
@@ -18,7 +17,7 @@ def run
# Method to hit the PagerDuty "Generic API" trigger
def trigger_alert(ex)
payload = {
- "service_key" => pd_token,
+ "service_key" => api_key,
"event_type" => "trigger",
"description" => "#{ex} - #{ex.backtrace}",
}.to_json
View
1  ruby/pagerduty/runner.rb
@@ -8,4 +8,5 @@
end
worker = PagerdutyWorker.new
+worker.api_key = YOUR_PAGERDUTY_API_KEY
worker.queue
Please sign in to comment.
Something went wrong with that request. Please try again.