sensu-plugins-mesos 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21411bface3e1d88fc6c4041e0b5dac80044a364
4
- data.tar.gz: 806ab66415a37de8c8e724078d74ca66696607ca
3
+ metadata.gz: d9a60518371445db07e174b8ff10c0c725ed8b2d
4
+ data.tar.gz: 6a28f31a75653fb66b6be2c2c024dfe930128a17
5
5
  SHA512:
6
- metadata.gz: c5a02b94924115f6fed7d4fc57d4cd960624c0caf674b834375cf1733ba1275105c6cb9af26c6893eac04e95a5ca8cde46516fa0ebc390fd17e7118132653fd9
7
- data.tar.gz: fab71f56c0672988d61d098e40e61ae47ebcdeca229e61588f02877630b57d72643cefe493e5298f7e46d22d7cc171d0aa4de54a6ab28257dfa9dbac305096eb
6
+ metadata.gz: 22f78de809bc7fbd96fe0894eb13507d605e61f0f96abe26fabd606fe6524baa25614e1446d258a7fb0195c3dfefaaa0e8ce95d2ce015edfd36ad79915492573
7
+ data.tar.gz: f514750c677704952d80ed2aec1e4f95af54f45ab1bc4bc6850afb311f25e07ad54217fa66057a86356a78d23cf0b788e74e1dd813ecc782a1b6f8c42f6f7187
data/CHANGELOG.md CHANGED
@@ -1,9 +1,14 @@
1
- #Change Log
1
+ # Change Log
2
2
  This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
6
  ## [Unreleased]
7
+
8
+ ### [1.1.0] - 2017-07-10
9
+ ### Added
10
+ - metrics-mesos.rb: Added option "include_role" to inject in metric fields whether a master node is leader or standby
11
+
7
12
  ## [1.0.0] - 2017-05-05
8
13
  ### Breaking Change
9
14
  - check-mesos.rb: removed the `mode` parameter (@luisdavim)
@@ -61,7 +66,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
61
66
  ### Added
62
67
  - initial release
63
68
 
64
- [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mesos/compare/1.0.0...HEAD
69
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mesos/compare/1.1.0...HEAD
70
+ [1.1.0]: https://github.com/sensu-plugins/sensu-plugins-mesos/compare/1.0.0...1.1.0
65
71
  [1.0.0]: https://github.com/sensu-plugins/sensu-plugins-mesos/compare/0.1.1...1.0.0
66
72
  [0.1.1]: https://github.com/sensu-plugins/sensu-plugins-mesos/compare/0.1.0...0.1.1
67
73
  [0.1.0]: https://github.com/sensu-plugins/sensu-plugins-mesos/compare/0.0.4...0.1.0
data/bin/metrics-mesos.rb CHANGED
@@ -75,6 +75,12 @@ class MesosMetrics < Sensu::Plugin::Metric::CLI::Graphite
75
75
  proc: proc(&:to_i),
76
76
  default: 5
77
77
 
78
+ option :include_role,
79
+ description: 'Include master role in metrics',
80
+ short: '-r INCLUDE_ROLE',
81
+ long: '--host INCLUDE_ROLE',
82
+ default: 'false'
83
+
78
84
  def run
79
85
  uri = config[:uri]
80
86
  case config[:mode]
@@ -86,9 +92,19 @@ class MesosMetrics < Sensu::Plugin::Metric::CLI::Graphite
86
92
  scheme = "#{config[:scheme]}.mesos-#{config[:mode]}"
87
93
  begin
88
94
  r = RestClient::Resource.new("http://#{config[:server]}:#{port}#{uri}", timeout: config[:timeout]).get
89
- JSON.parse(r).each do |k, v|
95
+ results = JSON.parse(r)
96
+ if config[:include_role] == 'true' && config[:mode] == 'master'
97
+ add_metric = if results['master/elected'] != 0.0
98
+ 'leader.'
99
+ else
100
+ 'standby.'
101
+ end
102
+ else
103
+ add_metric = ''
104
+ end
105
+ results.each do |k, v|
90
106
  k_copy = k.tr('/', '.')
91
- output([scheme, k_copy].join('.'), v)
107
+ output([scheme, add_metric + k_copy].join('.'), v)
92
108
  end
93
109
  rescue Errno::ECONNREFUSED
94
110
  critical "Mesos #{config[:mode]} is not responding"
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsMesos
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 0
4
+ MINOR = 1
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-mesos
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-05 00:00:00.000000000 Z
11
+ date: 2017-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client