sensu-plugins-mesos 2.3.0 → 2.4.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 +6 -1
- data/README.md +98 -0
- data/bin/check-marathon-apps.rb +7 -7
- data/lib/sensu-plugins-mesos/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66f974c1746c5c76ec41774dfa2d2c883be9ec69833343ca8d059dbe1ed81fb7
|
4
|
+
data.tar.gz: 21d72c1e2cdd1b959b99cfb1e86638d8d6511b690b9b726b9ac166724198c206
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3f7a279c708dd1601b34b0b40b08da212b8c3f28de668b27756328889d1246ac0ad622b083549bf8eb587ec2c1ce81982a40e315b4b82f2849d01c2f8f5d90c
|
7
|
+
data.tar.gz: 2fb9fe06014643337d6b4af8daea52e3596df0cea134b1aeafad721f8a5041f62732a1d3e4107591cd5dcb68e079a79b834fec9d9eb594fa1cea74b5838c8096
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [2.4.0] - 2018-03-20
|
9
|
+
### Changed
|
10
|
+
- check-marathon-apps.rb: minor fixes and documentation update for this check (@bergerx)
|
11
|
+
|
8
12
|
## [2.3.0] - 2018-03-17
|
9
13
|
### Added
|
10
14
|
- testing skeleton for `test-kitchen`, `kitchen-docker`, and `serverspec` (@majormoses)
|
@@ -94,7 +98,8 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
94
98
|
### Added
|
95
99
|
- initial release
|
96
100
|
|
97
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mesos/compare/2.
|
101
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-mesos/compare/2.4.0...HEAD
|
102
|
+
[2.4.0]: https://github.com/sensu-plugins/sensu-plugins-mesos/compare/2.3.0...2.4.0
|
98
103
|
[2.3.0]: https://github.com/sensu-plugins/sensu-plugins-mesos/compare/2.2.2...2.3.0
|
99
104
|
[2.2.2]: https://github.com/sensu-plugins/sensu-plugins-mesos/compare/2.1.2...2.2.2
|
100
105
|
[2.1.2]: https://github.com/sensu-plugins/sensu-plugins-mesos/compare/2.1.1...2.1.2
|
data/README.md
CHANGED
@@ -23,6 +23,104 @@
|
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
+
### bin/check-marathon-apps.rb
|
27
|
+
|
28
|
+
Note: This check is an unconventional one. It won't output a check result as many
|
29
|
+
other conventional check scripts, and will publish multiple check results via
|
30
|
+
the local sensu agent endpoint, effectively breaks the expectation of 1:1
|
31
|
+
mapping between check-definition and check-results.
|
32
|
+
|
33
|
+
This plugin checks Marathon apps based on
|
34
|
+
https://mesosphere.github.io/marathon/docs/marathon-ui.html#application-status-reference .
|
35
|
+
It produces two check results per application. One for the apps `health` and
|
36
|
+
another check result for the apps `status`.
|
37
|
+
|
38
|
+
Check results can be customised by two ways:
|
39
|
+
|
40
|
+
1. Default check result fields thats applied to all will be provided by a
|
41
|
+
default check config. Please see th esource code to see the whole defaults.
|
42
|
+
2. Application owners can override check results by using marathon labels. This
|
43
|
+
allows each application to have different fields in the published result.
|
44
|
+
e.g. per app escalation or aggregate can be controlled by applying Marathon
|
45
|
+
labels to the apps.
|
46
|
+
|
47
|
+
```
|
48
|
+
SENSU_MARATHON_CONTACT = team_a_rotation
|
49
|
+
SENSU_MARATHON_AGGREGATE = this_apps_aggregate # will be applied to both `status` and `health` check results
|
50
|
+
SENSU_MARATHON_STATUS_AGGREGATE = status_aggregate # status result of the app have different aggregate
|
51
|
+
SENSU_MARATHON_HEALTH_AGGREGATE = health_aggregate # health result of the app have different aggregate
|
52
|
+
SENSU_MARATHON_STATUS_UNSCHEDULED_STATUS = 0 # Disable the check's fail status for this app when it's in unscheduled state.
|
53
|
+
```
|
54
|
+
|
55
|
+
The override templates that could be used in marathon app labels are:
|
56
|
+
|
57
|
+
```
|
58
|
+
SENSU_MARATHON_<check_result_field> # will be applied all below if not overridden
|
59
|
+
SENSU_MARATHON_STATUS_<check_result_field> # will be applied all status states if not overridden
|
60
|
+
SENSU_MARATHON_STATUS_<status_state>_<check_result_field>
|
61
|
+
SENSU_MARATHON_HEALTH_<check_result_field> # will be applied all healt states if not overridden
|
62
|
+
SENSU_MARATHON_RESULT_<result_state>_<check_result_field>
|
63
|
+
```
|
64
|
+
|
65
|
+
Where:
|
66
|
+
* `check_result_field` could be any field in json.
|
67
|
+
* `status_state` is one of "waiting", "delayed", "suspended", "deploying" or "running".
|
68
|
+
* `health_state` is one of "unscheduled", "overcapacity", "staged", "unknown", "unhealthy" or "healthy".
|
69
|
+
|
70
|
+
Example run:
|
71
|
+
|
72
|
+
```
|
73
|
+
$ check-marathon-task.rb
|
74
|
+
heckMarathonApps OK: Marathon Apps Status and Health check is running properly
|
75
|
+
```
|
76
|
+
|
77
|
+
The command output of the check script will always be same independently from
|
78
|
+
which apps are being checked, but you'll see 2 check-results per app like these
|
79
|
+
in sensu:
|
80
|
+
|
81
|
+
```
|
82
|
+
{
|
83
|
+
"name": "check_marathon_app_test_status",
|
84
|
+
"executed": 1519305736,
|
85
|
+
"marathon": {
|
86
|
+
"id": "/test",
|
87
|
+
"version": "2018-02-20T15:09:43.086Z",
|
88
|
+
"versionInfo": {
|
89
|
+
"lastScalingAt": "2018-02-20T15:09:43.086Z",
|
90
|
+
"lastConfigChangeAt": "2018-02-20T15:09:43.086Z"
|
91
|
+
},
|
92
|
+
"tasksStaged": 0,
|
93
|
+
"tasksRunning": 1,
|
94
|
+
"tasksHealthy": 1,
|
95
|
+
"tasksUnhealthy": 0
|
96
|
+
},
|
97
|
+
"output": "STATUS Unscheduled - tasksRunning(1), tasksStaged(0), tasksHealthy(1), tasksUnhealthy(0)",
|
98
|
+
"ttl": 10,
|
99
|
+
"source": "marathon",
|
100
|
+
"status": 2
|
101
|
+
}
|
102
|
+
{
|
103
|
+
"name": "check_marathon_app_test_health",
|
104
|
+
"executed": 1519305736,
|
105
|
+
"marathon": {
|
106
|
+
"id": "/test",
|
107
|
+
"version": "2018-02-20T15:09:43.086Z",
|
108
|
+
"versionInfo": {
|
109
|
+
"lastScalingAt": "2018-02-20T15:09:43.086Z",
|
110
|
+
"lastConfigChangeAt": "2018-02-20T15:09:43.086Z"
|
111
|
+
},
|
112
|
+
"tasksStaged": 0,
|
113
|
+
"tasksRunning": 1,
|
114
|
+
"tasksHealthy": 1,
|
115
|
+
"tasksUnhealthy": 0
|
116
|
+
},
|
117
|
+
"output": "HEALTH Healthy - tasksRunning(1), tasksStaged(0), tasksHealthy(1), tasksUnhealthy(0)",
|
118
|
+
"ttl": 10,
|
119
|
+
"source": "marathon",
|
120
|
+
"status": 0
|
121
|
+
}
|
122
|
+
```
|
123
|
+
|
26
124
|
## Installation
|
27
125
|
|
28
126
|
[Installation and Setup](http://sensu-plugins.io/docs/installation_instructions.html)
|
data/bin/check-marathon-apps.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# check-marathon-apps
|
4
4
|
#
|
5
5
|
# DESCRIPTION:
|
6
|
-
# This
|
6
|
+
# This check script creates checks results for each Marathon app that is running,
|
7
7
|
# and reports the status of the app based on Marathon Application Status Reference.
|
8
8
|
# https://mesosphere.github.io/marathon/docs/marathon-ui.html#application-status-reference
|
9
9
|
#
|
@@ -173,7 +173,7 @@ class MarathonAppsCheck < Sensu::Plugin::Check::CLI
|
|
173
173
|
'`--default-check-config` will override this one.'
|
174
174
|
|
175
175
|
option :sensu_client_url,
|
176
|
-
description: 'Sensu client HTTP URL
|
176
|
+
description: 'Sensu client HTTP URL',
|
177
177
|
long: '--sensu-client-url url',
|
178
178
|
default: 'http://localhost:3031'
|
179
179
|
|
@@ -246,7 +246,7 @@ class MarathonAppsCheck < Sensu::Plugin::Check::CLI
|
|
246
246
|
"tasksHealthy(#{app['tasksHealthy'].to_i}), tasksUnhealthy(#{app['tasksUnhealthy'].to_i})"
|
247
247
|
|
248
248
|
# Make sure that check result data types are correct
|
249
|
-
|
249
|
+
enforce_sensu_field_types(check_result)
|
250
250
|
|
251
251
|
# Send the result to sensu-client HTTP socket
|
252
252
|
post_check_result(check_result)
|
@@ -267,7 +267,7 @@ class MarathonAppsCheck < Sensu::Plugin::Check::CLI
|
|
267
267
|
}
|
268
268
|
end
|
269
269
|
|
270
|
-
def
|
270
|
+
def enforce_sensu_field_types(check_result)
|
271
271
|
# Force data types of different fields on the check result
|
272
272
|
# https://sensuapp.org/docs/latest/reference/checks.html#example-check-definition
|
273
273
|
# https://sensuapp.org/docs/latest/reference/checks.html#check-result-specification
|
@@ -285,7 +285,7 @@ class MarathonAppsCheck < Sensu::Plugin::Check::CLI
|
|
285
285
|
end
|
286
286
|
end
|
287
287
|
|
288
|
-
def
|
288
|
+
def rest_client(path)
|
289
289
|
RestClient.get("#{config[:url]}#{path}",
|
290
290
|
user: config[:username],
|
291
291
|
password: config[:password],
|
@@ -298,12 +298,12 @@ class MarathonAppsCheck < Sensu::Plugin::Check::CLI
|
|
298
298
|
def fetch_apps
|
299
299
|
# http://mesosphere.github.io/marathon/api-console/index.html
|
300
300
|
resources_query = APPS_EMBED_RESOURCES.map { |resource| "embed=#{resource}" }.join('&')
|
301
|
-
parse_json(
|
301
|
+
parse_json(rest_client("/v2/apps?#{resources_query}"))['apps']
|
302
302
|
end
|
303
303
|
|
304
304
|
def fetch_queue
|
305
305
|
# http://mesosphere.github.io/marathon/api-console/index.html
|
306
|
-
parse_json(
|
306
|
+
parse_json(rest_client('/v2/queue'))['queue']
|
307
307
|
end
|
308
308
|
|
309
309
|
def post_check_result(data)
|
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: 2.
|
4
|
+
version: 2.4.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: 2018-03-
|
11
|
+
date: 2018-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|