arvicco-avalon 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -39,9 +39,14 @@ Monitor script is periodically polling the mining units and other types of objec
39
39
  ------- ~/.avalon/monitor.yml --------
40
40
  # Prod configuration (default)
41
41
  prod:
42
- :alert_sound: :aiff # :none for silent alerts
43
42
  :alert_after: 2 # missed pings or status reports from a miner
44
43
  :alert_temp: 52 # degrees C and above
44
+ :alert_sounds:
45
+ :failure: Glass.aiff # [] for no sound
46
+ :restart: Frog.aiff # [] for no sound
47
+ :temp_high: Ping.aiff # [] for no sound
48
+ :block_found: [Dog.aiff, Purr.aiff, Dog.aiff] # [] for no sound
49
+ :block_updated: [Purr.aiff, Purr.aiff, Purr.aiff] # [] for no alert sound
45
50
  :bitcoind:
46
51
  :ip: 192.168.1.13
47
52
  :rpcuser: jbond
@@ -27,10 +27,10 @@ module Avalon
27
27
  alarm "Eloipool at #{@ip} not responding to ping"
28
28
  elsif self[:found] > @blocks.size
29
29
  add_new_blocks `ssh #{@ip} "cat solo/logs/pool.log | grep BLKHASH"`
30
- alarm "Eloipool found #{@found} blocks", "Dog.aiff", "Purr.aiff", "Dog.aiff"
30
+ alarm "Eloipool found #{@found} blocks", :block_found
31
31
  elsif @blocks[@blocks.keys.last].pending?
32
32
  update_block @blocks[@blocks.keys.last] do
33
- alarm "Eloipool last block updated", "Purr.aiff", "Purr.aiff", "Purr.aiff"
33
+ alarm "Eloipool last block updated", :block_updated
34
34
  end
35
35
  end
36
36
  end
@@ -96,9 +96,9 @@ module Avalon
96
96
  if self[:mhs] < @min_speed and upminutes > 5
97
97
  alarm "Miner #{num} performance is #{self[:mhs]}, should be #{@min_speed}"
98
98
  elsif self[:temp] >= @alert_temp
99
- alarm "Miner #{num} too hot at #{self[:temp]}C, needs cooling", "Ping.aiff"
99
+ alarm "Miner #{num} too hot at #{self[:temp]}C, needs cooling", :temp_high
100
100
  elsif upminutes < 2
101
- alarm "Miner #{num} restarted", "Frog.aiff"
101
+ alarm "Miner #{num} restarted", :restart
102
102
  end
103
103
  end
104
104
  end
@@ -10,8 +10,10 @@ module Avalon
10
10
  end
11
11
 
12
12
  # Helper method: play a sound file
13
- def play tune
14
- unless Avalon::Config[:alert_sound] == :none
13
+ def play what
14
+ tunes = [Avalon::Config[:alert_sounds][what] || what].compact.flatten
15
+
16
+ tunes.each do |tune|
15
17
  file = find_file( tune, "../../../sound/#{tune}",
16
18
  "~/.avalon/sound/#{tune}", "/System/Library/Sounds/#{tune}")
17
19
  case system
@@ -25,12 +27,9 @@ module Avalon
25
27
  end
26
28
 
27
29
  # Helper method: sound alarm with message
28
- def alarm message, *tunes
30
+ def alarm message, sound=:failure
29
31
  puts message
30
-
31
- tunes.push('Glass.aiff') if tunes.empty?
32
-
33
- tunes.each {|tune| play tune }
32
+ play sound
34
33
  end
35
34
 
36
35
  # Helper method: ping the Node, return ping time in ms
@@ -1,3 +1,3 @@
1
1
  module Avalon
2
- VERSION = "0.0.16"
2
+ VERSION = "0.0.17"
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.16
4
+ version: 0.0.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: