autosiege 0.0.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.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in autosiege.gemspec
4
+ gemspec
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "autosiege/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "autosiege"
7
+ s.version = Autosiege::VERSION
8
+ s.authors = ["Ben Marini"]
9
+ s.email = ["bmarini@gmail.com"]
10
+ s.homepage = ""
11
+ s.summary = %q{A ruby CLI wrapper to siege}
12
+ s.description = %q{A ruby CLI wrapper to siege}
13
+
14
+ s.rubyforge_project = "autosiege"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ # specify any dependencies here; for example:
22
+ # s.add_development_dependency "rspec"
23
+ # s.add_runtime_dependency "rest-client"
24
+ s.add_runtime_dependency "mixlib-cli", "~> 1.2.2"
25
+ end
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require 'autosiege'
3
+
4
+ Autosiege::CLI.run
@@ -0,0 +1,383 @@
1
+ # Updated by Siege 2.69, July-17-2010
2
+ # Copyright 2000-2007 by Jeffrey Fulmer, et al.
3
+ #
4
+ # Siege configuration file -- edit as necessary
5
+ # For more information about configuring and running
6
+ # this program, visit: http://www.joedog.org/
7
+
8
+ #
9
+ # Variable declarations. You can set variables here
10
+ # for use in the directives below. Example:
11
+ # PROXY = proxy.joedog.org
12
+ # Reference variables inside ${} or $(), example:
13
+ # proxy-host = ${PROXY}
14
+ # You can also reference ENVIRONMENT variables without
15
+ # actually declaring them, example:
16
+ # logfile = $(HOME)/var/siege.log
17
+
18
+ #
19
+ # Signify verbose mode, true turns on verbose output
20
+ # ex: verbose = true|false
21
+ #
22
+ verbose = true
23
+
24
+ #
25
+ # CSV Verbose format: with this option, you can choose
26
+ # to format verbose output in traditional siege format
27
+ # or comma separated format. The latter will allow you
28
+ # to redirect output to a file for import into a spread
29
+ # sheet, i.e., siege > file.csv
30
+ # ex: csv = true|false (default false)
31
+ #
32
+ # csv = true
33
+
34
+ #
35
+ # Full URL verbose format: By default siege displays
36
+ # the URL path and not the full URL. With this option,
37
+ # you # can instruct siege to show the complete URL.
38
+ # ex: fullurl = true|false (default false)
39
+ #
40
+ # fullurl = true
41
+
42
+ #
43
+ # Display id: in verbose mode, display the siege user
44
+ # id associated with the HTTP transaction information
45
+ # ex: display-id = true|false
46
+ #
47
+ # display-id =
48
+
49
+ #
50
+ # Show logfile location. By default, siege displays the
51
+ # logfile location at the end of every run when logging
52
+ # You can turn this message off with this directive.
53
+ # ex: show-logfile = false
54
+ #
55
+ show-logfile = true
56
+
57
+ #
58
+ # Default logging status, true turns logging on.
59
+ # ex: logging = true|false
60
+ #
61
+ logging = true
62
+
63
+ #
64
+ # Logfile, the default siege logfile is $PREFIX/var/siege.log
65
+ # This directive allows you to choose an alternative log file.
66
+ # Environment variables may be used as shown in the examples:
67
+ # ex: logfile = /home/jeff/var/log/siege.log
68
+ # logfile = ${HOME}/var/log/siege.log
69
+ # logfile = ${LOGFILE}
70
+ #
71
+ # logfile =
72
+ logfile = ${SIEGE_LOGFILE}
73
+
74
+ #
75
+ # HTTP protocol. Options HTTP/1.1 and HTTP/1.0.
76
+ # Some webservers have broken implementation of the
77
+ # 1.1 protocol which skews throughput evaluations.
78
+ # If you notice some siege clients hanging for
79
+ # extended periods of time, change this to HTTP/1.0
80
+ # ex: protocol = HTTP/1.1
81
+ # protocol = HTTP/1.0
82
+ #
83
+ protocol = HTTP/1.1
84
+
85
+ #
86
+ # Chunked encoding is required by HTTP/1.1 protocol
87
+ # but siege allows you to turn it off as desired.
88
+ #
89
+ # ex: chunked = true
90
+ #
91
+ chunked = true
92
+
93
+ #
94
+ # Cache revalidation.
95
+ # Siege supports cache revalidation for both ETag and
96
+ # Last-modified headers. If a copy is still fresh, the
97
+ # server responds with 304.
98
+ # HTTP/1.1 200 0.00 secs: 2326 bytes ==> /apache_pb.gif
99
+ # HTTP/1.1 304 0.00 secs: 0 bytes ==> /apache_pb.gif
100
+ # HTTP/1.1 304 0.00 secs: 0 bytes ==> /apache_pb.gif
101
+ #
102
+ # ex: cache = true
103
+ #
104
+ cache = false
105
+
106
+ #
107
+ # Connection directive. Options "close" and "keep-alive"
108
+ # Starting with release 2.57b3, siege implements persistent
109
+ # connections in accordance to RFC 2068 using both chunked
110
+ # encoding and content-length directives to determine the
111
+ # page size. To run siege with persistent connections set
112
+ # the connection directive to keep-alive. (Default close)
113
+ # CAUTION: use the keep-alive directive with care.
114
+ # DOUBLE CAUTION: this directive does not work well on HPUX
115
+ # TRIPLE CAUTION: don't use keep-alives until further notice
116
+ # ex: connection = close
117
+ # connection = keep-alive
118
+ #
119
+ connection = close
120
+
121
+ #
122
+ # Default number of simulated concurrent users
123
+ # ex: concurrent = 25
124
+ #
125
+ concurrent = 15
126
+
127
+ #
128
+ # Default duration of the siege. The right hand argument has
129
+ # a modifier which specifies the time units, H=hours, M=minutes,
130
+ # and S=seconds. If a modifier is not specified, then minutes
131
+ # are assumed.
132
+ # ex: time = 50M
133
+ #
134
+ # time =
135
+
136
+ #
137
+ # Repetitions. The length of siege may be specified in client
138
+ # reps rather then a time duration. Instead of specifying a time
139
+ # span, you can tell each siege instance to hit the server X number
140
+ # of times. So if you chose 'reps = 20' and you've selected 10
141
+ # concurrent users, then siege will hit the server 200 times.
142
+ # ex: reps = 20
143
+ #
144
+ # reps =
145
+
146
+ #
147
+ # Default URLs file, set at configuration time, the default
148
+ # file is PREFIX/etc/urls.txt. So if you configured siege
149
+ # with --prefix=/usr/local then the urls.txt file is installed
150
+ # int /usr/local/etc/urls.txt. Use the "file = " directive to
151
+ # configure an alternative URLs file. You may use environment
152
+ # variables as shown in the examples below:
153
+ # ex: file = /export/home/jdfulmer/MYURLS.txt
154
+ # file = $HOME/etc/urls.txt
155
+ # file = $URLSFILE
156
+ #
157
+ # file =
158
+
159
+ #
160
+ # Default URL, this is a single URL that you want to test. This
161
+ # is usually set at the command line with the -u option. When
162
+ # used, this option overrides the urls.txt (-f FILE/--file=FILE)
163
+ # option. You will HAVE to comment this out for in order to use
164
+ # the urls.txt file option.
165
+ # ex: url = https://shemp.whoohoo.com/docs/index.jsp
166
+ #
167
+ # url =
168
+
169
+ #
170
+ # Default delay value, see the siege(1) man page.
171
+ # This value is used for load testing, it is not used
172
+ # for benchmarking.
173
+ # ex: delay = 3
174
+ #
175
+ delay = 1
176
+
177
+ #
178
+ # Connection timeout value. Set the value in seconds for
179
+ # socket connection timeouts. The default value is 30 seconds.
180
+ # ex: timeout = 30
181
+ #
182
+ # timeout =
183
+
184
+ #
185
+ # Session expiration: This directive allows you to delete all
186
+ # cookies after you pass through the URLs. This means siege will
187
+ # grab a new session with each run through its URLs. The default
188
+ # value is false.
189
+ # ex: expire-session = true
190
+ #
191
+ # expire-session =
192
+
193
+ #
194
+ # Failures: This is the number of total connection failures allowed
195
+ # before siege aborts. Connection failures (timeouts, socket failures,
196
+ # etc.) are combined with 400 and 500 level errors in the final stats,
197
+ # but those errors do not count against the abort total. If you set
198
+ # this total to 10, then siege will abort after ten socket timeouts,
199
+ # but it will NOT abort after ten 404s. This is designed to prevent
200
+ # a run-away mess on an unattended siege. The default value is 1024
201
+ # ex: failures = 50
202
+ #
203
+ # failures =
204
+
205
+ #
206
+ # Internet simulation. If true, siege clients will hit
207
+ # the URLs in the urls.txt file randomly, thereby simulating
208
+ # internet usage. If false, siege will run through the
209
+ # urls.txt file in order from first to last and back again.
210
+ # ex: internet = true
211
+ #
212
+ internet = false
213
+
214
+ #
215
+ # Default benchmarking value, If true, there is NO delay
216
+ # between server requests, siege runs as fast as the web
217
+ # server and the network will let it. Set this to false
218
+ # for load testing.
219
+ # ex: benchmark = true
220
+ #
221
+ benchmark = false
222
+
223
+ #
224
+ # Set the siege User-Agent to identify yourself at the
225
+ # host, the default is: JoeDog/1.00 [en] (X11; I; Siege #.##)
226
+ # But that wreaks of corporate techno speak. Feel free
227
+ # to make it more interesting :-) Since Limey is recovering
228
+ # from minor surgery as I write this, I'll dedicate the
229
+ # example to him...
230
+ # ex: user-agent = Limey The Bulldog
231
+ #
232
+ # user-agent =
233
+
234
+ #
235
+ # Accept-encoding. This option allows you to specify
236
+ # acceptable encodings returned by the server. Use this
237
+ # directive to turn on compression. By default we accept
238
+ # gzip compression.
239
+ #
240
+ # ex: accept-encoding = *
241
+ # accept-encoding = gzip
242
+ # accept-encoding = compress;q=0.5;gzip;q=1
243
+ accept-encoding = gzip
244
+
245
+ #
246
+ # TURN OFF THAT ANNOYING SPINNER!
247
+ # Siege spawns a thread and runs a spinner to entertain you
248
+ # as it collects and computes its stats. If you don't like
249
+ # this feature, you may turn it off here.
250
+ # ex: spinner = false
251
+ #
252
+ spinner = true
253
+
254
+ #
255
+ # WWW-Authenticate login. When siege hits a webpage
256
+ # that requires basic authentication, it will search its
257
+ # logins for authentication which matches the specific realm
258
+ # requested by the server. If it finds a match, it will send
259
+ # that login information. If it fails to match the realm, it
260
+ # will send the default login information. (Default is "all").
261
+ # You may configure siege with several logins as long as no
262
+ # two realms match. The format for logins is:
263
+ # username:password[:realm] where "realm" is optional.
264
+ # If you do not supply a realm, then it will default to "all"
265
+ # ex: login = jdfulmer:topsecret:Admin
266
+ # login = jeff:supersecret
267
+ #
268
+ # login =
269
+
270
+ #
271
+ # WWW-Authenticate username and password. When siege
272
+ # hits a webpage that requires authentication, it will
273
+ # send this user name and password to the server. Note
274
+ # this is NOT form based authentication. You will have
275
+ # to construct URLs for that.
276
+ # ex: username = jdfulmer
277
+ # password = whoohoo
278
+ #
279
+ # username =
280
+ # password =
281
+
282
+ #
283
+ # ssl-cert
284
+ # This optional feature allows you to specify a path to a client
285
+ # certificate. It is not neccessary to specify a certificate in
286
+ # order to use https. If you don't know why you would want one,
287
+ # then you probably don't need this feature. Use openssl to
288
+ # generate a certificate and key with the following command:
289
+ # $ openssl req -nodes -new -days 365 -newkey rsa:1024 \
290
+ # -keyout key.pem -out cert.pem
291
+ # Specify a path to cert.pem as follows:
292
+ # ex: ssl-cert = /home/jeff/.certs/cert.pem
293
+ #
294
+ # ssl-cert =
295
+
296
+ #
297
+ # ssl-key
298
+ # Use this option to specify the key you generated with the command
299
+ # above. ex: ssl-key = /home/jeff/.certs/key.pem
300
+ # You may actually skip this option and combine both your cert and
301
+ # your key in a single file:
302
+ # $ cat key.pem > client.pem
303
+ # $ cat cert.pem >> client.pem
304
+ # Now set the path for ssl-cert:
305
+ # ex: ssl-cert = /home/jeff/.certs/client.pem
306
+ # (in this scenario, you comment out ssl-key)
307
+ #
308
+ # ssl-key =
309
+
310
+ #
311
+ # ssl-timeout
312
+ # This option sets a connection timeout for the ssl library
313
+ # ex: ssl-timeout = 30
314
+ #
315
+ # ssl-timeout =
316
+
317
+ #
318
+ # ssl-ciphers
319
+ # You can use this feature to select a specific ssl cipher
320
+ # for HTTPs. To view the ones available with your library run
321
+ # the following command: openssl ciphers
322
+ # ex: ssl-ciphers = EXP-RC4-MD5
323
+ #
324
+ # ssl-ciphers =
325
+
326
+ #
327
+ # Login URL. This is the first URL to be hit by every siege
328
+ # client. This feature was designed to allow you to login to
329
+ # a server and establish a session. It will only be hit once
330
+ # so if you need to hit this URL more then once, make sure it
331
+ # also appears in your urls.txt file.
332
+ #
333
+ # ex: login-url = http://eos.haha.com/login.jsp POST name=jeff&pass=foo
334
+ #
335
+ # login-url =
336
+
337
+ #
338
+ # Proxy protocol. This option allows you to select a proxy
339
+ # server stress testing. The proxy will request the URL(s)
340
+ # specified by -u"my.url.org" OR from the urls.txt file.
341
+ #
342
+ # ex: proxy-host = proxy.whoohoo.org
343
+ # proxy-port = 8080
344
+ #
345
+ # proxy-host =
346
+ # proxy-port =
347
+
348
+ #
349
+ # Proxy-Authenticate. When scout hits a proxy server which
350
+ # requires username and password authentication, it will this
351
+ # username and password to the server. The format is username,
352
+ # password and optional realm each separated by a colon. You
353
+ # may enter more than one proxy-login as long as each one has
354
+ # a different realm. If you do not enter a realm, then scout
355
+ # will send that login information to all proxy challenges. If
356
+ # you have more than one proxy-login, then scout will attempt
357
+ # to match the login to the realm.
358
+ # ex: proxy-login: jeff:secret:corporate
359
+ # proxy-login: jeff:whoohoo
360
+ #
361
+ # proxy-login =
362
+
363
+ #
364
+ # Redirection support. This option allows to to control
365
+ # whether a Location: hint will be followed. Most users
366
+ # will want to follow redirection information, but sometimes
367
+ # it's desired to just get the Location information.
368
+ #
369
+ # ex: follow-location = false
370
+ #
371
+ # follow-location =
372
+
373
+ # Zero-length data. siege can be configured to disregard
374
+ # results in which zero bytes are read after the headers.
375
+ # Alternatively, such results can be counted in the final
376
+ # tally of outcomes.
377
+ #
378
+ # ex: zero-data-ok = false
379
+ #
380
+ # zero-data-ok =
381
+
382
+ #
383
+ # end of siegerc
@@ -0,0 +1,3 @@
1
+ # Put urls in this file, for example:
2
+ # http://example.com
3
+ # http://example.com POST key1=val&key2=val
@@ -0,0 +1,5 @@
1
+ require "autosiege/version"
2
+
3
+ module Autosiege
4
+ autoload :CLI, 'autosiege/cli'
5
+ end
@@ -0,0 +1,74 @@
1
+ require 'mixlib/cli'
2
+
3
+ module Autosiege
4
+ class CLI
5
+ include Mixlib::CLI
6
+
7
+ option :setup,
8
+ :short => "-s",
9
+ :long => "--setup",
10
+ :boolean => true,
11
+ :description => "Copy example configuration files to default locations"
12
+
13
+ option :config_file,
14
+ :short => "-c CONFIG",
15
+ :long => "--config CONFIG",
16
+ :default => 'config/siege/siegerc',
17
+ :description => "The siege configuration file to use (default: ./config/siege/siegerc)"
18
+
19
+ option :urls_file,
20
+ :short => "-u URLSFILE",
21
+ :long => "--urls URLSFILE",
22
+ :default => 'config/siege/urls.txt',
23
+ :description => "The urls file to use (default: ./config/siege/urls.txt)"
24
+
25
+ option :log_file,
26
+ :short => "-l LOGFILE",
27
+ :long => "--log LOGFILE",
28
+ :description => "The log file location (default: ./log/siege.log)",
29
+ :default => 'log/siege.log'
30
+
31
+ option :help,
32
+ :short => "-h",
33
+ :long => "--help",
34
+ :description => "Show this message",
35
+ :on => :tail,
36
+ :boolean => true,
37
+ :show_options => true,
38
+ :exit => 0
39
+
40
+ def self.run
41
+ cli = new
42
+ begin
43
+ cli.parse_options
44
+ rescue OptionParser::InvalidOption
45
+ puts cli.opt_parser
46
+ exit 1
47
+ end
48
+
49
+ cli.run
50
+ end
51
+
52
+ def run
53
+ if config[:setup]
54
+ setup
55
+ exit 0
56
+ else
57
+ ENV['SIEGE_LOGFILE'] = config[:logfile]
58
+ system "siege --concurrent=25 --internet --time 1m --reps=1 --rc=#{config[:urls_file]} --log --file=#{config[:config_file]}"
59
+ end
60
+ end
61
+
62
+ def setup
63
+ system "mkdir -p config/siege"
64
+ system "mkdir -p log"
65
+
66
+ siegefile = File.expand_path("../../../conf/siegerc", __FILE__)
67
+ system "cp #{siegefile} config/siege/siegerc"
68
+
69
+ urlsfile = File.expand_path("../../../conf/urls.txt", __FILE__)
70
+ system "cp #{urlsfile} config/siege/urls.txt"
71
+ end
72
+ end
73
+ end
74
+
@@ -0,0 +1,3 @@
1
+ module Autosiege
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,92 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: autosiege
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Ben Marini
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-10-24 00:00:00 -07:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: mixlib-cli
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ hash: 27
30
+ segments:
31
+ - 1
32
+ - 2
33
+ - 2
34
+ version: 1.2.2
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: A ruby CLI wrapper to siege
38
+ email:
39
+ - bmarini@gmail.com
40
+ executables:
41
+ - autosiege
42
+ extensions: []
43
+
44
+ extra_rdoc_files: []
45
+
46
+ files:
47
+ - .gitignore
48
+ - Gemfile
49
+ - Rakefile
50
+ - autosiege.gemspec
51
+ - bin/autosiege
52
+ - conf/siegerc
53
+ - conf/urls.txt
54
+ - lib/autosiege.rb
55
+ - lib/autosiege/cli.rb
56
+ - lib/autosiege/version.rb
57
+ has_rdoc: true
58
+ homepage: ""
59
+ licenses: []
60
+
61
+ post_install_message:
62
+ rdoc_options: []
63
+
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
74
+ version: "0"
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ hash: 3
81
+ segments:
82
+ - 0
83
+ version: "0"
84
+ requirements: []
85
+
86
+ rubyforge_project: autosiege
87
+ rubygems_version: 1.6.2
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: A ruby CLI wrapper to siege
91
+ test_files: []
92
+