sensu-run 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f98b0011438777bc994c41d4645b91aa74f311b2
4
- data.tar.gz: c896f234147e52ce8219f9fb8984513fbf406336
3
+ metadata.gz: aa3a1fd8d813c81b6a70ef99ec3d64ef51fe72e5
4
+ data.tar.gz: b6acfb30322dd68f5abf062ef4f5da62bf19bde1
5
5
  SHA512:
6
- metadata.gz: d62f1a5e3d6f824974b312a1bed210e1251c6a9d9af4a405b116a197db521a09c3e51ffbfba9494a0952a65893cd16b9967878d0b9836e4c0bdbd8ed0741c534
7
- data.tar.gz: 99bacbf4faa0600679e07d429d5d2a8851622e68e5ceb2396385a584570307662c3820193c7f9547db156d7507319a868ec0e5cc621f2ee17f264e84f217da23
6
+ metadata.gz: 853006fb2bc1652930ea4dce33c899a66974aa590ff6a891ce42ecab77551b6f6e48ab38532875f8a83c60369abd0cdadceceee60eabf976c0a9f23b16bac503
7
+ data.tar.gz: 36a78c08dced159e326a8718fbbbc3b654467970ba2885a92b04c7512849d22981e30f54ebe9df184c5eea0a8534cabad419d5ef4318815fbbfab9a2697bc797
@@ -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 cannot run the Sensu Go Agent. Sensu Run wraps the check command execution, constructs a Sensu Go Event, and posts the Event to a Sensu Go Backend API for processing. This utility is written in Ruby (1.8+) and only uses stdlib in hopes it can run on the vast majority of systems. This utility was inspired by https://hackage.haskell.org/package/sensu-run.
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
 
@@ -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)
@@ -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
- post_entity(entity)
53
+ create_entity(entity)
42
54
  end
43
55
  end
44
56
 
@@ -1,5 +1,5 @@
1
1
  module Sensu
2
2
  module Run
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-run
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Porter