kubernetes_health_checker 0.0.0.13 → 0.0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/kubernetes_health_checker +21 -14
- data/bin/kubernetes_health_checkerd +2 -2
- data/bin/mock_output.txt +4 -4
- data/bin/mock_output_two.txt +3 -3
- 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: 04c9edd180bc5b7cbc5817aefa5f2042e9869fde66a3e8174e74a4e34dcf7eda
|
4
|
+
data.tar.gz: 5a0c2f19cb8edf82262f9a4edb7e69f47cc97e66998b31f4b278674207dbe407
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f4971d2141909c3894acdc178a327ddcf59b57d4ab0dee6f8e74694cfc0112ee8c3773c895fa0cc166b7b2b1ff8bc9659913378ab6eb4969c5087cbf2709829
|
7
|
+
data.tar.gz: 1152dfc7a0566b0df1d3d1649be64c6fda3a8f8d9775ff4dafcbd6b40df828c80a57c7b0217ae7b4e64da5f61699d93d8a96afebc362d38bf5593252ff8862f0
|
@@ -15,15 +15,20 @@ 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 = [
|
18
|
+
ALERT_STATUSES = %w[crashloopbackoff
|
19
|
+
error
|
20
|
+
runcontainererror
|
21
|
+
createcontainerconfigerror
|
22
|
+
oomkilled].freeze
|
19
23
|
|
20
24
|
# time is in seconds
|
21
25
|
TIMED_ALERT_STATUSES = {
|
22
|
-
'pending' =>
|
23
|
-
'
|
24
|
-
|
26
|
+
'pending' => 120,
|
27
|
+
'errimagepull' => 120,
|
28
|
+
'containercreating' => 120
|
29
|
+
}.freeze
|
25
30
|
|
26
|
-
RUN_INTERVAL =
|
31
|
+
RUN_INTERVAL = 10
|
27
32
|
|
28
33
|
def start
|
29
34
|
set_defaults(options)
|
@@ -40,15 +45,15 @@ module KubernetesHealthChecker
|
|
40
45
|
|
41
46
|
desc 'version', 'Prints version'
|
42
47
|
def version
|
43
|
-
say
|
48
|
+
say 'KubernetesHealthChecker 0.0.0'
|
44
49
|
end
|
45
50
|
|
46
51
|
no_commands do
|
47
52
|
def set_defaults(options)
|
48
|
-
opts = options.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
53
|
+
opts = options.inject({}) { |memo, (k, v)| memo[k.to_sym] = v; memo }
|
49
54
|
@alert_threshold = opts[:alert_threshold] || 5
|
50
55
|
@slack_channel = opts[:channel] || '@rohan'
|
51
|
-
@namespace = opts[:namespace]
|
56
|
+
@namespace = opts[:namespace]&.split(',') || ['default']
|
52
57
|
@test = opts[:test] || false
|
53
58
|
@url = opts[:url]
|
54
59
|
@pods_data = {}
|
@@ -83,7 +88,7 @@ module KubernetesHealthChecker
|
|
83
88
|
channel: @slack_channel,
|
84
89
|
username: 'kubernetes_health_check_bot',
|
85
90
|
text: message,
|
86
|
-
icon_emoji:
|
91
|
+
icon_emoji: ':face_with_thermometer:'
|
87
92
|
}
|
88
93
|
|
89
94
|
`curl -X POST --data-urlencode 'payload=#{JSON.generate(payload)}' #{@url}`
|
@@ -92,7 +97,7 @@ module KubernetesHealthChecker
|
|
92
97
|
def get_pod_message(pod_name:, new_status:, new_restarts:, age:)
|
93
98
|
old_restarts = @pods_data[pod_name][:restarts]
|
94
99
|
old_status = @pods_data[pod_name][:status]
|
95
|
-
text =
|
100
|
+
text = ''
|
96
101
|
|
97
102
|
if !@pods_data[pod_name].empty? && old_restarts == new_restarts && old_status == new_status
|
98
103
|
# we've already alerted from this state, skip
|
@@ -112,20 +117,22 @@ module KubernetesHealthChecker
|
|
112
117
|
|
113
118
|
def construct_message(output)
|
114
119
|
message = ''
|
115
|
-
new_pod_store = {}
|
116
120
|
|
117
121
|
rows = output.split("\n")
|
118
122
|
rows.each_with_index do |row, index|
|
119
123
|
next if index == 0
|
120
124
|
|
121
|
-
row = row.split(
|
125
|
+
row = row.split(' ')
|
122
126
|
pod_name = row[0]
|
123
127
|
status = row[2]
|
124
128
|
restarts = row[3].to_i
|
125
129
|
age = get_age_in_seconds(row[4])
|
126
130
|
|
127
131
|
@pods_data[pod_name] ||= {}
|
128
|
-
message += get_pod_message(pod_name: pod_name,
|
132
|
+
message += get_pod_message(pod_name: pod_name,
|
133
|
+
new_status: status,
|
134
|
+
new_restarts: restarts,
|
135
|
+
age: age)
|
129
136
|
|
130
137
|
# update our data store for the pods
|
131
138
|
@pods_data[pod_name][:status] = status
|
@@ -156,4 +163,4 @@ module KubernetesHealthChecker
|
|
156
163
|
end
|
157
164
|
end
|
158
165
|
|
159
|
-
KubernetesHealthChecker::Runner.start
|
166
|
+
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
@@ -25,7 +25,7 @@ health-check-rc-wkh2t 1/1 Running 0
|
|
25
25
|
helper-rc-17pmz 1/1 Running 0 22h
|
26
26
|
import-companies-rc-grkkm 1/1 Running 0 1d
|
27
27
|
import-company-metadata-rc-n094g 1/1 Running 0 22h
|
28
|
-
import-crunchbase-metadata-rc-94433 1/1
|
28
|
+
import-crunchbase-metadata-rc-94433 1/1 OOMKilled 0 1d
|
29
29
|
import-person-metadata-rc-wkvrg 1/1 Running 0 1d
|
30
30
|
match-email-to-persons-consumer-rc-l6cgr 1/1 Running 0 22h
|
31
31
|
match-event-to-persons-consumer-rc-w8jn1 1/1 Running 2 1d
|
@@ -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.18
|
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-05-12 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: []
|