kubernetes_health_checker 0.0.0.16 → 0.0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/kubernetes_health_checker +19 -20
- data/bin/kubernetes_health_checkerd +2 -2
- data/bin/mock_output.txt +4 -4
- data/bin/mock_output_two.txt +2 -2
- metadata +10 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdfdca84d108f5bb2f4ee6912fcf166c720bca238b7f51218419055c58e1b3c6
|
4
|
+
data.tar.gz: b5da5ff0da0ac21def85f1ed37ab81cfa125982155d8af46b723648b810fb72a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e079e08b3927bea6917777a17531182e2afa21edd28f9acb1d9adc4360d28195ba96a1f4d2ac4926dcbf692c037ac2e261cc22020c1cdb713a3600ccd79c1b8f
|
7
|
+
data.tar.gz: d707a0f60b6ecca4df52a61871895744a0eca423ea0c825b16c48da243a5c1f5765f2803249c2a1301cd87f580d2aa8314ece373b8c6ef085a38359c04c3cdfc
|
@@ -15,19 +15,17 @@ module KubernetesHealthChecker
|
|
15
15
|
method_option :url, aliases: '-u', type: :string, desc: 'Specify the slack url you would like the alert POSTed to'
|
16
16
|
method_option :test, aliases: '-t', type: :boolean, desc: 'Specify if running the gem in test mode'
|
17
17
|
|
18
|
-
ALERT_STATUSES = [
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
'runconatinererror',
|
23
|
-
'createcontainerconfigerror',
|
24
|
-
].freeze
|
18
|
+
ALERT_STATUSES = %w[crashloopbackoff
|
19
|
+
error
|
20
|
+
runcontainererror
|
21
|
+
createcontainerconfigerror].freeze
|
25
22
|
|
26
23
|
# time is in seconds
|
27
24
|
TIMED_ALERT_STATUSES = {
|
28
25
|
'pending' => 120,
|
29
|
-
'
|
30
|
-
|
26
|
+
'errimagepull' => 120,
|
27
|
+
'containercreating' => 120
|
28
|
+
}.freeze
|
31
29
|
|
32
30
|
RUN_INTERVAL = 10
|
33
31
|
|
@@ -46,16 +44,15 @@ module KubernetesHealthChecker
|
|
46
44
|
|
47
45
|
desc 'version', 'Prints version'
|
48
46
|
def version
|
49
|
-
say
|
47
|
+
say 'KubernetesHealthChecker 0.0.0'
|
50
48
|
end
|
51
49
|
|
52
50
|
no_commands do
|
53
51
|
def set_defaults(options)
|
54
|
-
opts = options.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
52
|
+
opts = options.inject({}) { |memo, (k, v)| memo[k.to_sym] = v; memo }
|
55
53
|
@alert_threshold = opts[:alert_threshold] || 5
|
56
54
|
@slack_channel = opts[:channel] || '@rohan'
|
57
|
-
|
58
|
-
@namespace = opts[:namespace].split(',') || ['default']
|
55
|
+
@namespace = opts[:namespace]&.split(',') || ['default']
|
59
56
|
@test = opts[:test] || false
|
60
57
|
@url = opts[:url]
|
61
58
|
@pods_data = {}
|
@@ -69,7 +66,7 @@ module KubernetesHealthChecker
|
|
69
66
|
if @test
|
70
67
|
# so hacky, but pulls from second mock output if
|
71
68
|
# it's the second time running to test state changes
|
72
|
-
file_name = @pods_data.empty? ? '../mock_output.txt' : '../
|
69
|
+
file_name = @pods_data.empty? ? '../mock_output.txt' : '../mock_output_two.txt'
|
73
70
|
path = File.expand_path(file_name, __FILE__)
|
74
71
|
output = File.read(path)
|
75
72
|
else
|
@@ -90,7 +87,7 @@ module KubernetesHealthChecker
|
|
90
87
|
channel: @slack_channel,
|
91
88
|
username: 'kubernetes_health_check_bot',
|
92
89
|
text: message,
|
93
|
-
icon_emoji:
|
90
|
+
icon_emoji: ':face_with_thermometer:'
|
94
91
|
}
|
95
92
|
|
96
93
|
`curl -X POST --data-urlencode 'payload=#{JSON.generate(payload)}' #{@url}`
|
@@ -99,7 +96,7 @@ module KubernetesHealthChecker
|
|
99
96
|
def get_pod_message(pod_name:, new_status:, new_restarts:, age:)
|
100
97
|
old_restarts = @pods_data[pod_name][:restarts]
|
101
98
|
old_status = @pods_data[pod_name][:status]
|
102
|
-
text =
|
99
|
+
text = ''
|
103
100
|
|
104
101
|
if !@pods_data[pod_name].empty? && old_restarts == new_restarts && old_status == new_status
|
105
102
|
# we've already alerted from this state, skip
|
@@ -119,20 +116,22 @@ module KubernetesHealthChecker
|
|
119
116
|
|
120
117
|
def construct_message(output)
|
121
118
|
message = ''
|
122
|
-
new_pod_store = {}
|
123
119
|
|
124
120
|
rows = output.split("\n")
|
125
121
|
rows.each_with_index do |row, index|
|
126
122
|
next if index == 0
|
127
123
|
|
128
|
-
row = row.split(
|
124
|
+
row = row.split(' ')
|
129
125
|
pod_name = row[0]
|
130
126
|
status = row[2]
|
131
127
|
restarts = row[3].to_i
|
132
128
|
age = get_age_in_seconds(row[4])
|
133
129
|
|
134
130
|
@pods_data[pod_name] ||= {}
|
135
|
-
message += get_pod_message(pod_name: pod_name,
|
131
|
+
message += get_pod_message(pod_name: pod_name,
|
132
|
+
new_status: status,
|
133
|
+
new_restarts: restarts,
|
134
|
+
age: age)
|
136
135
|
|
137
136
|
# update our data store for the pods
|
138
137
|
@pods_data[pod_name][:status] = status
|
@@ -163,4 +162,4 @@ module KubernetesHealthChecker
|
|
163
162
|
end
|
164
163
|
end
|
165
164
|
|
166
|
-
KubernetesHealthChecker::Runner.start
|
165
|
+
KubernetesHealthChecker::Runner.start
|
data/bin/mock_output.txt
CHANGED
@@ -6,7 +6,7 @@ affinity-external-api-dep-1624144290-zqsfb 0/2 Evicted 0
|
|
6
6
|
affinity-external-api-dep-3283253972-ttgft 2/2 Running 0 1d
|
7
7
|
automate-affinity-pipeline-rc-l6zb0 1/1 Running 0 1d
|
8
8
|
compute-relationship-strengths-rc-x8mv1 1/1 Running 0 1d
|
9
|
-
convert-html-to-text-consumer-rc-lx0s5 1/1
|
9
|
+
convert-html-to-text-consumer-rc-lx0s5 1/1 Pending 0 1d
|
10
10
|
create-contacts-consumer-rc-h5hj7 1/1 Running 0 1d
|
11
11
|
create-deal-emails-consumer-rc-qd7n4 1/1 Running 10 22h
|
12
12
|
create-smart-alert-notifications-rc-d87p2 1/1 Running 0 1d
|
@@ -19,8 +19,8 @@ ditto2-rc-ffj0s 1/1 Running 3
|
|
19
19
|
ditto3-rc-ntdz9 1/1 Running 1 22h
|
20
20
|
dump-new-persons-for-labeling-rc-p043f 1/1 Running 0 1d
|
21
21
|
extract-introductions-consumer-rc-32d29 1/1 Running 1 1d
|
22
|
-
extract-signatures-consumer-rc-4n0wl 1/1
|
23
|
-
fetch-public-metadata-rc-g94b0 1/1
|
22
|
+
extract-signatures-consumer-rc-4n0wl 1/1 ErrImagePull 0 60s
|
23
|
+
fetch-public-metadata-rc-g94b0 1/1 ErrImagePull 0 130s
|
24
24
|
health-check-rc-wkh2t 1/1 Running 0 22h
|
25
25
|
helper-rc-17pmz 1/1 Running 0 22h
|
26
26
|
import-companies-rc-grkkm 1/1 Running 0 1d
|
@@ -104,4 +104,4 @@ weave-net-h29cn 2/2 R
|
|
104
104
|
weave-net-mqjcw 2/2 Running 4 68d
|
105
105
|
weave-net-r85qh 2/2 Running 0 2h
|
106
106
|
weave-net-wgsml 2/2 Running 12 68d
|
107
|
-
weave-net-zdz7j 2/2 Running 4 19d
|
107
|
+
weave-net-zdz7j 2/2 Running 4 19d
|
data/bin/mock_output_two.txt
CHANGED
@@ -54,7 +54,7 @@ send-inactive-user-emails-rc-92pf0 1/1 CrashLoopBackO
|
|
54
54
|
send-weekly-summary-email-rc-vmr8s 1/1 Running 0 1d
|
55
55
|
shoryuken-ews-syncer-rc-rr512 1/1 Running 1 1d
|
56
56
|
shoryuken-ews-syncer-rc-wq76w 1/1 Running 1 1d
|
57
|
-
shoryuken-insert-emails-rc-65ct6 1/1
|
57
|
+
shoryuken-insert-emails-rc-65ct6 1/1 Pending 2 1d
|
58
58
|
sidekiq-rc-kz4tc 1/1 Running 0 1d
|
59
59
|
sidekiq-rc-wl7pm 1/1 Running 0 1d
|
60
60
|
sidekiq-web-dep-1155096845-kfs0h 2/2 Running 0 1d
|
@@ -67,4 +67,4 @@ update-dropped-email-alerts-consumer-rc-n3069 1/1 Running 1
|
|
67
67
|
update-email-count-rc-s29lk 1/1 Running 0 1d
|
68
68
|
update-primary-emails-rc-6sd8b 1/1 Running 0 1d
|
69
69
|
update-sources-consumer-rc-zrf2f 1/1 Running 0 22h
|
70
|
-
vacuum-analyze-db-rc-jr14r 1/1 Running 0 1d
|
70
|
+
vacuum-analyze-db-rc-jr14r 1/1 Running 0 1d
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kubernetes_health_checker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.0.
|
4
|
+
version: 0.0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rohan Sahai
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: daemons
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -65,11 +65,11 @@ files:
|
|
65
65
|
- bin/kubernetes_health_checkerd
|
66
66
|
- bin/mock_output.txt
|
67
67
|
- bin/mock_output_two.txt
|
68
|
-
homepage:
|
68
|
+
homepage: https://rubygems.org/gems/kubernetes_health_checker
|
69
69
|
licenses:
|
70
70
|
- MIT
|
71
71
|
metadata: {}
|
72
|
-
post_install_message:
|
72
|
+
post_install_message:
|
73
73
|
rdoc_options: []
|
74
74
|
require_paths:
|
75
75
|
- lib
|
@@ -77,16 +77,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
77
77
|
requirements:
|
78
78
|
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version: '
|
80
|
+
version: '2.4'
|
81
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
83
|
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
86
|
requirements: []
|
87
|
-
|
88
|
-
|
89
|
-
signing_key:
|
87
|
+
rubygems_version: 3.2.3
|
88
|
+
signing_key:
|
90
89
|
specification_version: 4
|
91
90
|
summary: Get notifications for unhealthy kubernetes pods
|
92
91
|
test_files: []
|