arvicco-avalon 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +17 -5
- data/lib/avalon/config.rb +6 -4
- data/lib/avalon/eloipool.rb +1 -1
- data/lib/avalon/miner.rb +2 -1
- data/lib/avalon/utils.rb +6 -5
- data/lib/avalon/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -2,23 +2,35 @@
|
|
2
2
|
|
3
3
|
Helper scripts for Bitcoin and Avalon miners management...
|
4
4
|
|
5
|
+
## Description
|
6
|
+
|
7
|
+
Congrats, you've got a few Avalon miners. It's all nice and dandy, but now you need to keep an eye on them to make sure they are always online and their valuable hashes are not wasted. This set of scripts is written to do just that. You run a monitor scipt non-stop and it keeps an eye on your Avalons, your (private) pool and your Internet connection, and alerts you as soon as there are any problems. The scripts should work on OSX and Linux (Windows users, move on).
|
8
|
+
|
5
9
|
## Usage
|
6
10
|
|
7
11
|
Scripts:
|
8
12
|
|
9
|
-
$
|
13
|
+
$ monitor [environment]
|
10
14
|
|
11
|
-
- Monitors all the nodes (miners, pools, Internet connections) that are listed in config/monitor.yml file. Sounds alarm is anything is wrong with the monitored nodes. TODO: takes action to correct errors found (like restarting the miners etc).
|
15
|
+
- Monitors all the nodes (miners, pools, Internet connections) that are listed in config/monitor.yml file. Sounds alarm is anything is wrong with the monitored nodes. TODO: takes action to correct errors found (like restarting the failing miners etc).
|
12
16
|
|
13
|
-
$ mtgox_tx
|
17
|
+
$ mtgox_tx
|
14
18
|
|
15
19
|
- Transcodes raw transaction from base64 (mtgox) to hex (blockchain) format
|
16
20
|
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
You need Ruby 1.9 to install the scripts. Once the Ruby is installed, it's just:
|
24
|
+
|
25
|
+
$ gem install arvicco-avalon
|
26
|
+
|
27
|
+
You need to be able to ssh with public keys (that is no password required) into any Pool or Bitcoind node for monitor to work. How to do it is beyound the scope of this Readme, just google it. You also need to create ~/.avalon/monitor.yml config file, see below.
|
28
|
+
|
17
29
|
## Configuration
|
18
30
|
|
19
|
-
Sample monitor config file for production environment below. Modify it, add your own nodes to be monitored (for Avalon miners, you have to
|
31
|
+
Sample monitor config file for production environment below. Modify it, add your own nodes to be monitored (for Avalon miners, you have to indicate their IP address and min hashrate in Gh/s):
|
20
32
|
|
21
|
-
-------
|
33
|
+
------- ~/.avalon/monitor.yml --------
|
22
34
|
# Prod configuration (default)
|
23
35
|
prod:
|
24
36
|
:bitcoind:
|
data/lib/avalon/config.rb
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
module Avalon
|
2
2
|
# Global Config
|
3
3
|
class Config
|
4
|
+
extend Utils # Helper methods
|
4
5
|
|
5
6
|
def self.load env
|
6
|
-
config_file =
|
7
|
-
File.expand_path('../../../config/monitor.yml', __FILE__),
|
8
|
-
File.expand_path('~/.avalon/monitor.yml', __FILE__),
|
9
|
-
].find {|f| File.exist?(f)}
|
7
|
+
config_file = find_file( '../../../config/monitor.yml', '~/.avalon/monitor.yml')
|
10
8
|
|
11
9
|
raise "No config file: #{config_file}" unless File.exist? config_file
|
12
10
|
|
13
11
|
@config = YAML::load_file(config_file)[env]
|
12
|
+
@config[:environment] = env
|
13
|
+
@config[:block_file] = find_file( '../../../config/blocks.yml',
|
14
|
+
'~/.avalon/blocks.yml') || '~/.avalon/blocks.yml'
|
15
|
+
|
14
16
|
end
|
15
17
|
|
16
18
|
def self.[] key
|
data/lib/avalon/eloipool.rb
CHANGED
data/lib/avalon/miner.rb
CHANGED
@@ -40,6 +40,7 @@ module Avalon
|
|
40
40
|
@num = ip.split('.').last.to_i
|
41
41
|
@min_speed = min_speed * 1000 # Gh/s to Mh/s
|
42
42
|
@fails = 0
|
43
|
+
@status_fails_to_alarm = Avalon::Config[:status_fails_to_alarm]
|
43
44
|
super()
|
44
45
|
end
|
45
46
|
|
@@ -71,7 +72,7 @@ module Avalon
|
|
71
72
|
def report
|
72
73
|
if data[:ping].nil?
|
73
74
|
@fails += 1
|
74
|
-
if @fails >=
|
75
|
+
if @fails >= @status_fails_to_alarm || 1
|
75
76
|
alarm "Miner #{@num} did not respond to status query"
|
76
77
|
end
|
77
78
|
else
|
data/lib/avalon/utils.rb
CHANGED
@@ -5,13 +5,14 @@ module Avalon
|
|
5
5
|
@system = `uname -a`.match(/^\w*/).to_s
|
6
6
|
end
|
7
7
|
|
8
|
+
def find_file *locations
|
9
|
+
locations.map {|loc| File.expand_path(loc,__FILE__)}.find {|f| File.exist?(f)}
|
10
|
+
end
|
11
|
+
|
8
12
|
# Helper method: play a sound file
|
9
13
|
def play tune
|
10
|
-
file =
|
11
|
-
|
12
|
-
File.expand_path("~/sound/#{tune}", __FILE__),
|
13
|
-
File.expand_path("/System/Library/Sounds/#{tune}"),
|
14
|
-
].find {|f| File.exist?(f)}
|
14
|
+
file = find_file( tune, "../../../sound/#{tune}",
|
15
|
+
"~/.avalon/sound/#{tune}", "/System/Library/Sounds/#{tune}")
|
15
16
|
|
16
17
|
case system
|
17
18
|
when 'Darwin'
|
data/lib/avalon/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arvicco-avalon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|