sumo-check-sumo 0.0.6 → 0.0.7
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/sumo-check-docker.rb +50 -0
- metadata +17 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 151b570f5d23a434f7f312e2c9ff43ff783f9c23
|
4
|
+
data.tar.gz: dedbf659939a189d25392a06ab1bba7d4ff525d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6aff654581bd1d8bbc54f275187f36553df97f02156c0f9e7aef66e4807524893667154ae37e952a1216bef4c2bce3354adac096821e2d45e43d739f81c923d2
|
7
|
+
data.tar.gz: 3e56280518639e4f749bb84b8ae9a30b789f48b06ea5947423d0fa9a69baf8c3b1ca05881c16ff26ffedf14e7680456beca354b2729c720d3954ecdbe5bb908c
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'sensu-plugin/check/cli'
|
3
|
+
require 'docker-api'
|
4
|
+
|
5
|
+
class SensuSumoCheckDocker < Sensu::Plugin::Check::CLI
|
6
|
+
|
7
|
+
option :max_restarts,
|
8
|
+
:short => "-r 10",
|
9
|
+
:long => "--restarts 10",
|
10
|
+
:default => '10',
|
11
|
+
:description => "Max Restarts to allow before alerting"
|
12
|
+
|
13
|
+
option :docker_socket,
|
14
|
+
:short => "-s unix:///var/run/docker.sock",
|
15
|
+
:long => "--socket unix:///var/run/docker.sock",
|
16
|
+
:default => 'unix:///var/run/docker.sock',
|
17
|
+
:description => "Docker Socket to connect to"
|
18
|
+
|
19
|
+
def run
|
20
|
+
ENV['DOCKER_URL']=config[:docker_socket]
|
21
|
+
containers_with_issues=[]
|
22
|
+
Docker::Container.all.each do |i|
|
23
|
+
container = Docker::Container.get(i.id)
|
24
|
+
container_details=[]
|
25
|
+
|
26
|
+
if container.info["State"]["ExitCode"] != 0
|
27
|
+
container_details.push("ExitCode: #{container.info["State"]["ExitCode"]}")
|
28
|
+
end
|
29
|
+
if container.info["RestartCount"] > config[:max_restarts].to_i
|
30
|
+
container_details.push("Restart Count: #{container.info["RestartCount"]}")
|
31
|
+
end
|
32
|
+
if container.info["State"]["Dead"] == true
|
33
|
+
container_details.push("Dead Container: #{container.info["State"]["Dead"]}")
|
34
|
+
end
|
35
|
+
if container_details.length > 0
|
36
|
+
containers_with_issues.push "#{container.info["Config"]["Labels"]["com.amazonaws.ecs.cluster"]}:#{container.info["Config"]["Labels"]["com.amazonaws.ecs.task-definition-family"]}:v#{container.info["Config"]["Labels"]["com.amazonaws.ecs.task-definition-version"]}:#{container_details.join(', ')}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
if containers_with_issues.length > 0
|
41
|
+
# problems
|
42
|
+
puts "ERROR #{Docker.info["Name"]}, Containers Running: #{Docker.info["ContainersRunning"]}, Containers Stopped: #{Docker.info["ContainersStopped"]}, Containers Paused: #{Docker.info["ContainersPaused"]}, ERRORS: \n#{containers_with_issues.join("; \n")}"
|
43
|
+
else
|
44
|
+
# All ok
|
45
|
+
puts "OK #{Docker.info["Name"]}, Containers Running: #{Docker.info["ContainersRunning"]}, Containers Stopped: #{Docker.info["ContainersStopped"]}, Containers Paused: #{Docker.info["ContainersPaused"]}"
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sumo-check-sumo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dr. Ogg
|
@@ -66,15 +66,31 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 6.10.3
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: docker-api
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.34.2
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.34.2
|
69
83
|
description:
|
70
84
|
email:
|
71
85
|
executables:
|
72
86
|
- sumo-check-sumo_basic_contact_us_form.rb
|
73
87
|
- sumo-check-sumo_main_site_login_logout.rb
|
74
88
|
- sumo-check-new-relic-apdex.rb
|
89
|
+
- sumo-check-docker.rb
|
75
90
|
extensions: []
|
76
91
|
extra_rdoc_files: []
|
77
92
|
files:
|
93
|
+
- bin/sumo-check-docker.rb
|
78
94
|
- bin/sumo-check-new-relic-apdex.rb
|
79
95
|
- bin/sumo-check-sumo_basic_contact_us_form.rb
|
80
96
|
- bin/sumo-check-sumo_main_site_login_logout.rb
|