sensu-plugins-graylog 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 +4 -4
- data/CHANGELOG.md +8 -1
- data/README.md +4 -2
- data/bin/check-graylog-streams.rb +91 -0
- data/lib/sensu-plugins-graylog/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9305d0144c683c909d1891e7edd558e1a8685bbf
|
|
4
|
+
data.tar.gz: 6cfca28d71fbccd4e83ac8580afeeb6aabec35b9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 39ef211ff1d170d227a78245a330e48d73bbc51fc20fd8de865a0d0c27e6b259cacff74e49c0128c957633298d90a7c8d2983c9177c8c34e76de37578a699449
|
|
7
|
+
data.tar.gz: 24852c0f9c0767040ede3775cd3fc2fb8863179e97b6d29fe8f75aee4cfb92e00110280474f5cc05f1ac9f43f73ae237544f740ca7321ea47445b49361edc758
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [1.1.0] - 2017-04-25
|
|
9
|
+
### Changed
|
|
10
|
+
- update readme to fix script names (@nathanhruby)
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- add check-graylog-streams.rb to check and alert on paused streams (@nathanhruby)
|
|
8
14
|
|
|
9
15
|
## [1.0.0] - 2017-03-15
|
|
10
16
|
This release drops support for Ruby 1.9.3 and converts `check-graylog-buffers` and `metrics-graylog`
|
|
@@ -44,7 +50,8 @@ in your environment is encouraged.
|
|
|
44
50
|
### Added
|
|
45
51
|
- initial release
|
|
46
52
|
|
|
47
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-graylog/compare/1.
|
|
53
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-graylog/compare/1.1.0...HEAD
|
|
54
|
+
[1.1.0]: https://github.com/sensu-plugins/sensu-plugins-graylog/compare/1.0.0...1.1.0
|
|
48
55
|
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-graylog/compare/0.1.0...1.0.0
|
|
49
56
|
[0.1.0]: https://github.com/sensu-plugins/sensu-plugins-graylog/compare/0.0.2...0.1.0
|
|
50
57
|
[0.0.2]: https://github.com/sensu-plugins/sensu-plugins-graylog/compare/0.0.1...0.0.2
|
data/README.md
CHANGED
|
@@ -10,9 +10,10 @@
|
|
|
10
10
|
This plugin provides availability monitoring and metrics collection for the [Graylog](https://www.graylog.org/) log management system.
|
|
11
11
|
|
|
12
12
|
## Files
|
|
13
|
+
* bin/check-graylog-buffers.rb
|
|
14
|
+
* bin/check-graylog-streams.rb
|
|
13
15
|
* bin/check-graylog2-alive.rb
|
|
14
|
-
* bin/
|
|
15
|
-
* bin/metrics-graylog.py
|
|
16
|
+
* bin/metrics-graylog.rb
|
|
16
17
|
|
|
17
18
|
## Usage
|
|
18
19
|
|
|
@@ -22,5 +23,6 @@ This plugin provides availability monitoring and metrics collection for the [Gra
|
|
|
22
23
|
|
|
23
24
|
## Notes
|
|
24
25
|
- If you want a limited access user for monitoring purposes please see the [Graylog FAQ](http://docs.graylog.org/en/latest/pages/faq.html#how-can-i-create-a-restricted-user-to-check-internal-graylog-metrics-in-my-monitoring-system+)
|
|
26
|
+
- A limited user must also have the "streams:read" permission on their role in order to use the check-graylog-streams.rb check
|
|
25
27
|
- Users may further obfuscate their credentials by creating an [Access Token](http://docs.graylog.org/en/latest/pages/configuration/rest_api.html?highlight=access%20tokens#creating-and-using-access-token) to use instead of their normal login credentials.
|
|
26
28
|
- Note that only an admin may create a token by default. If you want to have a dedicated monitoring user with an access token you will need to create them as a Admin user, create the token, then change the user to the monitoring specific role. You can change the default behavior by granting `users:tokencreate`, `users:tokenlist`, and `users:tokenremove` to a role and adding that role to the monitoring user.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#
|
|
3
|
+
# Checks Graylog paused streams
|
|
4
|
+
# ===
|
|
5
|
+
#
|
|
6
|
+
# DESCRIPTION:
|
|
7
|
+
# This plugin checks Graylog for any 'paused' streams.
|
|
8
|
+
#
|
|
9
|
+
# OUTPUT:
|
|
10
|
+
# plain-text
|
|
11
|
+
#
|
|
12
|
+
# PLATFORMS:
|
|
13
|
+
# all
|
|
14
|
+
#
|
|
15
|
+
# DEPENDENCIES:
|
|
16
|
+
# A graylog user with streams:read permission (admin or role perm)
|
|
17
|
+
#
|
|
18
|
+
# LICENSE:
|
|
19
|
+
# Seandy Wibowo <swibowo@sugarcrm.com>
|
|
20
|
+
# nathan hruby <nhruby@sugarcrm.com>
|
|
21
|
+
# Released under the same terms as Sensu (the MIT license); see LICENSE
|
|
22
|
+
# for details.
|
|
23
|
+
|
|
24
|
+
require 'sensu-plugin/check/cli'
|
|
25
|
+
require 'rest-client'
|
|
26
|
+
require 'json'
|
|
27
|
+
|
|
28
|
+
class CheckGraylogStreams < Sensu::Plugin::Check::CLI
|
|
29
|
+
option :username,
|
|
30
|
+
short: '-u',
|
|
31
|
+
long: '--username USERNAME',
|
|
32
|
+
description: 'Graylog Username',
|
|
33
|
+
required: true
|
|
34
|
+
|
|
35
|
+
option :password,
|
|
36
|
+
short: '-p',
|
|
37
|
+
long: '--password PASSWORD',
|
|
38
|
+
description: 'Graylog Password',
|
|
39
|
+
required: true
|
|
40
|
+
|
|
41
|
+
option :host,
|
|
42
|
+
short: '-h',
|
|
43
|
+
long: '--host GRAYLOG_HOST',
|
|
44
|
+
description: 'Graylog host to query',
|
|
45
|
+
default: 'localhost'
|
|
46
|
+
|
|
47
|
+
option :port,
|
|
48
|
+
short: '-P',
|
|
49
|
+
long: '--port GRAYLOG_PORT',
|
|
50
|
+
description: 'Graylog port to query',
|
|
51
|
+
default: 12_900
|
|
52
|
+
|
|
53
|
+
option :apipath,
|
|
54
|
+
short: '-a',
|
|
55
|
+
long: '--apipath /api',
|
|
56
|
+
description: 'Graylog API path prefix',
|
|
57
|
+
default: ''
|
|
58
|
+
|
|
59
|
+
def graylog_streams
|
|
60
|
+
resource = RestClient::Resource.new(
|
|
61
|
+
"http://#{config[:host]}:#{config[:port]}#{config[:apipath]}/streams",
|
|
62
|
+
user: config[:username],
|
|
63
|
+
password: config[:password],
|
|
64
|
+
timeout: 10
|
|
65
|
+
)
|
|
66
|
+
JSON.parse(resource.get, symbolize_names: true)
|
|
67
|
+
|
|
68
|
+
rescue RestClient::RequestTimeout
|
|
69
|
+
unknown 'Connection timeout'
|
|
70
|
+
rescue SocketError
|
|
71
|
+
unknown 'Network unavailable'
|
|
72
|
+
rescue RestClient::Unauthorized
|
|
73
|
+
unknown 'Missing or incorrect API credentials'
|
|
74
|
+
rescue JSON::ParserError
|
|
75
|
+
unknown 'API returned invalid JSON'
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def run
|
|
79
|
+
streams = graylog_streams
|
|
80
|
+
disabled_streams = streams[:streams].select { |s| (s[:disabled] == true) }
|
|
81
|
+
|
|
82
|
+
if disabled_streams.count > 0
|
|
83
|
+
streams_desc = []
|
|
84
|
+
disabled_streams.each { |v| streams_desc.push(v[:title]) }
|
|
85
|
+
|
|
86
|
+
critical("Streams currently paused/disabled: #{streams_desc.join(', ')}")
|
|
87
|
+
else
|
|
88
|
+
ok('No streams are paused')
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sensu-plugins-graylog
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
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-
|
|
11
|
+
date: 2017-04-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: sensu-plugin
|
|
@@ -182,6 +182,7 @@ description: Sensu graylog plugins
|
|
|
182
182
|
email: "<sensu-users@googlegroups.com>"
|
|
183
183
|
executables:
|
|
184
184
|
- check-graylog-buffers.rb
|
|
185
|
+
- check-graylog-streams.rb
|
|
185
186
|
- check-graylog2-alive.rb
|
|
186
187
|
- metrics-graylog.rb
|
|
187
188
|
extensions: []
|
|
@@ -192,6 +193,7 @@ files:
|
|
|
192
193
|
- README.md
|
|
193
194
|
- bin/check-graylog-buffers.py
|
|
194
195
|
- bin/check-graylog-buffers.rb
|
|
196
|
+
- bin/check-graylog-streams.rb
|
|
195
197
|
- bin/check-graylog2-alive.rb
|
|
196
198
|
- bin/metrics-graylog.py
|
|
197
199
|
- bin/metrics-graylog.rb
|