sensu-plugins-dcos 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +6 -1
- data/bin/metrics-dcos-containers.rb +54 -10
- data/lib/sensu-plugins-dcos/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dfa5914cbbb7627eafcd35db775a0a83b38313548bfc97026e14e9417e8c57e8
|
4
|
+
data.tar.gz: f3d0711e149dc6253f9444496a9c1f63dd4756ddc8fe97dc0e169cfd5be2002a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a88a6c284fa0eb7c5ec7ed682af8668bf4d3e6e7d400cb69841a764667298dc699ec5b03fa4b03991b1254ceea4b378fa81ad30aaf4db90f6f0c0885a3429b5e
|
7
|
+
data.tar.gz: b894dfdb90803710a43a19ad0d674c264f41129452b9b17f3fce81f50f4da4a763401adcf55f2c9e41a48733f3194aee709467ba78d8bc533778024ea83d4085
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,10 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [0.4.1] - 2018-01-15
|
10
|
+
### Fixed
|
11
|
+
- fixed the handling of empty container metrics issue from dcos-metrics
|
12
|
+
|
9
13
|
## [0.4.0] - 2017-10-20
|
10
14
|
### Added
|
11
15
|
- todo item is added: metrics-dcos-containers.rb Add dimentions to the metric name framework_name, framework_role, executor_id (@1fox1)
|
@@ -65,7 +69,8 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
|
|
65
69
|
### Added
|
66
70
|
- Initial release
|
67
71
|
|
68
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-dcos/compare/0.4.
|
72
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-dcos/compare/0.4.1...HEAD
|
73
|
+
[0.4.1]: https://github.com/sensu-plugins/sensu-plugins-dcos/compare/0.4.0...0.4.1
|
69
74
|
[0.4.0]: https://github.com/sensu-plugins/sensu-plugins-dcos/compare/0.3.0...0.4.0
|
70
75
|
[0.3.0]: https://github.com/sensu-plugins/sensu-plugins-dcos/compare/0.2.1...0.3.0
|
71
76
|
[0.2.1]: https://github.com/sensu-plugins/sensu-plugins-dcos/compare/0.1.1...0.2.1
|
@@ -69,6 +69,18 @@ class DCOSMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
69
69
|
required: false,
|
70
70
|
default: '61001'
|
71
71
|
|
72
|
+
option :agent_ip_discovery_command,
|
73
|
+
description: 'DCOS agent ip discovery command',
|
74
|
+
long: '--agent-ip-discovery-command COMMAND',
|
75
|
+
required: false,
|
76
|
+
default: '/opt/mesosphere/bin/detect_ip'
|
77
|
+
|
78
|
+
option :agent_port,
|
79
|
+
description: 'DCOS agent port',
|
80
|
+
long: '--agent-port PORT',
|
81
|
+
required: false,
|
82
|
+
default: '5051'
|
83
|
+
|
72
84
|
option :uri,
|
73
85
|
description: 'Endpoint URI',
|
74
86
|
short: '-u URI',
|
@@ -81,19 +93,47 @@ class DCOSMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
81
93
|
long: '--dimensions DIMENSIONS',
|
82
94
|
required: false
|
83
95
|
|
96
|
+
def mesos_frameworks
|
97
|
+
# Return the memoized result if exists. This will ensure that the mesos
|
98
|
+
# state endpoint will be called only once and when needed and return the
|
99
|
+
# cached result immediately for subsequent calls.
|
100
|
+
return @mesos_frameworks if @mesos_frameworks
|
101
|
+
agent_ip = `#{config[:agent_ip_discovery_command]}`
|
102
|
+
state = get_data("http://#{agent_ip}:#{config[:agent_port]}/state")
|
103
|
+
@mesos_frameworks = {}
|
104
|
+
%w[frameworks completed_frameworks].each do |fw_key|
|
105
|
+
state[fw_key].each do |framework|
|
106
|
+
@mesos_frameworks[framework['id']] = framework['name']
|
107
|
+
end
|
108
|
+
end
|
109
|
+
@mesos_frameworks
|
110
|
+
end
|
111
|
+
|
112
|
+
def get_extra_tags(dimensions)
|
113
|
+
extra_tags = []
|
114
|
+
return extra_tags unless config[:dimensions]
|
115
|
+
config[:dimensions].tr(' ', '').split(',').each do |d|
|
116
|
+
# Special case for app metrics, framework_name dimension does not exist
|
117
|
+
# in app metrics and in some cases app metrics/dimensions are not
|
118
|
+
# available, see https://jira.mesosphere.com/browse/DCOS_OSS-2043 for
|
119
|
+
# upstream issue.
|
120
|
+
if d == 'framework_name' && !dimensions.key?('framework_name')
|
121
|
+
extra_tags.push(mesos_frameworks[dimensions['framework_id']])
|
122
|
+
else
|
123
|
+
extra_tags.push(dimensions[d])
|
124
|
+
end
|
125
|
+
end
|
126
|
+
extra_tags
|
127
|
+
end
|
128
|
+
|
84
129
|
def run
|
85
130
|
containers = get_data("http://#{config[:server]}:#{config[:port]}#{config[:uri]}")
|
86
131
|
unless containers.nil? || containers.empty?
|
87
|
-
containers.each do |container|
|
88
|
-
|
89
|
-
if
|
90
|
-
extra_tags = []
|
91
|
-
|
92
|
-
extra_tags.push(all_metrics['dimensions'][d]) if all_metrics['dimensions'][d]
|
93
|
-
end
|
94
|
-
end
|
95
|
-
if all_metrics.key?('datapoints')
|
96
|
-
all_metrics['datapoints'].each do |metric|
|
132
|
+
containers.each do |container|
|
133
|
+
container_metrics = get_data("http://#{config[:server]}:#{config[:port]}#{config[:uri]}/#{container}")
|
134
|
+
if container_metrics.key?('datapoints')
|
135
|
+
extra_tags = get_extra_tags(container_metrics['dimensions'])
|
136
|
+
container_metrics['datapoints'].each do |metric|
|
97
137
|
metric['name'].tr!('/', '.')
|
98
138
|
metric['name'].squeeze!('.')
|
99
139
|
output([config[:scheme], extra_tags, container, metric['unit'], metric['name']].compact.join('.'), metric['value'])
|
@@ -101,6 +141,10 @@ class DCOSMetrics < Sensu::Plugin::Metric::CLI::Graphite
|
|
101
141
|
end
|
102
142
|
app_metrics = get_data("http://#{config[:server]}:#{config[:port]}#{config[:uri]}/#{container}/app")
|
103
143
|
next if app_metrics['datapoints'].nil?
|
144
|
+
app_dimensions = app_metrics['dimensions']
|
145
|
+
# merge container dimensions into app dimensions since app dimensions does have less
|
146
|
+
app_dimensions = container_metrics['dimensions'].merge(app_dimensions) if container_metrics.key?('dimensions')
|
147
|
+
extra_tags = get_extra_tags(app_dimensions)
|
104
148
|
app_metrics['datapoints'].each do |metric|
|
105
149
|
unless metric['tags'].nil?
|
106
150
|
metric['tags'].each do |k, v|
|
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.4.
|
4
|
+
version: 0.4.1
|
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:
|
11
|
+
date: 2018-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -274,15 +274,15 @@ description: |-
|
|
274
274
|
email: "<sensu-users@googlegroups.com>"
|
275
275
|
executables:
|
276
276
|
- check-dcos-metrics.rb
|
277
|
-
-
|
278
|
-
- metrics-dcos-host.rb
|
277
|
+
- metrics-dcos-containers.rb
|
279
278
|
- check-dcos-container-count.rb
|
280
|
-
- check-dcos-
|
279
|
+
- check-dcos-node-health.rb
|
281
280
|
- check-dcos-component-health.rb
|
282
|
-
- check-dcos-jobs-health.rb
|
283
281
|
- metrics-dcos-system-health.rb
|
282
|
+
- metrics-dcos-host.rb
|
284
283
|
- check-dcos-ping.rb
|
285
|
-
-
|
284
|
+
- check-dcos-container-metrics.rb
|
285
|
+
- check-dcos-jobs-health.rb
|
286
286
|
extensions: []
|
287
287
|
extra_rdoc_files: []
|
288
288
|
files:
|
@@ -328,7 +328,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
328
328
|
version: '0'
|
329
329
|
requirements: []
|
330
330
|
rubyforge_project:
|
331
|
-
rubygems_version: 2.
|
331
|
+
rubygems_version: 2.7.4
|
332
332
|
signing_key:
|
333
333
|
specification_version: 4
|
334
334
|
summary: Sensu plugins for dcos-metrics checks and metrics
|