arvicco-avalon 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -6
- data/lib/avalon/miner.rb +17 -4
- data/lib/avalon/monitor.rb +1 -1
- data/lib/avalon/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -4,9 +4,9 @@ Helper scripts for Bitcoin mining units management...
|
|
4
4
|
|
5
5
|
## Description
|
6
6
|
|
7
|
-
Congrats, you've got a few Bitcoin 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
|
7
|
+
Congrats, you've got a few Bitcoin 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 script non-stop and it keeps an eye on your mining units, your (private) pool and your Internet connection, and alerts you in case of any problems. The scripts should work on OSX and Linux. Windows users, just spend $30 on Raspberry Pi, it's so much fun.
|
8
8
|
|
9
|
-
Initially, the scripts were used to manage an installation of Avalon miners, but they work just as well with any cgminer (or bfgminer) based device with known IP address and cgminer API enabled. It's been proven to work on such exotic devices as
|
9
|
+
Initially, the scripts were used to manage an installation of Avalon miners, but they work just as well with any cgminer (or bfgminer) based device with known IP address and cgminer API enabled. It's been proven to work on such exotic devices as RPi attached to Block Eruptor Blades as well as normal computers with FPGA or GPU attached. So, you can easily monitor your mining zoo from one central location.
|
10
10
|
|
11
11
|
## Usage
|
12
12
|
|
@@ -14,11 +14,11 @@ Scripts:
|
|
14
14
|
|
15
15
|
$ monitor [environment]
|
16
16
|
|
17
|
-
|
17
|
+
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).
|
18
18
|
|
19
19
|
$ mtgox_tx
|
20
20
|
|
21
|
-
|
21
|
+
Transcodes raw transaction from base64 (mtgox) to hex (blockchain) format
|
22
22
|
|
23
23
|
## Script Installation
|
24
24
|
|
@@ -35,8 +35,9 @@ Monitor script is periodically polling the mining units and other types of objec
|
|
35
35
|
------- ~/.avalon/monitor.yml --------
|
36
36
|
# Prod configuration (default)
|
37
37
|
prod:
|
38
|
-
:alert_after: 2 # missed pings or status reports from a miner
|
39
38
|
:alert_sound: :aiff # :none for silent alerts
|
39
|
+
:alert_after: 2 # missed pings or status reports from a miner
|
40
|
+
:alert_temp: 52 # degrees C and above
|
40
41
|
:bitcoind:
|
41
42
|
:ip: 192.168.1.13
|
42
43
|
:rpcuser: jbond
|
@@ -57,7 +58,7 @@ The Mining units need to be configured so that monitor is able to poll them. Spe
|
|
57
58
|
Detailed description of cgminer API and relevant startup options can be found here:
|
58
59
|
https://github.com/ckolivas/cgminer/blob/master/API-README
|
59
60
|
|
60
|
-
For any Pool or Bitcoind nodes you'd like to monitor, you need to be able to ssh with public keys (that is, no password required) into this Node, otherwise the Monitor won't be able to poll it. How to make it work is
|
61
|
+
For any Pool or Bitcoind nodes you'd like to monitor, you need to be able to ssh with public keys (that is, no password required) into this Node, otherwise the Monitor won't be able to poll it. How to make it work is beyond the scope of this Readme, just google 'ssh without password'.
|
61
62
|
|
62
63
|
## License
|
63
64
|
|
data/lib/avalon/miner.rb
CHANGED
@@ -16,8 +16,8 @@ module Avalon
|
|
16
16
|
:ping => [8, /./, nil], # not in miner status string...
|
17
17
|
:mhs => [6, /(?<=MHS av=)[\d\.]*/, :i],
|
18
18
|
:uptime => [9, /(?<=Elapsed=)[\d\.]*/, ->(x){ my_time(x, :relative_time)}],
|
19
|
-
:last => [8, /(?<=Last Share Time=
|
20
|
-
->(x){
|
19
|
+
:last => [8, /(?<=Status=Alive,).*?Last Share Time=[\d\.]*/,
|
20
|
+
->(x){ convert_last(x)}],
|
21
21
|
:temp => [5, /(?<=Temperature=)[\d\.]*/, :f],
|
22
22
|
:utility => [7, /(?<=,Utility=)[\d\.]*/, :f],
|
23
23
|
:getworks => [8, /(?<=Getworks=)[\d\.]*/, :i],
|
@@ -29,6 +29,16 @@ module Avalon
|
|
29
29
|
:found => [2, /(?<=Found Blocks=)[\d\.]*/, :i],
|
30
30
|
}
|
31
31
|
|
32
|
+
# Last share converter (Miner-specific)
|
33
|
+
def self.convert_last x
|
34
|
+
y = x[/(?<=Last Share Time=)[\d\.]*/]
|
35
|
+
if y
|
36
|
+
my_time(Time.now.getgm-y.to_i, :relative_time)
|
37
|
+
else
|
38
|
+
"never"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
32
42
|
def self.print_headers
|
33
43
|
puts "\nMiner status as of #{Time.now.getlocal.asctime}:\n# " +
|
34
44
|
FIELDS.map {|name, (width,_,_ )| name.to_s.ljust(width)}.join(' ')
|
@@ -41,6 +51,7 @@ module Avalon
|
|
41
51
|
@fails = 0
|
42
52
|
@alert_after = Avalon::Config[:alert_after] ||
|
43
53
|
Avalon::Config[:status_fails_to_alarm] || 2
|
54
|
+
@alert_temp = Avalon::Config[:alert_temp] || 55
|
44
55
|
super()
|
45
56
|
end
|
46
57
|
|
@@ -53,8 +64,8 @@ module Avalon
|
|
53
64
|
|
54
65
|
status = get_api('summary') + get_api('pools') + get_api('devs')
|
55
66
|
# pools = get_api('pools')
|
67
|
+
# p pools[FIELDS[:last][1]]
|
56
68
|
# devs = get_api('devs')
|
57
|
-
# p pools, pools[FIELDS[:last][1]]
|
58
69
|
# p devs
|
59
70
|
|
60
71
|
data = self.class.extract_data_from(status)
|
@@ -82,8 +93,10 @@ module Avalon
|
|
82
93
|
end
|
83
94
|
else
|
84
95
|
@fails = 0
|
85
|
-
if self[:mhs] < @min_speed
|
96
|
+
if self[:mhs] < @min_speed and upminutes > 5
|
86
97
|
alarm "Miner #{@num} performance is #{self[:mhs]}, should be #{@min_speed}"
|
98
|
+
elsif self[:temp] >= @alert_temp
|
99
|
+
alarm "Miner #{@num} too hot at #{self[:temp]}C, needs cooling", "Ping.aiff"
|
87
100
|
elsif upminutes < 2
|
88
101
|
alarm "Miner #{@num} restarted", "Frog.aiff"
|
89
102
|
end
|
data/lib/avalon/monitor.rb
CHANGED
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.15
|
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-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|