watchmonkey_cli 1.11.0 → 1.12.1
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/Gemfile +10 -1
- data/VERSION +1 -1
- data/checksums/watchmonkey_cli-1.12.1.gem.sha512 +1 -0
- data/lib/watchmonkey_cli/application/configuration.rb +18 -3
- data/lib/watchmonkey_cli/application/configuration.tpl +1 -1
- data/lib/watchmonkey_cli/application/core.rb +1 -1
- data/lib/watchmonkey_cli/application.rb +7 -1
- data/lib/watchmonkey_cli/checker.rb +4 -0
- data/lib/watchmonkey_cli/checkers/ftp_availability.rb +1 -1
- data/lib/watchmonkey_cli/checkers/ssl_expiration.rb +1 -1
- data/lib/watchmonkey_cli/checkers/unix_defaults.rb +3 -1
- data/lib/watchmonkey_cli/checkers/www_availability.rb +2 -1
- data/lib/watchmonkey_cli/hooks/telegram_bot.rb +1 -1
- data/lib/watchmonkey_cli/version.rb +1 -1
- data/watchmonkey_cli.gemspec +1 -4
- metadata +5 -49
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9c990a60379408431ec45840429e9ea183cf6723569c6f457384c6564a95e559
|
|
4
|
+
data.tar.gz: b788e5f5e2da8999ca9bf7c66b68bf9f86d3efe496da09d2c08a6121b6b49de6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b135b4d3f834975825617a61333a8aef949f730ecfa06b605ccca2830799fd5943559e4e4db65730d108929e966ed0cc9fa5162ffffb95461e081260ccb50b82
|
|
7
|
+
data.tar.gz: 43b5b2cdcd087eb4cf6e06352ed124423136e1b818b7543e1a953ad6b92d3a653744da80ca5d9e2e0fcd32ea2e0a462cf487c5c81ac7569dda84d91b08bd8f78
|
data/Gemfile
CHANGED
|
@@ -3,5 +3,14 @@ source 'https://rubygems.org'
|
|
|
3
3
|
# Specify your gem's dependencies in dle.gemspec
|
|
4
4
|
gemspec
|
|
5
5
|
|
|
6
|
+
gem "pry"
|
|
7
|
+
gem "bundler"
|
|
8
|
+
gem "rake"
|
|
9
|
+
|
|
10
|
+
# net-ssh co-deps
|
|
11
|
+
gem "ed25519"
|
|
12
|
+
gem "bcrypt_pbkdf"
|
|
13
|
+
|
|
6
14
|
# optional dependencies
|
|
7
|
-
gem
|
|
15
|
+
gem "telegram-bot-ruby"
|
|
16
|
+
gem "net-ftp"
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.12.1
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4be25f6a1529ae4b0015f42448afe751eaf3f8c10a7402d93c84a454b4496c7768b70267d014352a94b08e9d38de75d31bd758e9c8e811b07730900a4b31b175
|
|
@@ -59,10 +59,11 @@ module WatchmonkeyCli
|
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
def initialize app, file
|
|
62
|
+
def initialize app, file = nil, tags = []
|
|
63
63
|
@app = app
|
|
64
64
|
@file = file
|
|
65
|
-
@tags =
|
|
65
|
+
@tags = tags
|
|
66
|
+
return unless file
|
|
66
67
|
begin
|
|
67
68
|
eval File.read(file, encoding: "utf-8"), binding, file
|
|
68
69
|
rescue
|
|
@@ -84,7 +85,21 @@ module WatchmonkeyCli
|
|
|
84
85
|
opts = args.extract_options!
|
|
85
86
|
only = @app.opts[:tag_only]
|
|
86
87
|
except = @app.opts[:tag_except]
|
|
87
|
-
|
|
88
|
+
|
|
89
|
+
# build tags
|
|
90
|
+
tags = (@tags + (opts[:tags] || []).map(&:to_sym))
|
|
91
|
+
if @app.opts[:autotag]
|
|
92
|
+
tags << :"WMC-#{c.class.checker_name}" # checker name
|
|
93
|
+
if args[0].is_a?(Symbol)
|
|
94
|
+
tags << :"WMS-#{args[0]}" # ssh/local connection
|
|
95
|
+
elsif args[0].is_a?(String) && args[0].match(/\Ahttp(s)?:\/\//i)
|
|
96
|
+
uri = URI.parse(args[0]) rescue false
|
|
97
|
+
tags << :"WMH-#{uri.hostname.gsub(".", "_")}" if uri # hostname from URL
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
tags = tags.uniq
|
|
101
|
+
@app.tag_list.merge(tags)
|
|
102
|
+
|
|
88
103
|
if only.any?
|
|
89
104
|
if tags.any?{|t| only.include?(t) }
|
|
90
105
|
if tags.any?{|t| except.include?(t) }
|
|
@@ -57,7 +57,7 @@ ssh_connection :my_server, host: "wheel@example.com", port: 23 # additional opti
|
|
|
57
57
|
#
|
|
58
58
|
# timeout Maximum time to wait for request (default: 20 seconds)
|
|
59
59
|
# verify If enabled the peer will be verified (default: true)
|
|
60
|
-
# threshold Minimum certificate lifetime before showing warnings (default:
|
|
60
|
+
# threshold Minimum certificate lifetime before showing warnings (default: 28.days)
|
|
61
61
|
#
|
|
62
62
|
ssl_expiration "https://example.com", threshold: 3.months
|
|
63
63
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module WatchmonkeyCli
|
|
2
2
|
class Application
|
|
3
|
-
attr_reader :opts, :checkers, :connections, :threads, :queue, :hooks, :processed
|
|
3
|
+
attr_reader :opts, :checkers, :connections, :threads, :queue, :hooks, :processed, :tag_list
|
|
4
4
|
include Helper
|
|
5
5
|
include OutputHelper
|
|
6
6
|
include Colorize
|
|
@@ -49,6 +49,7 @@ module WatchmonkeyCli
|
|
|
49
49
|
@monitor = Monitor.new
|
|
50
50
|
@threads = []
|
|
51
51
|
@queue = Queue.new
|
|
52
|
+
@tag_list = Set.new
|
|
52
53
|
@processed = 0
|
|
53
54
|
@running = false
|
|
54
55
|
@opts = {
|
|
@@ -62,11 +63,16 @@ module WatchmonkeyCli
|
|
|
62
63
|
conclosewait: 10, # max seconds to wait for connections to be closed (may never if they got killed by maxrt)
|
|
63
64
|
loop_forever: false, # (internal) loop forever (app mode)
|
|
64
65
|
loop_wait_empty: 1, # (internal) time to wait in thread if queue is empty
|
|
66
|
+
autotag: true, # (internal) if true checkers will get auto tags for checker name and hostname/connection
|
|
65
67
|
silent: false, # -s flag
|
|
66
68
|
quiet: false, # -q flag
|
|
67
69
|
stdout: STDOUT, # (internal) STDOUT redirect
|
|
68
70
|
tag_only: [], # -o flag
|
|
69
71
|
tag_except: [], # -e flag
|
|
72
|
+
filtered_threads: [ # (internal) stray-thread-detection exclusion list
|
|
73
|
+
"gems/concurrent-ruby",
|
|
74
|
+
"gems/timeout",
|
|
75
|
+
],
|
|
70
76
|
}
|
|
71
77
|
init_params
|
|
72
78
|
yield(self)
|
|
@@ -163,6 +163,10 @@ module WatchmonkeyCli
|
|
|
163
163
|
end
|
|
164
164
|
end
|
|
165
165
|
|
|
166
|
+
def blank_config tags = []
|
|
167
|
+
Application::Configuration.new(app, nil, tags)
|
|
168
|
+
end
|
|
169
|
+
|
|
166
170
|
# def to_s
|
|
167
171
|
# string = "#<#{self.class.name}:#{self.object_id} "
|
|
168
172
|
# fields = self.class.inspector_fields.map{|field| "#{field}: #{self.send(field)}"}
|
|
@@ -4,7 +4,7 @@ module WatchmonkeyCli
|
|
|
4
4
|
self.checker_name = "ssl_expiration"
|
|
5
5
|
|
|
6
6
|
def enqueue page, opts = {}
|
|
7
|
-
opts = { threshold:
|
|
7
|
+
opts = { threshold: 28.days, verify: true, timeout: 20 }.merge(opts)
|
|
8
8
|
app.enqueue(self, page, opts)
|
|
9
9
|
end
|
|
10
10
|
|
|
@@ -35,7 +35,9 @@ module WatchmonkeyCli
|
|
|
35
35
|
# sec.check!(result, host, opts[which])
|
|
36
36
|
# end
|
|
37
37
|
# app.enqueue_sub(self, which, host, opts[which]) if opts[which]
|
|
38
|
-
spawn_sub(which, host, opts[which].is_a?(Hash) ? opts[which] : {}) unless opts[which] == false
|
|
38
|
+
#spawn_sub(which, host, (opts[which].is_a?(Hash) ? opts[which] : {}).merge(tags: result.tags)) unless opts[which] == false
|
|
39
|
+
stags = (opts[:tags] || []).reject{|t| t.to_s.start_with?("WMC-") }
|
|
40
|
+
blank_config(stags).send(which, host, (opts[which].is_a?(Hash) ? opts[which] : {})) unless opts[which] == false
|
|
39
41
|
end
|
|
40
42
|
end
|
|
41
43
|
end
|
|
@@ -9,7 +9,8 @@ module WatchmonkeyCli
|
|
|
9
9
|
# if available enable ssl_expiration support
|
|
10
10
|
if page.start_with?("https://") && opts[:ssl_expiration] != false && !app.running?
|
|
11
11
|
sopts = { timeout: opts[:timeout] }.merge(opts[:ssl_expiration].is_a?(Hash) ? opts[:ssl_expiration] : {})
|
|
12
|
-
|
|
12
|
+
stags = (opts[:tags] || []).reject{|t| t.to_s.start_with?("WMC-") }
|
|
13
|
+
blank_config(stags).ssl_expiration(page, sopts)
|
|
13
14
|
end
|
|
14
15
|
end
|
|
15
16
|
|
|
@@ -418,7 +418,7 @@ module WatchmonkeyCli
|
|
|
418
418
|
when "/start"
|
|
419
419
|
if event.user_data
|
|
420
420
|
event.reply [].tap{|m|
|
|
421
|
-
m << "<b>Welcome!</b> I will tell you if something is wrong with
|
|
421
|
+
m << "<b>Welcome!</b> I will tell you if something is wrong with your infrastructure."
|
|
422
422
|
m << "Your current tags are: #{event.user_data[1].join(", ")}"
|
|
423
423
|
m << "<b>You have admin permissions!</b>" if event.user_admin?
|
|
424
424
|
m << "\nInstead of muting me in Telegram you can silence me for a while with <code>/mute 6h 30m</code>."
|
data/watchmonkey_cli.gemspec
CHANGED
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
|
8
8
|
spec.version = WatchmonkeyCli::VERSION
|
|
9
9
|
spec.authors = ["Sven Pachnit"]
|
|
10
10
|
spec.email = ["sven@bmonkeys.net"]
|
|
11
|
-
spec.summary = %q{Watchmonkey CLI - dead simple agentless monitoring via SSH, HTTP, FTP, etc
|
|
11
|
+
spec.summary = %q{Watchmonkey CLI - dead simple agentless monitoring via SSH, HTTP, FTP, etc}
|
|
12
12
|
spec.description = %q{If you want an easy way to monitor services without the need of installing agents let a monkey do the job by polling status information via transport protocols.}
|
|
13
13
|
spec.homepage = "https://github.com/2called-chaos/watchmonkey_cli"
|
|
14
14
|
spec.license = "MIT"
|
|
@@ -21,7 +21,4 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.add_dependency "activesupport"
|
|
22
22
|
spec.add_dependency "httparty"
|
|
23
23
|
spec.add_dependency "net-ssh"
|
|
24
|
-
spec.add_development_dependency "pry"
|
|
25
|
-
spec.add_development_dependency "bundler"
|
|
26
|
-
spec.add_development_dependency "rake"
|
|
27
24
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: watchmonkey_cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.12.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sven Pachnit
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: activesupport
|
|
@@ -52,48 +51,6 @@ dependencies:
|
|
|
52
51
|
- - ">="
|
|
53
52
|
- !ruby/object:Gem::Version
|
|
54
53
|
version: '0'
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: pry
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - ">="
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: '0'
|
|
62
|
-
type: :development
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - ">="
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: '0'
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: bundler
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - ">="
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0'
|
|
76
|
-
type: :development
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
-
requirements:
|
|
80
|
-
- - ">="
|
|
81
|
-
- !ruby/object:Gem::Version
|
|
82
|
-
version: '0'
|
|
83
|
-
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: rake
|
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
|
86
|
-
requirements:
|
|
87
|
-
- - ">="
|
|
88
|
-
- !ruby/object:Gem::Version
|
|
89
|
-
version: '0'
|
|
90
|
-
type: :development
|
|
91
|
-
prerelease: false
|
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
-
requirements:
|
|
94
|
-
- - ">="
|
|
95
|
-
- !ruby/object:Gem::Version
|
|
96
|
-
version: '0'
|
|
97
54
|
description: If you want an easy way to monitor services without the need of installing
|
|
98
55
|
agents let a monkey do the job by polling status information via transport protocols.
|
|
99
56
|
email:
|
|
@@ -112,6 +69,7 @@ files:
|
|
|
112
69
|
- VERSION
|
|
113
70
|
- bin/watchmonkey
|
|
114
71
|
- bin/watchmonkey.sh
|
|
72
|
+
- checksums/watchmonkey_cli-1.12.1.gem.sha512
|
|
115
73
|
- doc/checker_example.rb
|
|
116
74
|
- doc/config_example.rb
|
|
117
75
|
- lib/watchmonkey_cli.rb
|
|
@@ -150,7 +108,6 @@ homepage: https://github.com/2called-chaos/watchmonkey_cli
|
|
|
150
108
|
licenses:
|
|
151
109
|
- MIT
|
|
152
110
|
metadata: {}
|
|
153
|
-
post_install_message:
|
|
154
111
|
rdoc_options: []
|
|
155
112
|
require_paths:
|
|
156
113
|
- lib
|
|
@@ -165,8 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
165
122
|
- !ruby/object:Gem::Version
|
|
166
123
|
version: '0'
|
|
167
124
|
requirements: []
|
|
168
|
-
rubygems_version:
|
|
169
|
-
signing_key:
|
|
125
|
+
rubygems_version: 4.0.5
|
|
170
126
|
specification_version: 4
|
|
171
|
-
summary: Watchmonkey CLI - dead simple agentless monitoring via SSH, HTTP, FTP, etc
|
|
127
|
+
summary: Watchmonkey CLI - dead simple agentless monitoring via SSH, HTTP, FTP, etc
|
|
172
128
|
test_files: []
|