net-fping 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +15 -0
  2. data/README.md +23 -0
  3. data/lib/net/fping.rb +25 -0
  4. data/net-fping.gemspec +18 -0
  5. metadata +48 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YzdmNjRkOGRkYTY3NWY1ZGM1MzJmMGRmZjkyYTYxMWYwMWRlMTkzZA==
5
+ data.tar.gz: !binary |-
6
+ YzgyMTQ5MjM1NWExZjNmYWY5NWY3ZjAxOTZmYjViZTYwYjMyODBlYg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MjM0ODc5M2RlNjQ3M2RjOTY4YjY5MTRlMjUzMDQxZGU5MGRjNDgyMGI3Yjhm
10
+ Y2JmZjhkZTI4NjMyZTY0MzQ4OTVlNmNlOWQ5NDc5ODc2Y2ZlNmY5ZmMwNTU5
11
+ ZTAwY2UxZTQ2MDFjOTkyZjg4YzRiMTNkZjdlNzQ2YTQ4ZTEyYTQ=
12
+ data.tar.gz: !binary |-
13
+ MDYyMDgxOTQ1NTU0YjM2ZDI1ZGQyZGJjYjUxMTkwNDFmZDhmYTNiNzQ1NTkw
14
+ MWZmN2MwMDYwNWMxNWQwNjE2Nzg4MDFhOGQzYzAwMGU4ZWJjNWI2MmJlZTcy
15
+ YmQ0YTk4NDM0ZGMxMTZjYTlhN2IwODQxOTQzMTc5Nzc2M2ZmYmU=
data/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # Net::Fping
2
+
3
+ A ruby gem to interface with fping.
4
+
5
+ ## Usage
6
+
7
+ Pretty straight forward:
8
+
9
+ ```ruby
10
+ require 'net/fping'
11
+
12
+ alive = Fping.alive(["10.0.0.1", "10.0.0.2", "10.0.0.3"])
13
+ > ["10.0.0.1", "10.0.0.3"]
14
+
15
+ alive = Fping.dead(["10.0.0.1", "10.0.0.2", "10.0.0.3"])
16
+ > ["10.0.0.2"]
17
+
18
+ alive = Fping.alive_in_subnet("192.168.0.0/24")
19
+ > ["192.168.0.1", "192.168.0.100", "192.168.0.254"]
20
+
21
+ alive = Fping.alive_in_range("192.168.0.0", "192.168.0.200")
22
+ > ["192.168.0.1", "192.168.0.100"]
23
+ ```
data/lib/net/fping.rb ADDED
@@ -0,0 +1,25 @@
1
+ module Net
2
+ module Fping
3
+ class << self
4
+
5
+ def alive(hosts=[])
6
+ return [] if hosts.empty?
7
+ %x[fping -a #{hosts.join(" ")} 2>/dev/null].split("\n");
8
+ end
9
+
10
+ def dead(hosts=[])
11
+ return [] if hosts.empty?
12
+ %x[fping -u #{hosts.join(" ")} 2>/dev/null].split("\n")
13
+ end
14
+
15
+ def alive_in_subnet(subnet)
16
+ %x[fping -ag #{subnet} 2>/dev/null].split("\n")
17
+ end
18
+
19
+ def alive_in_range(from, to)
20
+ %x[fping -ag #{from} #{to} 2>/dev/null].split("\n")
21
+ end
22
+
23
+ end
24
+ end
25
+ end
data/net-fping.gemspec ADDED
@@ -0,0 +1,18 @@
1
+ #coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "net-fping"
7
+ spec.version = "0.2"
8
+ spec.authors = ["Robert McLeod"]
9
+ spec.email = ["robert@penguinpower.co.nz"]
10
+ spec.description = %q{Net-fping is an fping wrapper that allows fast ping checks on multiple remote hosts}
11
+ spec.summary = %q{fast ping checks using fping}
12
+ spec.homepage = "https://github.com/penguinpowernz/net-fping"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files`.split($/)
16
+ spec.require_paths = ["lib"]
17
+ end
18
+
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: net-fping
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.2'
5
+ platform: ruby
6
+ authors:
7
+ - Robert McLeod
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-12-02 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Net-fping is an fping wrapper that allows fast ping checks on multiple
14
+ remote hosts
15
+ email:
16
+ - robert@penguinpower.co.nz
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - README.md
22
+ - lib/net/fping.rb
23
+ - net-fping.gemspec
24
+ homepage: https://github.com/penguinpowernz/net-fping
25
+ licenses:
26
+ - MIT
27
+ metadata: {}
28
+ post_install_message:
29
+ rdoc_options: []
30
+ require_paths:
31
+ - lib
32
+ required_ruby_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ! '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project:
44
+ rubygems_version: 2.0.5
45
+ signing_key:
46
+ specification_version: 4
47
+ summary: fast ping checks using fping
48
+ test_files: []