healthety 0.0.1 → 0.0.2
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.
- data/README.md +3 -2
- data/lib/healthety/healthety.rb +1 -1
- data/lib/healthety/transmission.rb +9 -5
- data/lib/healthety/version.rb +1 -1
- data/spec/unit/healthety_spec.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -11,12 +11,13 @@ The Ruby Worker sends JSON data via UDP packets to a given host at a defined int
|
|
11
11
|
require "healthety"
|
12
12
|
|
13
13
|
Healthety.workers do
|
14
|
-
|
14
|
+
server "127.0.0.1"
|
15
15
|
port 8124
|
16
16
|
|
17
17
|
worker :load_average do
|
18
18
|
interval 0.5
|
19
|
-
|
19
|
+
# Get load average with a system call (OS X)
|
20
|
+
value `w | head -n1 | cut -f4 -d":" | cut -f2 -d" "`.to_f
|
20
21
|
end
|
21
22
|
|
22
23
|
worker :memory do
|
data/lib/healthety/healthety.rb
CHANGED
@@ -3,15 +3,19 @@ require "json"
|
|
3
3
|
|
4
4
|
module Healthety
|
5
5
|
class Transmission
|
6
|
-
def initialize(
|
7
|
-
@
|
6
|
+
def initialize(server, port)
|
7
|
+
@server = server
|
8
8
|
@port = port
|
9
|
+
@host = Socket.gethostname
|
9
10
|
@socket = UDPSocket.new
|
10
11
|
end
|
11
12
|
|
12
|
-
def send(name, value)
|
13
|
-
data = {
|
14
|
-
|
13
|
+
def send(name, value, created_at)
|
14
|
+
data = {
|
15
|
+
:name => name, :value => value,
|
16
|
+
:created_at => created_at, :host => @host
|
17
|
+
}.to_json
|
18
|
+
@socket.send(data, 0, @server, @port)
|
15
19
|
$stdout << "#{name}: #{value}\n"
|
16
20
|
end
|
17
21
|
end
|
data/lib/healthety/version.rb
CHANGED
data/spec/unit/healthety_spec.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: healthety
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Martin Jagusch
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-21 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|