arborist-webservice 0.0.1.pre20161005112659
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.document +5 -0
- data/.editorconfig +14 -0
- data/.rdoc_options +16 -0
- data/.simplecov +9 -0
- data/ChangeLog +8 -0
- data/History.md +4 -0
- data/Manifest.txt +14 -0
- data/README.md +100 -0
- data/Rakefile +95 -0
- data/lib/arborist/monitor/webservice.rb +177 -0
- data/lib/arborist/node/webservice.rb +97 -0
- data/lib/arborist/webservice.rb +36 -0
- data/spec/arborist/node/webservice_spec.rb +14 -0
- data/spec/spec_helper.rb +23 -0
- metadata +234 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f4e227c38b920952303ac075e51233e29f069947e2f656ef61a7d5e58317f1dc
|
4
|
+
data.tar.gz: ecd18bd697e9dff6ad1c8d529447ff39d75f45b05c3f829a6cbf16ce4ff4d10b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: db32b2a146b73b8fe22fa7d2171ea9a7fc9cff8b39a0d73a0d1bcfb497586bd67283f59abcfbc97328d8a1f1a0a89cc9c6c490f2f93dc6a597e6d5c804cbcabe
|
7
|
+
data.tar.gz: d653466ef7c1fb00c80d958f75382f87a3291d2fce72fa8b7b0ca119b3d096479929f45334d982c07a406b1971d23cafea80cc4c1ec233e8997b9d01f19b10ed
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
data/.document
ADDED
data/.editorconfig
ADDED
data/.rdoc_options
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
--- !ruby/object:RDoc::Options
|
2
|
+
encoding: UTF-8
|
3
|
+
static_path: []
|
4
|
+
rdoc_include:
|
5
|
+
- .
|
6
|
+
charset: UTF-8
|
7
|
+
exclude:
|
8
|
+
hyperlink_all: false
|
9
|
+
line_numbers: false
|
10
|
+
main_page: README.md
|
11
|
+
markup: markdown
|
12
|
+
show_hash: false
|
13
|
+
tab_width: 8
|
14
|
+
title: Arborist-Node-Webservice Documentation
|
15
|
+
visibility: :protected
|
16
|
+
webcvs:
|
data/.simplecov
ADDED
data/ChangeLog
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
2016-02-08 Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
* .document, .editorconfig, .hgignore, .pryrc, .rdoc_options,
|
4
|
+
.rvm.gems, .rvmrc, .simplecov, Gemfile, LICENSE.txt, Rakefile,
|
5
|
+
certs/ged.pem, lib/arborist/node/webservice.rb,
|
6
|
+
spec/arborist/node/webservice_spec.rb, spec/spec_helper.rb:
|
7
|
+
Initial commit.
|
8
|
+
[d318b4f0d795] [tip]
|
data/History.md
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
.document
|
2
|
+
.editorconfig
|
3
|
+
.rdoc_options
|
4
|
+
.simplecov
|
5
|
+
ChangeLog
|
6
|
+
History.md
|
7
|
+
Manifest.txt
|
8
|
+
README.md
|
9
|
+
Rakefile
|
10
|
+
lib/arborist/monitor/webservice.rb
|
11
|
+
lib/arborist/node/webservice.rb
|
12
|
+
lib/arborist/webservice.rb
|
13
|
+
spec/arborist/node/webservice_spec.rb
|
14
|
+
spec/spec_helper.rb
|
data/README.md
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
# Arborist-Webservices
|
2
|
+
|
3
|
+
home
|
4
|
+
: http://bitbucket.org/ged/Arborist-Webservices
|
5
|
+
|
6
|
+
github
|
7
|
+
: https://github.com/ged/arborist-webservices
|
8
|
+
|
9
|
+
docs
|
10
|
+
: http://deveiate.org/code/arborist-webservices
|
11
|
+
|
12
|
+
|
13
|
+
## Description
|
14
|
+
|
15
|
+
This is a collection of webservice monitoring tools for the Arborist monitoring toolkit (http://arbori.st/).
|
16
|
+
|
17
|
+
It can be used to describe and monitor HTTP services in more detail than a simple port check.
|
18
|
+
|
19
|
+
|
20
|
+
### Examples
|
21
|
+
|
22
|
+
Webservice nodes, like `service` nodes, are specified under a `host` node, which should be a single
|
23
|
+
instance of physical hardware that is hosting the service.
|
24
|
+
|
25
|
+
The simplest example is an unauthenticated REST service running on port 80:
|
26
|
+
|
27
|
+
Arborist::Host 'example-webserver' do
|
28
|
+
address 'ws01-01.example.com'
|
29
|
+
webservice 'api-v1', 'http://api.example.com/v1/heartbeat'
|
30
|
+
end
|
31
|
+
|
32
|
+
This adds a `webservice` child node to the containing host with an identifier of
|
33
|
+
`frontend-17-api-example-com-webservice`.
|
34
|
+
|
35
|
+
The simplest monitor setup to monitor that service might look something like:
|
36
|
+
|
37
|
+
# -*- ruby -*-
|
38
|
+
#encoding: utf-8
|
39
|
+
|
40
|
+
require 'arborist/monitor/webservice'
|
41
|
+
Arborist::Monitor::Webservice::REST.default
|
42
|
+
|
43
|
+
This would check that an OPTIONS HTTP request to `http://api.example.com/v1/heartbeat` responds with a 2xx status code.
|
44
|
+
|
45
|
+
|
46
|
+
## Prerequisites
|
47
|
+
|
48
|
+
* Ruby
|
49
|
+
|
50
|
+
|
51
|
+
## Installation
|
52
|
+
|
53
|
+
$ gem install arborist-webservices
|
54
|
+
|
55
|
+
|
56
|
+
## Contributing
|
57
|
+
|
58
|
+
You can check out the current development source with Mercurial via its
|
59
|
+
{project page}[http://bitbucket.org/ged/arborist-webservices]. Or if you prefer Git, via
|
60
|
+
{its Github mirror}[https://github.com/ged/arborist-webservices].
|
61
|
+
|
62
|
+
After checking out the source, run:
|
63
|
+
|
64
|
+
$ rake newb
|
65
|
+
|
66
|
+
This task will install any missing dependencies, run the tests/specs,
|
67
|
+
and generate the API documentation.
|
68
|
+
|
69
|
+
|
70
|
+
## License
|
71
|
+
|
72
|
+
Copyright (c) 2016, Michael Granger
|
73
|
+
All rights reserved.
|
74
|
+
|
75
|
+
Redistribution and use in source and binary forms, with or without
|
76
|
+
modification, are permitted provided that the following conditions are met:
|
77
|
+
|
78
|
+
* Redistributions of source code must retain the above copyright notice,
|
79
|
+
this list of conditions and the following disclaimer.
|
80
|
+
|
81
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
82
|
+
this list of conditions and the following disclaimer in the documentation
|
83
|
+
and/or other materials provided with the distribution.
|
84
|
+
|
85
|
+
* Neither the name of the author/s, nor the names of the project's
|
86
|
+
contributors may be used to endorse or promote products derived from this
|
87
|
+
software without specific prior written permission.
|
88
|
+
|
89
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
90
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
91
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
92
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
93
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
94
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
95
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
96
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
97
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
98
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
99
|
+
|
100
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,95 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
begin
|
4
|
+
require 'hoe'
|
5
|
+
rescue LoadError
|
6
|
+
abort "This Rakefile requires hoe (gem install hoe)"
|
7
|
+
end
|
8
|
+
|
9
|
+
GEMSPEC = 'arborist-webservice.gemspec'
|
10
|
+
|
11
|
+
|
12
|
+
Hoe.plugin :mercurial
|
13
|
+
Hoe.plugin :signing
|
14
|
+
Hoe.plugin :deveiate
|
15
|
+
|
16
|
+
Hoe.plugins.delete :rubyforge
|
17
|
+
|
18
|
+
hoespec = Hoe.spec 'arborist-webservice' do |spec|
|
19
|
+
spec.readme_file = 'README.md'
|
20
|
+
spec.history_file = 'History.md'
|
21
|
+
spec.extra_rdoc_files = FileList[ '*.md' ]
|
22
|
+
spec.license 'BSD-3-Clause'
|
23
|
+
spec.urls = {
|
24
|
+
home: 'http://deveiate.org/projects/arborist-webservice',
|
25
|
+
code: 'http://bitbucket.org/ged/arborist-webservice',
|
26
|
+
docs: 'http://deveiate.org/code/arborist-webservice',
|
27
|
+
github: 'http://github.com/ged/arborist-webservice',
|
28
|
+
}
|
29
|
+
|
30
|
+
spec.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
31
|
+
|
32
|
+
spec.dependency 'arborist', '~> 0'
|
33
|
+
spec.dependency 'loggability', '~> 0.11'
|
34
|
+
spec.dependency 'httpclient', '~> 2.7'
|
35
|
+
|
36
|
+
spec.dependency 'hoe-deveiate', '~> 0.3', :developer
|
37
|
+
spec.dependency 'simplecov', '~> 0.7', :developer
|
38
|
+
spec.dependency 'rdoc-generator-fivefish', '~> 0.1', :developer
|
39
|
+
|
40
|
+
spec.hg_sign_tags = true if spec.respond_to?( :hg_sign_tags= )
|
41
|
+
spec.check_history_on_release = true if spec.respond_to?( :check_history_on_release= )
|
42
|
+
|
43
|
+
self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
ENV['VERSION'] ||= hoespec.spec.version.to_s
|
48
|
+
|
49
|
+
# Run the tests before checking in
|
50
|
+
task 'hg:precheckin' => [ :check_history, :check_manifest, :gemspec, :spec ]
|
51
|
+
|
52
|
+
task :test => :spec
|
53
|
+
|
54
|
+
# Rebuild the ChangeLog immediately before release
|
55
|
+
task :prerelease => 'ChangeLog'
|
56
|
+
CLOBBER.include( 'ChangeLog' )
|
57
|
+
|
58
|
+
desc "Build a coverage report"
|
59
|
+
task :coverage do
|
60
|
+
ENV["COVERAGE"] = 'yes'
|
61
|
+
Rake::Task[:spec].invoke
|
62
|
+
end
|
63
|
+
CLOBBER.include( 'coverage' )
|
64
|
+
|
65
|
+
|
66
|
+
# Use the fivefish formatter for docs generated from development checkout
|
67
|
+
if File.directory?( '.hg' )
|
68
|
+
require 'rdoc/task'
|
69
|
+
|
70
|
+
Rake::Task[ 'docs' ].clear
|
71
|
+
RDoc::Task.new( 'docs' ) do |rdoc|
|
72
|
+
rdoc.main = "README.rdoc"
|
73
|
+
rdoc.markup = 'markdown'
|
74
|
+
rdoc.rdoc_files.include( "*.rdoc", "ChangeLog", "lib/**/*.rb" )
|
75
|
+
rdoc.generator = :fivefish
|
76
|
+
rdoc.title = 'Webservice Node Type for Arborist'
|
77
|
+
rdoc.rdoc_dir = 'doc'
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
task :gemspec => GEMSPEC
|
82
|
+
file GEMSPEC => __FILE__
|
83
|
+
task GEMSPEC do |task|
|
84
|
+
spec = $hoespec.spec
|
85
|
+
spec.files.delete( '.gemtest' )
|
86
|
+
spec.signing_key = nil
|
87
|
+
spec.cert_chain = ['certs/ged.pem']
|
88
|
+
spec.version = "#{spec.version}.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
|
89
|
+
File.open( task.name, 'w' ) do |fh|
|
90
|
+
fh.write( spec.to_ruby )
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
CLOBBER.include( GEMSPEC.to_s )
|
95
|
+
|
@@ -0,0 +1,177 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#encoding: utf-8
|
3
|
+
|
4
|
+
require 'thread'
|
5
|
+
require 'httpclient'
|
6
|
+
|
7
|
+
require 'arborist'
|
8
|
+
require 'arborist/webservice'
|
9
|
+
require 'arborist/mixins'
|
10
|
+
require 'arborist/monitor' unless defined?( Arborist::Monitor )
|
11
|
+
|
12
|
+
|
13
|
+
# A web-service monitor type for Arborist
|
14
|
+
module Arborist::Monitor::Webservice
|
15
|
+
|
16
|
+
using Arborist::TimeRefinements
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
# Arborist HTML web service monitor logic
|
21
|
+
class HTML
|
22
|
+
extend Loggability
|
23
|
+
log_to :arborist_webservice
|
24
|
+
|
25
|
+
|
26
|
+
# Defaults for instances of this monitor
|
27
|
+
DEFAULT_OPTIONS = {
|
28
|
+
timeout: 5.seconds
|
29
|
+
}
|
30
|
+
|
31
|
+
|
32
|
+
### Instantiate a monitor check and run it for the specified +nodes+.
|
33
|
+
def self::run( nodes )
|
34
|
+
return self.new.run( nodes )
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
### Create a new HTML webservice monitor with the specified +options+. Valid options are:
|
39
|
+
###
|
40
|
+
### +:timeout+
|
41
|
+
### Set the number of seconds to wait for a connection for each node.
|
42
|
+
def initialize( options=DEFAULT_OPTIONS )
|
43
|
+
options = DEFAULT_OPTIONS.merge( options || {} )
|
44
|
+
|
45
|
+
options.each do |name, value|
|
46
|
+
self.public_send( "#{name}=", value )
|
47
|
+
end
|
48
|
+
|
49
|
+
agent = "%p/%s via %s" %
|
50
|
+
[ self.class, Arborist::Webservice::VERSION, HTTPClient::DEFAULT_AGENT_NAME ]
|
51
|
+
@client = HTTPClient.new( agent_name: agent )
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
######
|
56
|
+
public
|
57
|
+
######
|
58
|
+
|
59
|
+
# The timeout for connecting, in seconds.
|
60
|
+
attr_accessor :timeout
|
61
|
+
|
62
|
+
# The HTTPClient object to use for HTTP
|
63
|
+
attr_accessor :client
|
64
|
+
|
65
|
+
|
66
|
+
### Return a clone of this object with its timeout set to +new_timeout+.
|
67
|
+
def with_timeout( new_timeout )
|
68
|
+
copy = self.clone
|
69
|
+
copy.timeout = new_timeout
|
70
|
+
return copy
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
### Run the HTML check for each of the specified Hash of +nodes+ and return a Hash of
|
75
|
+
### updates for them based on trying to connect to them.
|
76
|
+
def run( nodes )
|
77
|
+
self.log.debug "Got %d nodes to check with %p" % [ nodes.length, self ]
|
78
|
+
|
79
|
+
connections = self.make_request_connections( nodes )
|
80
|
+
return self.wait_for_connections( connections )
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
### Create Threads that will execute the HTTP requests for the specified +nodes+
|
85
|
+
### and return them in a ThreadGroup.
|
86
|
+
def make_request_connections( nodes )
|
87
|
+
connections = {}
|
88
|
+
|
89
|
+
nodes.each do |identifier, node_data|
|
90
|
+
uri = node_data['uri']
|
91
|
+
conn = client.head_async( uri )
|
92
|
+
connections[ conn ] = identifier
|
93
|
+
end
|
94
|
+
|
95
|
+
return connections
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
### Fetch the response from the request in each thread in the specified
|
100
|
+
### +threadgroup+. Return the results.
|
101
|
+
def wait_for_connections( connections )
|
102
|
+
results = {}
|
103
|
+
start = Time.now
|
104
|
+
timeout_at = Time.now + self.timeout
|
105
|
+
|
106
|
+
until connections.empty? || timeout_at.past?
|
107
|
+
responses = self.handle_connection_responses( connections )
|
108
|
+
results.merge!( responses )
|
109
|
+
end
|
110
|
+
|
111
|
+
# The rest are timeouts
|
112
|
+
if !connections.empty?
|
113
|
+
errors = self.timeout_connections( connections )
|
114
|
+
results.merge!( errors )
|
115
|
+
end
|
116
|
+
|
117
|
+
return results
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
### Look for +connections+ that are finished and remove them. Modifies +connections+
|
122
|
+
### in place and returns a Hash of results based on responses.
|
123
|
+
def handle_connection_responses( connections )
|
124
|
+
results = {}
|
125
|
+
|
126
|
+
connections.keys.each do |conn|
|
127
|
+
begin
|
128
|
+
next unless conn.finished?
|
129
|
+
|
130
|
+
identifier = connections.delete( conn )
|
131
|
+
message = conn.pop
|
132
|
+
|
133
|
+
if message.ok?
|
134
|
+
results[ identifier ] = {
|
135
|
+
status: message.status_code,
|
136
|
+
http_version: message.http_version,
|
137
|
+
}
|
138
|
+
else
|
139
|
+
results[ identifier ] = {
|
140
|
+
error: "#{message.status_code} response",
|
141
|
+
status: message.status_code,
|
142
|
+
http_version: message.http_version,
|
143
|
+
}
|
144
|
+
end
|
145
|
+
rescue => err
|
146
|
+
identifier ||= connections.delete( conn ) or
|
147
|
+
raise "Couldn't find identifier for connection %p" % [ conn ]
|
148
|
+
results[ identifier ] = { error: err.message }
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
return results
|
153
|
+
end
|
154
|
+
|
155
|
+
|
156
|
+
### Cancel each of the given +connections+ and return a Hash of results.
|
157
|
+
def timeout_connections( connections )
|
158
|
+
results = {}
|
159
|
+
connections.each do |conn, identifier|
|
160
|
+
conn.async_thread.kill
|
161
|
+
results[ identifier ] = {
|
162
|
+
error: "Request timeout after %ds." % [ self.timeout ]
|
163
|
+
}
|
164
|
+
end
|
165
|
+
|
166
|
+
return results
|
167
|
+
end
|
168
|
+
|
169
|
+
end # class HTML
|
170
|
+
|
171
|
+
|
172
|
+
# Arborist REST webservice monitor logic
|
173
|
+
class REST < Arborist::Monitor::Webservice::HTML
|
174
|
+
end # class REST
|
175
|
+
|
176
|
+
end # class Arborist::Monitor::Webservice
|
177
|
+
|
@@ -0,0 +1,97 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#encoding: utf-8
|
3
|
+
|
4
|
+
require 'loggability'
|
5
|
+
|
6
|
+
require 'arborist'
|
7
|
+
require 'arborist/webservice'
|
8
|
+
require 'arborist/node/service' unless defined?( Arborist::Node::Service )
|
9
|
+
|
10
|
+
|
11
|
+
# A web-service node type for Arborist
|
12
|
+
class Arborist::Node::Webservice < Arborist::Node::Service
|
13
|
+
extend Loggability
|
14
|
+
|
15
|
+
|
16
|
+
# Loggability API -- use the logger for this library
|
17
|
+
log_to :arborist_webservice
|
18
|
+
|
19
|
+
# Webservices live under Host nodes
|
20
|
+
parent_type :host
|
21
|
+
|
22
|
+
|
23
|
+
### Create a new Webservice node.
|
24
|
+
def initialize( identifier, host, uri, attributes={}, &block )
|
25
|
+
@uri = URI( uri )
|
26
|
+
|
27
|
+
attributes[:app_protocol] ||= @uri.scheme
|
28
|
+
attributes[:port] ||= @uri.port
|
29
|
+
attributes[:protocol] = 'tcp'
|
30
|
+
attributes[:http_method] ||= 'OPTIONS'
|
31
|
+
attributes[:expected_status] ||= '2xx'
|
32
|
+
|
33
|
+
self.log.debug "Supering with attributes: %p " % [ attributes ]
|
34
|
+
super( identifier, host, attributes, &block )
|
35
|
+
|
36
|
+
@api_version = nil
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
######
|
41
|
+
public
|
42
|
+
######
|
43
|
+
|
44
|
+
##
|
45
|
+
# The URI of an endpoint that can be used to monitor the webservice
|
46
|
+
attr_reader :uri
|
47
|
+
|
48
|
+
##
|
49
|
+
# The API version of this service (if it has one)
|
50
|
+
attr_reader :api_version
|
51
|
+
|
52
|
+
|
53
|
+
### Returns +true+ if the node matches the specified +key+ and +val+ criteria.
|
54
|
+
def match_criteria?( key, val )
|
55
|
+
self.log.debug "Matching %p: %p against %p" % [ key, val, self ]
|
56
|
+
return case key
|
57
|
+
when 'uri'
|
58
|
+
val = URI( val )
|
59
|
+
self.uri == val
|
60
|
+
else
|
61
|
+
super
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
### Return a Hash of the operational values that are included with the node's
|
67
|
+
### monitor state.
|
68
|
+
def operational_values
|
69
|
+
return super.merge(
|
70
|
+
uri: self.uri.to_s,
|
71
|
+
api_version: self.api_version
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
|
76
|
+
### Return service-node-specific information for #inspect.
|
77
|
+
def node_description
|
78
|
+
return "{%s}%s" % [
|
79
|
+
self.uri,
|
80
|
+
self.api_version ? " (#{self.api_version})" : ''
|
81
|
+
]
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
#######
|
87
|
+
private
|
88
|
+
#######
|
89
|
+
|
90
|
+
### Make an identifier from the specified +url+.
|
91
|
+
def make_identifier_suffix( url )
|
92
|
+
return url.to_s.gsub( /\W+/, '-' )
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
end # class Arborist::Node::Webservice
|
97
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#encoding: utf-8
|
3
|
+
|
4
|
+
require 'loggability'
|
5
|
+
require 'arborist'
|
6
|
+
|
7
|
+
|
8
|
+
# A collection of HTTP tools for the Arborist monitoring toolkit.
|
9
|
+
module Arborist::Webservice
|
10
|
+
extend Loggability
|
11
|
+
|
12
|
+
# Loggability API -- set up a log host for this library
|
13
|
+
log_as :arborist_webservice
|
14
|
+
|
15
|
+
|
16
|
+
# Package version
|
17
|
+
VERSION = '0.0.1'
|
18
|
+
|
19
|
+
# Version control revision
|
20
|
+
REVISION = %q$Revision: d318b4f0d795 $
|
21
|
+
|
22
|
+
|
23
|
+
### Return the name of the library with the version, and optionally the build ID if
|
24
|
+
### +include_build+ is true.
|
25
|
+
def self::version_string( include_build: false )
|
26
|
+
str = "%p v%s" % [ self, VERSION ]
|
27
|
+
str << ' (' << REVISION.strip << ')' if include_build
|
28
|
+
return str
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
require 'arborist/monitor/webservice'
|
33
|
+
require 'arborist/node/webservice'
|
34
|
+
|
35
|
+
end # module Arborist::Webservice
|
36
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
#encoding: utf-8
|
3
|
+
|
4
|
+
require 'simplecov' if ENV['COVERAGE']
|
5
|
+
|
6
|
+
require 'rspec'
|
7
|
+
|
8
|
+
require 'loggability/spechelpers'
|
9
|
+
|
10
|
+
|
11
|
+
### Mock with RSpec
|
12
|
+
RSpec.configure do |config|
|
13
|
+
config.run_all_when_everything_filtered = true
|
14
|
+
config.filter_run :focus
|
15
|
+
config.order = 'random'
|
16
|
+
config.mock_with( :rspec ) do |mock|
|
17
|
+
mock.syntax = :expect
|
18
|
+
end
|
19
|
+
|
20
|
+
config.include( Loggability::SpecHelpers )
|
21
|
+
end
|
22
|
+
|
23
|
+
|
metadata
ADDED
@@ -0,0 +1,234 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: arborist-webservice
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1.pre20161005112659
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michael Granger
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIEbDCCAtSgAwIBAgIBATANBgkqhkiG9w0BAQsFADA+MQwwCgYDVQQDDANnZWQx
|
14
|
+
GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
|
15
|
+
HhcNMTYwODIwMTgxNzQyWhcNMTcwODIwMTgxNzQyWjA+MQwwCgYDVQQDDANnZWQx
|
16
|
+
GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
|
17
|
+
ggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC/JWGRHO+USzR97vXjkFgt
|
18
|
+
83qeNf2KHkcvrRTSnR64i6um/ziin0I0oX23H7VYrDJC9A/uoUa5nGRJS5Zw/+wW
|
19
|
+
ENcvWVZS4iUzi4dsYJGY6yEOsXh2CcF46+QevV8iE+UmbkU75V7Dy1JCaUOyizEt
|
20
|
+
TH5UHsOtUU7k9TYARt/TgYZKuaoAMZZd5qyVqhF1vV+7/Qzmp89NGflXf2xYP26a
|
21
|
+
4MAX2qqKX/FKXqmFO+AGsbwYTEds1mksBF3fGsFgsQWxftG8GfZQ9+Cyu2+l1eOw
|
22
|
+
cZ+lPcg834G9DrqW2zhqUoLr1MTly4pqxYGb7XoDhoR7dd1kFE2a067+DzWC/ADt
|
23
|
+
+QkcqWUm5oh1fN0eqr7NsZlVJDulFgdiiYPQiIN7UNsii4Wc9aZqBoGcYfBeQNPZ
|
24
|
+
soo/6za/bWajOKUmDhpqvaiRv9EDpVLzuj53uDoukMMwxCMfgb04+ckQ0t2G7wqc
|
25
|
+
/D+K9JW9DDs3Yjgv9k4h7YMhW5gftosd+NkNC/+Y2CkCAwEAAaN1MHMwCQYDVR0T
|
26
|
+
BAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFHKN/nkRusdqCJEuq3lgB3fJvyTg
|
27
|
+
MBwGA1UdEQQVMBOBEWdlZEBGYWVyaWVNVUQub3JnMBwGA1UdEgQVMBOBEWdlZEBG
|
28
|
+
YWVyaWVNVUQub3JnMA0GCSqGSIb3DQEBCwUAA4IBgQAPJzKiT0zBU7kpqe0aS2qb
|
29
|
+
FI0PJ4y5I8buU4IZGUD5NEt/N7pZNfOyBxkrZkXhS44Fp+xwBH5ebLbq/WY78Bqd
|
30
|
+
db0z6ZgW4LMYMpWFfbXsRbd9TU2f52L8oMAhxOvF7Of5qJMVWuFQ8FPagk2iHrdH
|
31
|
+
inYLQagqAF6goWTXgAJCdPd6SNeeSNqA6vlY7CV1Jh5kfNJJ6xu/CVij1GzCLu/5
|
32
|
+
DMOr26DBv+qLJRRC/2h34uX71q5QgeOyxvMg+7V3u/Q06DXyQ2VgeeqiwDFFpEH0
|
33
|
+
PFkdPO6ZqbTRcLfNH7mFgCBJjsfSjJrn0sPBlYyOXgCoByfZnZyrIMH/UY+lgQqS
|
34
|
+
6Von1VDsfQm0eJh5zYZD64ZF86phSR7mUX3mXItwH04HrZwkWpvgd871DZVR3i1n
|
35
|
+
w8aNA5re5+Rt/Vvjxj5AcEnZnZiz5x959NaddQocX32Z1unHw44pzRNUur1GInfW
|
36
|
+
p4vpx2kUSFSAGjtCbDGTNV2AH8w9OU4xEmNz8c5lyoA=
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
date: 2016-10-05 00:00:00.000000000 Z
|
39
|
+
dependencies:
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: arborist
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
47
|
+
type: :runtime
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: loggability
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '0.11'
|
61
|
+
type: :runtime
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0.11'
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: httpclient
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '2.7'
|
75
|
+
type: :runtime
|
76
|
+
prerelease: false
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '2.7'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: hoe-mercurial
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.4'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '1.4'
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: hoe-deveiate
|
98
|
+
requirement: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0.8'
|
103
|
+
type: :development
|
104
|
+
prerelease: false
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0.8'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: hoe-highline
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0.2'
|
117
|
+
type: :development
|
118
|
+
prerelease: false
|
119
|
+
version_requirements: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0.2'
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: rdoc
|
126
|
+
requirement: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '4.0'
|
131
|
+
type: :development
|
132
|
+
prerelease: false
|
133
|
+
version_requirements: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '4.0'
|
138
|
+
- !ruby/object:Gem::Dependency
|
139
|
+
name: simplecov
|
140
|
+
requirement: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: '0.7'
|
145
|
+
type: :development
|
146
|
+
prerelease: false
|
147
|
+
version_requirements: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - "~>"
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0.7'
|
152
|
+
- !ruby/object:Gem::Dependency
|
153
|
+
name: rdoc-generator-fivefish
|
154
|
+
requirement: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - "~>"
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0.1'
|
159
|
+
type: :development
|
160
|
+
prerelease: false
|
161
|
+
version_requirements: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - "~>"
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0.1'
|
166
|
+
- !ruby/object:Gem::Dependency
|
167
|
+
name: hoe
|
168
|
+
requirement: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - "~>"
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '3.15'
|
173
|
+
type: :development
|
174
|
+
prerelease: false
|
175
|
+
version_requirements: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - "~>"
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '3.15'
|
180
|
+
description: |-
|
181
|
+
This is a collection of webservice monitoring tools for the Arborist monitoring toolkit (http://arbori.st/).
|
182
|
+
|
183
|
+
It can be used to describe and monitor HTTP services in more detail than a simple port check.
|
184
|
+
email:
|
185
|
+
- ged@FaerieMUD.org
|
186
|
+
executables: []
|
187
|
+
extensions: []
|
188
|
+
extra_rdoc_files:
|
189
|
+
- History.md
|
190
|
+
- Manifest.txt
|
191
|
+
- README.md
|
192
|
+
files:
|
193
|
+
- ".document"
|
194
|
+
- ".editorconfig"
|
195
|
+
- ".rdoc_options"
|
196
|
+
- ".simplecov"
|
197
|
+
- ChangeLog
|
198
|
+
- History.md
|
199
|
+
- Manifest.txt
|
200
|
+
- README.md
|
201
|
+
- Rakefile
|
202
|
+
- lib/arborist/monitor/webservice.rb
|
203
|
+
- lib/arborist/node/webservice.rb
|
204
|
+
- lib/arborist/webservice.rb
|
205
|
+
- spec/arborist/node/webservice_spec.rb
|
206
|
+
- spec/spec_helper.rb
|
207
|
+
homepage: http://deveiate.org/projects/arborist-webservice
|
208
|
+
licenses:
|
209
|
+
- BSD-3-Clause
|
210
|
+
metadata: {}
|
211
|
+
post_install_message:
|
212
|
+
rdoc_options:
|
213
|
+
- "--main"
|
214
|
+
- README.md
|
215
|
+
require_paths:
|
216
|
+
- lib
|
217
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - ">="
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
|
+
requirements:
|
224
|
+
- - ">"
|
225
|
+
- !ruby/object:Gem::Version
|
226
|
+
version: 1.3.1
|
227
|
+
requirements: []
|
228
|
+
rubyforge_project:
|
229
|
+
rubygems_version: 2.5.1
|
230
|
+
signing_key:
|
231
|
+
specification_version: 4
|
232
|
+
summary: This is a collection of webservice monitoring tools for the Arborist monitoring
|
233
|
+
toolkit (http://arbori.st/)
|
234
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|