pagerduty_utils 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/pgutils +5 -3
- data/lib/tapjoy/pagerduty/base.rb +6 -4
- data/lib/tapjoy/pagerduty/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 786adecf96f43aeb54c2af64796a9927103ced49
|
4
|
+
data.tar.gz: af8ef65148b3512825a2dbf6a476bab48230b0da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf597585a1c3a0aebc8f7673c9d28dd6b30814d1b99540703ca3901e6a551317454624afed97447d888e9a948cf62f0ef3880a2758e8f4c86cae4cfbc0c27c59
|
7
|
+
data.tar.gz: c7c4a7b7868e078ef026306140719e2563977931e84d1505c2d5db9b6dac6a379777020c11972cbb52d950dc214d45fe7c248270479f75a4a7f8605cdabeadf1
|
data/bin/pgutils
CHANGED
@@ -71,12 +71,14 @@ when 'get_on_call'
|
|
71
71
|
puts '---'
|
72
72
|
end
|
73
73
|
when 'audit'
|
74
|
-
Trollop::options do
|
74
|
+
opts = Trollop::options do
|
75
75
|
usage 'audit'
|
76
|
-
|
76
|
+
opt :since, 'Get list of incidents since the given time window in days', default: 30, type: :int
|
77
|
+
opt :until, 'Get list of incidents until the given time window in days relative to since parameter', default: 30, type: :int
|
78
|
+
synopsis "\nBy default, this script will return the last 30 days of pages or last 100 pages, which ever is fewer.\nThere are parameters to adjust the date range, but 100 pages is still the cap."
|
77
79
|
end
|
78
80
|
|
79
|
-
incidents = Tapjoy::PagerDuty::Base.new.get_incidents
|
81
|
+
incidents = Tapjoy::PagerDuty::Base.new.get_incidents(query_start: opts[:since], query_end: opts[:until])
|
80
82
|
puts incidents['incidents'].to_yaml
|
81
83
|
puts "Total Alerts: #{incidents['total']}"
|
82
84
|
|
@@ -9,8 +9,8 @@ module Tapjoy
|
|
9
9
|
pg_conn = YAML.load_file(config_file) if File.readable?(config_file)
|
10
10
|
|
11
11
|
@AUTH_HEADER = {
|
12
|
-
:
|
13
|
-
:
|
12
|
+
subdomain: ENV['PAGERDUTY_SUBDOMAIN'] || pg_conn[:subdomain],
|
13
|
+
token_string: "Token token=#{ENV['PAGERDUTY_API_TOKEN'] || pg_conn[:api_token]}"
|
14
14
|
}
|
15
15
|
|
16
16
|
raise 'Missing subdomain value' if @AUTH_HEADER[:subdomain].nil?
|
@@ -82,8 +82,10 @@ module Tapjoy
|
|
82
82
|
post_object(endpoint, data)
|
83
83
|
end
|
84
84
|
|
85
|
-
def get_incidents
|
86
|
-
|
85
|
+
def get_incidents(query_start:, query_end:)
|
86
|
+
since_date = Date.today - query_start
|
87
|
+
until_date = since_date + query_end
|
88
|
+
endpoint = "#{return_pagerduty_url(:incidents)}?since=#{since_date}&until=#{until_date}"
|
87
89
|
return get_object(endpoint)
|
88
90
|
end
|
89
91
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagerduty_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ali Tayarani
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-05-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: trollop
|