riemann-babbler 1.0.5.2 → 1.0.5.3
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/lib/riemann/babbler/plugins/uplay.rb +57 -0
- data/lib/riemann/version.rb +1 -1
- metadata +2 -1
@@ -0,0 +1,57 @@
|
|
1
|
+
# играет заставку или нормальное видео
|
2
|
+
# давно ли играет видео
|
3
|
+
# аптайм приложение
|
4
|
+
|
5
|
+
# "player_state":"Dummy", но при этом с rendg есть соединение
|
6
|
+
# "player_state":"Stream SPIF2" -
|
7
|
+
|
8
|
+
|
9
|
+
require 'json'
|
10
|
+
|
11
|
+
class Riemann::Babbler::Uplay < Riemann::Babbler
|
12
|
+
|
13
|
+
def init
|
14
|
+
plugin.set_default(:service, 'uplay')
|
15
|
+
plugin.set_default(:file, '/var/run/status.json')
|
16
|
+
plugin.statuses.set_default(:status_update_ts, 100)
|
17
|
+
plugin.statuses.set_default(:application_uptime, 100)
|
18
|
+
plugin.set_default(:interval, 60)
|
19
|
+
end
|
20
|
+
|
21
|
+
def run_plugin
|
22
|
+
File.exists? plugin.file
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
def collect
|
27
|
+
now = Time.now.to_i
|
28
|
+
array = Array.new
|
29
|
+
status = JSON.parse File.read(plugin.file)
|
30
|
+
|
31
|
+
# "status_update_ts" - время последнего обновления содержимого статусного файла в unix-timestamp
|
32
|
+
if now - status['status_update_ts'] > plugin.statuses.status_update_ts
|
33
|
+
array << { :service => plugin.service + ' status_update_ts', :description => 'update status very old', :metric => now - status['status_update_ts'], :state => 'critical' }
|
34
|
+
else
|
35
|
+
array << { :service => plugin.service + ' status_update_ts', :description => 'update status time ok', :metric => now - status['status_update_ts'], :state => 'ok' }
|
36
|
+
end
|
37
|
+
|
38
|
+
# "application_uptime" - время работы приложения, в секундах
|
39
|
+
if now - status['application_uptime'] < plugin.statuses.application_uptime
|
40
|
+
array << { :service => plugin.service + ' application_uptime', :description => "application uptime: (#{status['application_uptime']}) is very small", :metric => now - status['application_uptime'], :state => 'critical' }
|
41
|
+
else
|
42
|
+
array << { :service => plugin.service + ' application_uptime', :description => 'application uptime ok', :metric => now - status['application_uptime'], :state => 'ok' }
|
43
|
+
end
|
44
|
+
|
45
|
+
# "enough_decoded_frames" - достаточно ли фреймов успевает проходить через декодер (когда true, декодер не справляется), true/false
|
46
|
+
unless status['enough_decoded_frames']
|
47
|
+
array << { :service => plugin.service + ' enough_decoded_frames', :description => 'status enough_decoded_frames ok', :metric => 0, :state => 'ok' }
|
48
|
+
else
|
49
|
+
array << { :service => plugin.service + ' enough_decoded_frames', :description => 'Uplay not cope with the load', :metric => 1, :state => 'critical' }
|
50
|
+
end
|
51
|
+
|
52
|
+
array << { :service => plugin.service + ' player_state', :description => "current player state: #{status['player_state']}", :metric => 0, :state => 'ok' }
|
53
|
+
|
54
|
+
array
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
data/lib/riemann/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riemann-babbler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.5.
|
4
|
+
version: 1.0.5.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -178,6 +178,7 @@ files:
|
|
178
178
|
- lib/riemann/babbler/plugins/panels.rb
|
179
179
|
- lib/riemann/babbler/plugins/runit.rb
|
180
180
|
- lib/riemann/babbler/plugins/selfupdate.rb
|
181
|
+
- lib/riemann/babbler/plugins/uplay.rb
|
181
182
|
- lib/riemann/babbler/support/deep_merge.rb
|
182
183
|
- lib/riemann/babbler/support/monkey_patches.rb
|
183
184
|
- lib/riemann/babbler/support/plugin_helpers.rb
|