arvicco-avalon 0.0.10 → 0.0.11

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 CHANGED
@@ -33,7 +33,7 @@ Sample monitor config file for production environment below. Modify it, add your
33
33
  ------- ~/.avalon/monitor.yml --------
34
34
  # Prod configuration (default)
35
35
  prod:
36
- :status_fails_to_alarm: 2
36
+ :alert_after: 2 # missed pings or status reports from a miner
37
37
  :bitcoind:
38
38
  :ip: 192.168.1.13
39
39
  :rpcuser: jbond
data/lib/avalon/config.rb CHANGED
@@ -6,7 +6,7 @@ module Avalon
6
6
  def self.load env
7
7
  config_file = find_file( '../../../config/monitor.yml', '~/.avalon/monitor.yml')
8
8
 
9
- raise "No config file: #{config_file}" unless File.exist? config_file
9
+ raise "No config file: ~/.avalon/monitor.yml" unless File.exist? config_file
10
10
 
11
11
  @config = YAML::load_file(config_file)[env]
12
12
  @config[:environment] = env
@@ -1,8 +1,6 @@
1
1
  module Avalon
2
2
 
3
3
  # Mix-in for extraction of properties from a given input String or Hash
4
- # Depeds on #fields method hook in the host class to enumerate property fields,
5
- # in the format: {:name => [width, pattern, type/conversion]}
6
4
  module Extractable
7
5
 
8
6
  # type = :absolute_time | :absolute_date | :relative_time
@@ -49,4 +47,4 @@ module Avalon
49
47
  end
50
48
 
51
49
  end
52
- end
50
+ end
data/lib/avalon/miner.rb CHANGED
@@ -15,11 +15,10 @@ module Avalon
15
15
  FIELDS = {
16
16
  :ping => [8, /./, nil], # not in miner status string...
17
17
  :mhs => [6, /(?<=MHS av=)[\d\.]*/, :i],
18
- # :uptime => [6, /(?<=Elapsed=)[\d\.]*/, ->(x){ (x.to_i/60.0/60.0).round(2)}],
19
18
  :uptime => [8, /(?<=Elapsed=)[\d\.]*/, ->(x){ my_time(x, :relative_time)}],
20
19
  :last => [8, /(?<=Last Share Time=)[\d\.]*/,
21
20
  ->(x){ my_time(Time.now.getgm-x.to_i, :relative_time)}],
22
- # ->(x){ my_time(Time.now-Time.at(x.to_i), :relative_time)}],
21
+ :temp => [5, /(?<=Temperature=)[\d\.]*/, :f],
23
22
  :utility => [7, /(?<=,Utility=)[\d\.]*/, :f],
24
23
  :getworks => [8, /(?<=Getworks=)[\d\.]*/, :i],
25
24
  :accepted => [8, /(?<=,Accepted=)[\d\.]*/, :i],
@@ -40,7 +39,8 @@ module Avalon
40
39
  @num = ip.split('.').last.to_i
41
40
  @min_speed = min_speed * 1000 # Gh/s to Mh/s
42
41
  @fails = 0
43
- @status_fails_to_alarm = Avalon::Config[:status_fails_to_alarm] || 2
42
+ @alert_after = Avalon::Config[:alert_after] ||
43
+ Avalon::Config[:status_fails_to_alarm] || 2
44
44
  super()
45
45
  end
46
46
 
@@ -51,7 +51,12 @@ module Avalon
51
51
  def poll verbose=true
52
52
  self[:ping] = ping @ip
53
53
 
54
- status = get_api('summary') + get_api('pools')
54
+ status = get_api('summary') + get_api('pools') + get_api('devs')
55
+ # pools = get_api('pools')
56
+ # devs = get_api('devs')
57
+ # p pools, pools[FIELDS[:last][1]]
58
+ # p devs
59
+
55
60
  data = self.class.extract_data_from(status)
56
61
 
57
62
  if data.empty?
@@ -72,7 +77,7 @@ module Avalon
72
77
  def report
73
78
  if data[:ping].nil?
74
79
  @fails += 1
75
- if @fails >= @status_fails_to_alarm
80
+ if @fails >= @alert_after
76
81
  alarm "Miner #{@num} did not respond to status query"
77
82
  end
78
83
  else
@@ -1,3 +1,3 @@
1
1
  module Avalon
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
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.10
4
+ version: 0.0.11
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-07 00:00:00.000000000 Z
12
+ date: 2013-06-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday