sensu-run 0.2.0 → 0.3.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 -0
- data/README.md +8 -1
- data/lib/sensu/run.rb +3 -0
- data/lib/sensu/run/api_client.rb +14 -2
- data/lib/sensu/run/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa3a1fd8d813c81b6a70ef99ec3d64ef51fe72e5
|
4
|
+
data.tar.gz: b6acfb30322dd68f5abf062ef4f5da62bf19bde1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 853006fb2bc1652930ea4dce33c899a66974aa590ff6a891ce42ecab77551b6f6e48ab38532875f8a83c60369abd0cdadceceee60eabf976c0a9f23b16bac503
|
7
|
+
data.tar.gz: 36a78c08dced159e326a8718fbbbc3b654467970ba2885a92b04c7512849d22981e30f54ebe9df184c5eea0a8534cabad419d5ef4318815fbbfab9a2697bc797
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic
|
6
6
|
Versioning](http://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [0.3.0] - 2020-01-10
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
- Entity creation no longer throws a method missing exception
|
12
|
+
|
13
|
+
### Added
|
14
|
+
- TLS support
|
15
|
+
|
8
16
|
## [0.2.0] - 2020-01-10
|
9
17
|
|
10
18
|
### Added
|
data/README.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# Sensu Run
|
2
2
|
|
3
|
-
Sensu Run is a utility for executing Sensu Go checks on systems that
|
3
|
+
Sensu Run is a utility for executing Sensu Go checks on systems that
|
4
|
+
cannot run the Sensu Go Agent. Sensu Run wraps the check command
|
5
|
+
execution, constructs a Sensu Go Entity and Event, and communicates
|
6
|
+
with the Sensu Go Backend API to create the Entity (if missing) and
|
7
|
+
submit the Event for processing. This utility is written in Ruby
|
8
|
+
(1.8+) and only uses stdlib in hopes it can run on the vast majority
|
9
|
+
of systems. This utility was inspired by
|
10
|
+
https://hackage.haskell.org/package/sensu-run.
|
4
11
|
|
5
12
|
## Installation
|
6
13
|
|
data/lib/sensu/run.rb
CHANGED
@@ -43,6 +43,9 @@ module Sensu
|
|
43
43
|
opts.on("-k", "--api-key KEY", "Sensu Go Backend API key") do |key|
|
44
44
|
options[:api_key] = key
|
45
45
|
end
|
46
|
+
opts.on("-s", "--insecure-skip-tls-verify", "Skip TLS verify peer when using HTTPS") do |key|
|
47
|
+
options[:skip_tls_verify_peer] = true
|
48
|
+
end
|
46
49
|
end
|
47
50
|
|
48
51
|
optparse.parse!(arguments)
|
data/lib/sensu/run/api_client.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
-
require "net/http"
|
2
1
|
require "uri"
|
3
2
|
require "json"
|
4
3
|
|
4
|
+
begin
|
5
|
+
require "net/https"
|
6
|
+
rescue LoadError
|
7
|
+
require "net/http"
|
8
|
+
end
|
9
|
+
|
5
10
|
module Sensu
|
6
11
|
module Run
|
7
12
|
class APIClient
|
@@ -9,6 +14,13 @@ module Sensu
|
|
9
14
|
@options = options
|
10
15
|
uri = URI.parse(select_backend)
|
11
16
|
@http = Net::HTTP.new(uri.host, uri.port)
|
17
|
+
if uri.scheme == "https"
|
18
|
+
@http.use_ssl = true
|
19
|
+
@http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
20
|
+
if options[:skip_tls_verify_peer]
|
21
|
+
@http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
22
|
+
end
|
23
|
+
end
|
12
24
|
end
|
13
25
|
|
14
26
|
def select_backend
|
@@ -38,7 +50,7 @@ module Sensu
|
|
38
50
|
|
39
51
|
def create_entity_if_missing(entity)
|
40
52
|
unless entity_exists?(entity)
|
41
|
-
|
53
|
+
create_entity(entity)
|
42
54
|
end
|
43
55
|
end
|
44
56
|
|
data/lib/sensu/run/version.rb
CHANGED