sensu-plugins-dcos 0.0.4 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -5
- data/bin/check-dcos-node-health.rb +83 -0
- data/bin/metrics-dcos-system-health.rb +74 -0
- data/lib/sensu-plugins-dcos/version.rb +2 -2
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b213e148b62d64f323fe508f2e35d49b441fe634
|
4
|
+
data.tar.gz: eafb0f6945fd233bfddb28cd66c880ae6e8639c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8b9349af5c7e301204b25112873c10d5686fe6ec767a3909498f5a8631cad1db293be09d1f297f120068d1c82e4efc09117817275550a78ad40bf3f76c5e349
|
7
|
+
data.tar.gz: b474337a75395f9b8699d3af3b25d5d24d74e63f1fe2290d44dd404c2646fffc1b4b8accfb09f08503a92fca36caeab295ae11091ee22cee69c54b76a8f6d551
|
data/CHANGELOG.md
CHANGED
@@ -5,9 +5,14 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
-
## [0.0
|
8
|
+
## [0.1.0] - 2017-08-28
|
9
9
|
### Added
|
10
|
-
-
|
10
|
+
- New DC/OS node health check (@zemmet)
|
11
|
+
- New DC/OS system health metric collection script (@zemmet)
|
12
|
+
|
13
|
+
## [0.0.4] - 2017-08-12
|
14
|
+
### Added
|
15
|
+
- Rakefile now includes kitchen integration tests
|
11
16
|
- Fixes metric collection scripts to cover the cases when an app sets unit as an empty string (@luisdavim)
|
12
17
|
|
13
18
|
### [0.0.3] - 2017-08-12
|
@@ -23,14 +28,15 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
23
28
|
|
24
29
|
## [0.0.2] - 2017-08-03
|
25
30
|
### Added
|
26
|
-
- New DC/OS Component Health check
|
27
|
-
- Extending get_value function to provide the ability to override field names
|
31
|
+
- New DC/OS Component Health check (@zemmet)
|
32
|
+
- Extending get_value function to provide the ability to override field names (@zemmet)
|
28
33
|
|
29
34
|
## [0.0.1] - 2017-04-18
|
30
35
|
### Added
|
31
36
|
- Initial release
|
32
37
|
|
33
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-dcos/compare/0.0.
|
38
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-dcos/compare/0.0.4...HEAD
|
39
|
+
[0.1.0]: https://github.com/sensu-plugins/sensu-plugins-dcos/compare/0.0.4...0.1.0
|
34
40
|
[0.0.4]: https://github.com/sensu-plugins/sensu-plugins-dcos/compare/0.0.3...0.0.4
|
35
41
|
[0.0.3]: https://github.com/sensu-plugins/sensu-plugins-dcos/compare/0.0.2...0.0.3
|
36
42
|
[0.0.2]: https://github.com/sensu-plugins/sensu-plugins-dcos/compare/0.0.1...0.0.2
|
@@ -0,0 +1,83 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# check-dcos-node-health
|
4
|
+
#
|
5
|
+
# DESCRIPTION:
|
6
|
+
# This plugin checks the health of a DC/OS nodes exposed by the system/health/v1/nodes API endpoint
|
7
|
+
#
|
8
|
+
# OUTPUT:
|
9
|
+
# Plain text
|
10
|
+
#
|
11
|
+
# PLATFORMS:
|
12
|
+
# Linux
|
13
|
+
#
|
14
|
+
# DEPENDENCIES:
|
15
|
+
# gem: sensu-plugin
|
16
|
+
#
|
17
|
+
# USAGE:
|
18
|
+
# check-dcos-node-health.rb -u 'http://127.0.0.1:1050/system/health/v1/nodes' -r [master|agent]
|
19
|
+
#
|
20
|
+
# NOTES:
|
21
|
+
#
|
22
|
+
# LICENCE:
|
23
|
+
# PTC http://www.ptc.com/
|
24
|
+
# Copyright 2017 PTC Inc.
|
25
|
+
#
|
26
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
27
|
+
# you may not use this file except in compliance with the License.
|
28
|
+
# You may obtain a copy of the License at
|
29
|
+
#
|
30
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
31
|
+
#
|
32
|
+
# Unless required by applicable law or agreed to in writing, software
|
33
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
34
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
35
|
+
# See the License for the specific language governing permissions and
|
36
|
+
# limitations under the License.
|
37
|
+
|
38
|
+
require 'sensu-plugin/check/cli'
|
39
|
+
require 'json'
|
40
|
+
require 'net/http'
|
41
|
+
require 'uri'
|
42
|
+
require 'sensu-plugins-dcos'
|
43
|
+
|
44
|
+
#
|
45
|
+
# Check DCOS System Health API
|
46
|
+
#
|
47
|
+
|
48
|
+
class CheckDcosNodeHealth < Sensu::Plugin::Check::CLI
|
49
|
+
include Common
|
50
|
+
|
51
|
+
option :url,
|
52
|
+
description: 'URL',
|
53
|
+
short: '-u URL',
|
54
|
+
long: '--url URL',
|
55
|
+
default: 'http://127.0.0.1:1050/system/health/v1/nodes'
|
56
|
+
|
57
|
+
option :role,
|
58
|
+
description: 'DC/OS Role',
|
59
|
+
short: '-r ROLE',
|
60
|
+
long: '--role ROLE',
|
61
|
+
default: nil
|
62
|
+
|
63
|
+
def run
|
64
|
+
failed = 0
|
65
|
+
resource = get_data(config[:url])
|
66
|
+
if config[:role]
|
67
|
+
resource['nodes'].each do |node|
|
68
|
+
node['role'] == config[:role] && failed += node['health']
|
69
|
+
end
|
70
|
+
message "#{config[:role]}.nodes.unhealthy = #{failed}"
|
71
|
+
else
|
72
|
+
resource['nodes'].each do |node|
|
73
|
+
failed += node['health']
|
74
|
+
end
|
75
|
+
message "nodes.unhealthy = #{failed}"
|
76
|
+
end
|
77
|
+
if failed.zero?
|
78
|
+
ok
|
79
|
+
else
|
80
|
+
critical
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# metric-dcos-system-health
|
4
|
+
#
|
5
|
+
# DESCRIPTION:
|
6
|
+
# This plugin collects DC/OS system health status as metric exposed by the system/health/v1/[units|nodes] API endpoints
|
7
|
+
#
|
8
|
+
# OUTPUT:
|
9
|
+
# Metric data
|
10
|
+
#
|
11
|
+
# PLATFORMS:
|
12
|
+
# Linux
|
13
|
+
#
|
14
|
+
# DEPENDENCIES:
|
15
|
+
# gem: sensu-plugin
|
16
|
+
# gem: uri
|
17
|
+
# gem: net/http
|
18
|
+
# gem: socket
|
19
|
+
# gem: json
|
20
|
+
#
|
21
|
+
# USAGE:
|
22
|
+
# #YELLOW
|
23
|
+
#
|
24
|
+
# NOTES:
|
25
|
+
#
|
26
|
+
# LICENCE:
|
27
|
+
# PTC http://www.ptc.com/
|
28
|
+
# Copyright 2017 PTC Inc.
|
29
|
+
#
|
30
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
31
|
+
# you may not use this file except in compliance with the License.
|
32
|
+
# You may obtain a copy of the License at
|
33
|
+
#
|
34
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
35
|
+
#
|
36
|
+
# Unless required by applicable law or agreed to in writing, software
|
37
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
38
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
39
|
+
# See the License for the specific language governing permissions and
|
40
|
+
# limitations under the License.
|
41
|
+
|
42
|
+
require 'sensu-plugin/check/cli'
|
43
|
+
require 'json'
|
44
|
+
require 'net/http'
|
45
|
+
require 'uri'
|
46
|
+
require 'socket'
|
47
|
+
require 'sensu-plugins-dcos'
|
48
|
+
|
49
|
+
class DcosHealthMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
50
|
+
include Common
|
51
|
+
|
52
|
+
option :scheme,
|
53
|
+
description: 'Metric naming scheme',
|
54
|
+
short: '-s SCHEME',
|
55
|
+
long: '--scheme SCHEME',
|
56
|
+
default: "#{Socket.gethostname}.dcos.health"
|
57
|
+
|
58
|
+
option :url,
|
59
|
+
description: 'URL',
|
60
|
+
short: '-u URL',
|
61
|
+
long: '--url URL',
|
62
|
+
default: 'http://127.0.0.1:1050/system/health/v1'
|
63
|
+
|
64
|
+
def run
|
65
|
+
{ units: ['id'], nodes: %w[role host_ip] }.each do |endpoint, attributes|
|
66
|
+
url = "#{config['url']}/#{endpoint}"
|
67
|
+
resource = get_data(url)
|
68
|
+
resource[endpoint].each do |item|
|
69
|
+
path = attributes.map { |attr| item[attr].tr('.', '-') }.join('.')
|
70
|
+
output([config[:scheme], endpoint, path].join('.'), item['health'])
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-dcos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PTC and contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -274,10 +274,12 @@ description: |-
|
|
274
274
|
email: "<sensu-users@googlegroups.com>"
|
275
275
|
executables:
|
276
276
|
- check-dcos-metrics.rb
|
277
|
+
- check-dcos-node-health.rb
|
277
278
|
- metrics-dcos-host.rb
|
278
279
|
- check-dcos-container-count.rb
|
279
280
|
- check-dcos-container-metrics.rb
|
280
281
|
- check-dcos-component-health.rb
|
282
|
+
- metrics-dcos-system-health.rb
|
281
283
|
- check-dcos-ping.rb
|
282
284
|
- metrics-dcos-containers.rb
|
283
285
|
extensions: []
|
@@ -290,9 +292,11 @@ files:
|
|
290
292
|
- bin/check-dcos-container-count.rb
|
291
293
|
- bin/check-dcos-container-metrics.rb
|
292
294
|
- bin/check-dcos-metrics.rb
|
295
|
+
- bin/check-dcos-node-health.rb
|
293
296
|
- bin/check-dcos-ping.rb
|
294
297
|
- bin/metrics-dcos-containers.rb
|
295
298
|
- bin/metrics-dcos-host.rb
|
299
|
+
- bin/metrics-dcos-system-health.rb
|
296
300
|
- lib/sensu-plugins-dcos.rb
|
297
301
|
- lib/sensu-plugins-dcos/common.rb
|
298
302
|
- lib/sensu-plugins-dcos/version.rb
|