network_tester 0.1.6 → 0.1.7
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/.gitignore +2 -0
- data/README.md +19 -12
- data/bin/network_tester +40 -8
- data/lib/network_tester/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3d981a82ffbaed7c2de639e754bf576cc84bd110ea735750a9c74b162d31889e
|
|
4
|
+
data.tar.gz: 34bf36d32fc919dc0b0dbf51e390db420d7bc3607512f1768273bf5fa537fae0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ff0da3b02794ba829b41ac98f646ed30a5faa55c55258c615b99d60c681698352f17e03de7f91973d98a2fd82e1b9c92e54dfa7d27ef536a6a67ef4cc9070636
|
|
7
|
+
data.tar.gz: dbed8732f9f572a905b084aec1f624f0d909f6c3df998c35120cbdfb3419c1fcf4330db78290c98fb762302d9e34282f7954337c6734a8ccda10192a3d155642
|
data/.gitignore
CHANGED
data/README.md
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
# NetworkTester
|
|
2
2
|
|
|
3
|
-
Announces the number of milliseconds it takes for a ping response.
|
|
3
|
+
Announces the number of milliseconds it takes for a ping response. When the ping exceeds a configurable threshold, it alerts you audibly (speech on Mac, terminal bell on Linux).
|
|
4
4
|
|
|
5
5
|
When diagnosing network issues, you may want to plug and unplug ethernet cables to search for a problem. The genesis of this project is I wanted a way to do this without carrying my laptop around and looking at it all the time.
|
|
6
6
|
|
|
7
|
-
On a Mac, the number of milliseconds taken by the ping is
|
|
7
|
+
On a Mac, the number of milliseconds taken by the ping is spoken aloud. On Linux, a terminal bell and text warning are printed when the ping exceeds the threshold.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
|
-
Install it to get the bin file:
|
|
12
|
-
|
|
13
11
|
$ gem install network_tester
|
|
14
12
|
|
|
15
|
-
OR, if you don't have rvm/rbenv installed, you may need to get it this way:
|
|
16
|
-
|
|
17
|
-
$ sudo gem install network_tester
|
|
18
|
-
|
|
19
13
|
Or add this line to your application's Gemfile:
|
|
20
14
|
|
|
21
15
|
```ruby
|
|
@@ -30,7 +24,22 @@ And then execute:
|
|
|
30
24
|
|
|
31
25
|
After installing the gem, you may need to open a new shell, and then type:
|
|
32
26
|
|
|
33
|
-
network_tester [
|
|
27
|
+
network_tester [options]
|
|
28
|
+
network_tester [maxtime] [address]
|
|
29
|
+
|
|
30
|
+
### Options
|
|
31
|
+
|
|
32
|
+
-a, --address ADDRESS Host to ping (default: google.com)
|
|
33
|
+
-m, --maxtime MS Alert threshold in ms (default: 70)
|
|
34
|
+
-h, --help Show help message
|
|
35
|
+
-v, --version Show version
|
|
36
|
+
|
|
37
|
+
### Examples
|
|
38
|
+
|
|
39
|
+
network_tester # ping google.com, alert above 70ms
|
|
40
|
+
network_tester 100 # ping google.com, alert above 100ms
|
|
41
|
+
network_tester 100 8.8.8.8 # ping 8.8.8.8, alert above 100ms
|
|
42
|
+
network_tester -a 8.8.8.8 -m 100 # same, using named options
|
|
34
43
|
|
|
35
44
|
## Development
|
|
36
45
|
|
|
@@ -40,10 +49,8 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
|
40
49
|
|
|
41
50
|
## Contributing
|
|
42
51
|
|
|
43
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
|
44
|
-
|
|
52
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/brianmd/network_tester.
|
|
45
53
|
|
|
46
54
|
## License
|
|
47
55
|
|
|
48
56
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
49
|
-
|
data/bin/network_tester
CHANGED
|
@@ -1,14 +1,46 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
|
-
require
|
|
2
|
+
require "optparse"
|
|
3
|
+
require_relative "../lib/network_tester"
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
options = {
|
|
6
|
+
maxtime: 70,
|
|
7
|
+
address: "google.com"
|
|
8
|
+
}
|
|
5
9
|
|
|
6
|
-
|
|
10
|
+
OptionParser.new do |opts|
|
|
11
|
+
opts.banner = <<~BANNER
|
|
12
|
+
Usage: network_tester [options]
|
|
13
|
+
network_tester [maxtime] [address]
|
|
7
14
|
|
|
8
|
-
|
|
9
|
-
|
|
15
|
+
Examples:
|
|
16
|
+
network_tester # ping google.com, alert above 70ms
|
|
17
|
+
network_tester 100 # ping google.com, alert above 100ms
|
|
18
|
+
network_tester 100 8.8.8.8 # ping 8.8.8.8, alert above 100ms
|
|
10
19
|
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
Options:
|
|
21
|
+
BANNER
|
|
13
22
|
|
|
14
|
-
|
|
23
|
+
opts.on("-a", "--address ADDRESS", "Host to ping (default: google.com)") do |addr|
|
|
24
|
+
options[:address] = addr
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
opts.on("-m", "--maxtime MS", Integer, "Alert threshold in ms (default: 70)") do |ms|
|
|
28
|
+
options[:maxtime] = ms
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
opts.on("-h", "--help", "Show this help message") do
|
|
32
|
+
puts opts
|
|
33
|
+
exit
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
opts.on("-v", "--version", "Show version") do
|
|
37
|
+
puts NetworkTester::VERSION
|
|
38
|
+
exit
|
|
39
|
+
end
|
|
40
|
+
end.parse!
|
|
41
|
+
|
|
42
|
+
# Remaining positional args: [maxtime] [address]
|
|
43
|
+
options[:maxtime] = Integer(ARGV[0]) if ARGV[0]
|
|
44
|
+
options[:address] = ARGV[1] if ARGV[1]
|
|
45
|
+
|
|
46
|
+
NetworkTester.loop(nil, options[:address], options[:maxtime])
|