doggy 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/doggy/model/dash.rb +6 -5
- data/lib/doggy/model/monitor.rb +12 -6
- data/lib/doggy/model/screen.rb +2 -2
- data/lib/doggy/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a08db9823ee6c5ed48f47766bfd0efbea67b6ed
|
4
|
+
data.tar.gz: dbd6aa580574f14850b44d1b9ceea5038171127b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a14f340fe533e1169ea5ad4612fcaca875c6a903a4a9d8c7b3c82ef59cbfefa5d500426e59c1767553aef7de07249a8cdf742d3841abdc0fb91b998df0b29ca
|
7
|
+
data.tar.gz: 9a9917fd410dd1d4648a574d6b8f2f1371e9b5d43b8834af9ab33e1b49c3be9d0637dff54e0a4a928089b43460aa99f2208609a62f9b385fea1bf1c7fc54e124
|
data/Gemfile.lock
CHANGED
data/lib/doggy/model/dash.rb
CHANGED
@@ -51,8 +51,8 @@ module Doggy
|
|
51
51
|
|
52
52
|
def raw
|
53
53
|
@raw ||= begin
|
54
|
-
result = Doggy.client.dog.get_dashboard(@id)
|
55
|
-
result && result[
|
54
|
+
status, result = Doggy.client.dog.get_dashboard(@id)
|
55
|
+
result && result['dash'] && result['dash'].sort.to_h || {}
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
@@ -62,9 +62,10 @@ module Doggy
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def save
|
65
|
-
return if raw
|
66
|
-
return if raw['
|
67
|
-
return if raw
|
65
|
+
return if raw.nil? || raw.empty? # do not save if it's empty
|
66
|
+
return if raw['errors'] # do not save if there are any errors
|
67
|
+
return if raw['title'] =~ Doggy::DOG_SKIP_REGEX # do not save if it had skip tag in title
|
68
|
+
|
68
69
|
File.write(path, Doggy.serializer.dump(raw))
|
69
70
|
end
|
70
71
|
|
data/lib/doggy/model/monitor.rb
CHANGED
@@ -57,11 +57,16 @@ module Doggy
|
|
57
57
|
|
58
58
|
def raw
|
59
59
|
@raw ||= begin
|
60
|
-
alert = Doggy.client.dog.get_monitor(@id)
|
60
|
+
status, alert = Doggy.client.dog.get_monitor(@id)
|
61
|
+
|
62
|
+
return if status != '200'
|
63
|
+
|
61
64
|
alert.delete('state') # delete unnecessary state
|
62
65
|
alert.delete('overall_state') # delete unnecessary state
|
63
|
-
|
64
|
-
|
66
|
+
if alert['options']
|
67
|
+
alert['options'].delete('silenced') # delete unnecessary state
|
68
|
+
alert['options'] = alert['options'].sort.to_h # sort option keys; DataDog response is not ordered
|
69
|
+
end
|
65
70
|
alert && alert.sort.to_h
|
66
71
|
end
|
67
72
|
end
|
@@ -72,9 +77,10 @@ module Doggy
|
|
72
77
|
end
|
73
78
|
|
74
79
|
def save
|
75
|
-
return if raw
|
76
|
-
return if raw['
|
77
|
-
return if raw
|
80
|
+
return if raw.nil? || raw.empty? # do not save if it's empty
|
81
|
+
return if raw['errors'] # do not save if there are any errors
|
82
|
+
return if raw['name'] =~ Doggy::DOG_SKIP_REGEX # do not save if it had skip tag in title
|
83
|
+
|
78
84
|
File.write(path, Doggy.serializer.dump(raw))
|
79
85
|
end
|
80
86
|
|
data/lib/doggy/model/screen.rb
CHANGED
data/lib/doggy/version.rb
CHANGED