sensu-plugins-logs 4.0.0 → 4.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 +15 -1
- data/README.md +137 -14
- data/bin/check-journal.rb +2 -0
- data/bin/check-log.rb +2 -0
- data/bin/handler-logevent.rb +3 -1
- data/bin/handler-show-event-config.rb +2 -0
- data/lib/sensu-plugins-logs.rb +2 -0
- data/lib/sensu-plugins-logs/version.rb +3 -1
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e3f61ef4191a130669cd96c51f92e2e056a3956250a6eb8e8d0d6bd1a2d4cea
|
4
|
+
data.tar.gz: 53ba20f2b003a0a82fb2b1c49476267429ce8191bad8b0ce3be8f7198ac25ab9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 528a3483a2a26a874ddce5aced719ee0faed20bf3d65726566a79e5cf128d6ac75410d471da9cc17531b2a669b561eca4679961bef85dbe009e952e3ca98096b
|
7
|
+
data.tar.gz: 8873f6c1bdad842645d32d64d54884b7678069936c178e5ed883beb8c3c0e5933524b6ef996c7aa8d9d316641ac12e67d9ca8c24dfffe83c5d600307feba1c61
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,18 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [4.1.0] - 2020-07-02
|
9
|
+
### Changed
|
10
|
+
- Updated rubocop development dependency to '~= 0.81.0'
|
11
|
+
- Updated rake development dependency to '~= 13.0'
|
12
|
+
|
13
|
+
### Added
|
14
|
+
- Updated asset build targets to support centos6
|
15
|
+
- Removed centos from bonsai asset definition
|
16
|
+
|
17
|
+
### Fixed
|
18
|
+
- debian asset target
|
19
|
+
|
8
20
|
## [4.0.0] - 2019-05-07
|
9
21
|
### Breaking Changes
|
10
22
|
- Bump `sensu-plugin` dependency from `~> 3.0` to `~> 4.0` you can read the changelog entries for [4.0](https://github.com/sensu-plugins/sensu-plugin/blob/master/CHANGELOG.md#400---2018-02-17), [3.0](https://github.com/sensu-plugins/sensu-plugin/blob/master/CHANGELOG.md#300---2018-12-04), and [2.0](https://github.com/sensu-plugins/sensu-plugin/blob/master/CHANGELOG.md#v200---2017-03-29)
|
@@ -111,9 +123,11 @@ This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins
|
|
111
123
|
### Added
|
112
124
|
- initial release
|
113
125
|
|
114
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/4.
|
126
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/4.1.0...HEAD
|
127
|
+
[4.1.0]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/4.0.0...4.1.0
|
115
128
|
[4.0.0]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/3.0.0...4.0.0
|
116
129
|
[3.0.0]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/2.0.0...3.0.0
|
130
|
+
[3.0.0]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/2.0.0...3.0.0
|
117
131
|
[2.0.0]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.3.1...2.0.0
|
118
132
|
[1.3.1]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.3.0...1.3.1
|
119
133
|
[1.3.0]: https://github.com/sensu-plugins/sensu-plugins-logs/compare/1.2.1...1.3.0
|
data/README.md
CHANGED
@@ -1,24 +1,114 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
[![Sensu Bonsai Asset](https://img.shields.io/badge/Bonsai-Download%20Me-brightgreen.svg?colorB=89C967&logo=sensu)](https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-logs)
|
3
2
|
[ ![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-logs.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-logs)
|
4
3
|
[![Gem Version](https://badge.fury.io/rb/sensu-plugins-logs.svg)](http://badge.fury.io/rb/sensu-plugins-logs)
|
5
4
|
[![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-logs/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-logs)
|
6
5
|
[![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-logs/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-logs)
|
7
6
|
[![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-logs.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-logs)
|
8
|
-
[![Sensu Bonsai Asset](https://img.shields.io/badge/Bonsai-Download%20Me-brightgreen.svg?colorB=89C967&logo=sensu)](https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-logs)
|
9
7
|
|
10
|
-
## Sensu
|
11
|
-
The Sensu assets packaged from this repository are built against the Sensu ruby runtime environment. When using these assets as part of a Sensu Go resource (check, mutator or handler), make sure you include the corresponding Sensu ruby runtime asset in the list of assets needed by the resource. The current ruby-runtime assets can be found [here](https://bonsai.sensu.io/assets/sensu/sensu-ruby-runtime) in the [Bonsai Asset Index](bonsai.sensu.io).
|
8
|
+
## Sensu Plugins Logs Plugin
|
12
9
|
|
13
|
-
|
10
|
+
- [Overview](#overview)
|
11
|
+
- [Files](#files)
|
12
|
+
- [Usage examples](#usage-examples)
|
13
|
+
- [Configuration](#configuration)
|
14
|
+
- [Sensu Go](#sensu-go)
|
15
|
+
- [Asset registration](#asset-registration)
|
16
|
+
- [Asset definition](#asset-definition)
|
17
|
+
- [Check definition](#check-definition)
|
18
|
+
- [Sensu Core](#sensu-core)
|
19
|
+
- [Check definition](#check-definition)
|
20
|
+
- [Installation from source](#installation-from-source)
|
21
|
+
- [Additional notes](#additional-notes)
|
22
|
+
- [Contributing](#contributing)
|
14
23
|
|
15
|
-
|
24
|
+
### Overview
|
25
|
+
|
26
|
+
This plugin provides native instrumentation for monitoring log files or system logs via journald for regular expressions and a Sensu handler for logging Sensu events to log files.
|
27
|
+
|
28
|
+
### Files
|
16
29
|
* bin/check-journal.rb
|
17
30
|
* bin/check-log.rb
|
18
31
|
* bin/handler-logevent.rb
|
19
32
|
* bin/handler-show-event-config.rb
|
33
|
+
|
34
|
+
**check-journal**
|
35
|
+
Checks the systemd journal (`journald`) for a pattern.
|
20
36
|
|
21
|
-
|
37
|
+
**check-log**
|
38
|
+
Checks a log file for a regular expression, skipping lines that have already been read. Stores the number of bytes read and seeks to that position next time (instead of making a backup copy of the whole log file).
|
39
|
+
|
40
|
+
**handler-logevent**
|
41
|
+
Logs last `settings['logevent']['keep']` JSON events in files as `settings['logevent']['eventdir']/client/check_name/timestamp.action`.
|
42
|
+
|
43
|
+
**handler-show-event-config**
|
44
|
+
Lists the handler's config and the event it read.
|
45
|
+
|
46
|
+
## Usage examples
|
47
|
+
|
48
|
+
### Help
|
49
|
+
|
50
|
+
**check-journal.rb**
|
51
|
+
```
|
52
|
+
Usage: check-journal.rb (options)
|
53
|
+
-c, --critical COUNT Number of matches to consider a critical issue.
|
54
|
+
-j "ARGS1 ARGS2 ...", Pass additional arguments to journalctl, eg: "-u nginx.service"
|
55
|
+
--journalctl_args
|
56
|
+
-q, --pattern PAT Pattern to search for
|
57
|
+
-s, --since TIMESPEC Query journal entries on or newer than the specified date/time.
|
58
|
+
-v Verbose output. Helpful for debugging the plugin.
|
59
|
+
-w, --warning COUNT Number of matches to consider a warning
|
60
|
+
```
|
61
|
+
|
62
|
+
**handler-logevent.rb**
|
63
|
+
```
|
64
|
+
Usage: handler-logevent.rb (options)
|
65
|
+
--map-go-event-into-ruby Enable Sensu Go to Sensu Ruby event mapping. Alternatively set envvar SENSU_MAP_GO_EVENT_INTO_RUBY=1.
|
66
|
+
|
67
|
+
```
|
68
|
+
|
69
|
+
## Configuration
|
70
|
+
### Sensu Go
|
71
|
+
#### Asset registration
|
72
|
+
|
73
|
+
Assets are the best way to make use of this plugin. If you're not using an asset, please consider doing so! If you're using sensuctl 5.13 or later, you can use the following command to add the asset:
|
74
|
+
|
75
|
+
`sensuctl asset add sensu-plugins/sensu-plugins-logs`
|
76
|
+
|
77
|
+
If you're using an earlier version of sensuctl, you can download the asset definition from [this project's Bonsai asset index page](https://bonsai.sensu.io/assets/sensu-plugins/sensu-plugins-logs).
|
78
|
+
|
79
|
+
#### Asset definition
|
80
|
+
|
81
|
+
```yaml
|
82
|
+
---
|
83
|
+
type: Asset
|
84
|
+
api_version: core/v2
|
85
|
+
metadata:
|
86
|
+
name: sensu-plugins-logs
|
87
|
+
spec:
|
88
|
+
url: https://assets.bonsai.sensu.io/9ba6c6b27b5ca36538de3a13f014718ead3a1215/sensu-plugins-logs_4.0.0_centos_linux_amd64.tar.gz
|
89
|
+
sha512: 4e29c549924b5df01c7a8e0ed105659b3e9e81ca5c919548efd03a2ccaaf83d8605130ab80132e93db6f5e25c7acddbd7f6e8c6d185567eb5f73cd420dcc2f06
|
90
|
+
```
|
91
|
+
|
92
|
+
#### Check definition
|
93
|
+
|
94
|
+
```yaml
|
95
|
+
---
|
96
|
+
type: CheckConfig
|
97
|
+
spec:
|
98
|
+
command: "check-journal.rb"
|
99
|
+
handlers: []
|
100
|
+
high_flap_threshold: 0
|
101
|
+
interval: 10
|
102
|
+
low_flap_threshold: 0
|
103
|
+
publish: true
|
104
|
+
runtime_assets:
|
105
|
+
- sensu-plugins/sensu-plugins-logs
|
106
|
+
- sensu/sensu-ruby-runtime
|
107
|
+
subscriptions:
|
108
|
+
- linux
|
109
|
+
```
|
110
|
+
|
111
|
+
#### Handler definition
|
22
112
|
|
23
113
|
**handler-logevent**
|
24
114
|
```
|
@@ -30,12 +120,45 @@
|
|
30
120
|
}
|
31
121
|
```
|
32
122
|
|
33
|
-
|
123
|
+
### Sensu Core
|
124
|
+
|
125
|
+
#### Check definition
|
126
|
+
```json
|
127
|
+
{
|
128
|
+
"checks": {
|
129
|
+
"check-journal": {
|
130
|
+
"command": "check-journal.rb",
|
131
|
+
"subscribers": ["linux"],
|
132
|
+
"interval": 10,
|
133
|
+
"refresh": 10,
|
134
|
+
"handlers": ["influxdb"]
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
```
|
139
|
+
|
140
|
+
## Installation from source
|
141
|
+
|
142
|
+
### Sensu Go
|
143
|
+
|
144
|
+
See the instructions above for [asset registration](#asset-registration).
|
145
|
+
|
146
|
+
### Sensu Core
|
147
|
+
|
148
|
+
Install and setup plugins on [Sensu Core](https://docs.sensu.io/sensu-core/latest/installation/installing-plugins/).
|
149
|
+
|
150
|
+
## Additional notes
|
151
|
+
|
152
|
+
### Sensu Go Ruby Runtime Assets
|
153
|
+
|
154
|
+
The Sensu assets packaged from this repository are built against the Sensu Ruby runtime environment. When using these assets as part of a Sensu Go resource (check, mutator, or handler), make sure to include the corresponding [Sensu Ruby Runtime Asset](https://bonsai.sensu.io/assets/sensu/sensu-ruby-runtime) in the list of assets needed by the resource.
|
155
|
+
|
156
|
+
### Use this plugin with Sensu Go
|
157
|
+
|
158
|
+
To use the included handlers with Sensu Go, use the `--map-go-event-into-ruby` argument or set environment variable `SENSU_MAP_GO_EVENT_INTO_RUBY=1`.
|
34
159
|
|
35
|
-
|
160
|
+
Make sure the required handler configuration JSON exists under `/etc/sensu/conf.d/` or at a path in the colon-separated list of files in the environment variable `SENSU_CONFIG_FILES`.
|
36
161
|
|
37
|
-
##
|
38
|
-
### Using this plugin with Sensu Go
|
39
|
-
* To use included handlers with Sensu Go, use `--map-go-event-into-ruby` argument or set environment variable `SENSU_MAP_GO_EVENT_INTO_RUBY=1`
|
162
|
+
## Contributing
|
40
163
|
|
41
|
-
|
164
|
+
See [CONTRIBUTING.md](https://github.com/sensu-plugins/sensu-plugins-logs/blob/master/CONTRIBUTING.md) for information about contributing to this plugin.
|
data/bin/check-journal.rb
CHANGED
data/bin/check-log.rb
CHANGED
data/bin/handler-logevent.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: false
|
3
|
+
|
2
4
|
#
|
3
5
|
# This handler logs last settings['logevent']['keep'] json events in files as
|
4
6
|
# settings['logevent']['eventdir']/client/check_name/timestamp.action
|
@@ -34,7 +36,7 @@ class LogEvent < Sensu::Handler
|
|
34
36
|
|
35
37
|
events = Dir.glob("#{eventdir}/*.#{event_action}")
|
36
38
|
# #YELLOW
|
37
|
-
if settings['logevent']['keep'] < events.length # rubocop:disable GuardClause
|
39
|
+
if settings['logevent']['keep'] < events.length # rubocop:disable Style/GuardClause
|
38
40
|
FileUtils.rm_f(events.sort.reverse.shift(settings['logevent']['keep']))
|
39
41
|
end
|
40
42
|
end
|
data/lib/sensu-plugins-logs.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-logs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.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:
|
11
|
+
date: 2020-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sensu-plugin
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1
|
33
|
+
version: '2.1'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1
|
40
|
+
version: '2.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: codeclimate-test-reporter
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,14 +134,14 @@ dependencies:
|
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
137
|
+
version: '13.0'
|
138
138
|
type: :development
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
144
|
+
version: '13.0'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: rdoc
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -190,14 +190,14 @@ dependencies:
|
|
190
190
|
requirements:
|
191
191
|
- - "~>"
|
192
192
|
- !ruby/object:Gem::Version
|
193
|
-
version: 0.
|
193
|
+
version: 0.81.0
|
194
194
|
type: :development
|
195
195
|
prerelease: false
|
196
196
|
version_requirements: !ruby/object:Gem::Requirement
|
197
197
|
requirements:
|
198
198
|
- - "~>"
|
199
199
|
- !ruby/object:Gem::Version
|
200
|
-
version: 0.
|
200
|
+
version: 0.81.0
|
201
201
|
- !ruby/object:Gem::Dependency
|
202
202
|
name: serverspec
|
203
203
|
requirement: !ruby/object:Gem::Requirement
|
@@ -246,9 +246,9 @@ description: |-
|
|
246
246
|
regex matching. Includes various log handlers.
|
247
247
|
email: "<sensu-users@googlegroups.com>"
|
248
248
|
executables:
|
249
|
-
- handler-show-event-config.rb
|
250
|
-
- check-journal.rb
|
251
249
|
- check-log.rb
|
250
|
+
- check-journal.rb
|
251
|
+
- handler-show-event-config.rb
|
252
252
|
- handler-logevent.rb
|
253
253
|
extensions: []
|
254
254
|
extra_rdoc_files: []
|
@@ -287,7 +287,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
287
287
|
- !ruby/object:Gem::Version
|
288
288
|
version: '0'
|
289
289
|
requirements: []
|
290
|
-
|
290
|
+
rubyforge_project:
|
291
|
+
rubygems_version: 2.7.7
|
291
292
|
signing_key:
|
292
293
|
specification_version: 4
|
293
294
|
summary: Sensu plugins for logs
|