riemann-babbler 1.0.5.4 → 1.0.5.5
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 +10 -0
- data/lib/riemann/version.rb +1 -1
- metadata +1 -1
@@ -7,9 +7,16 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
require 'json'
|
10
|
+
require 'socket'
|
10
11
|
|
11
12
|
class Riemann::Babbler::Uplay < Riemann::Babbler
|
12
13
|
|
14
|
+
def myip
|
15
|
+
ip = Socket.ip_address_list.detect{|intf| intf.ipv4_private?}
|
16
|
+
myip = ip.ip_address if ip
|
17
|
+
myip || '127.0.0.1'
|
18
|
+
end
|
19
|
+
|
13
20
|
def init
|
14
21
|
plugin.set_default(:service, 'uplay')
|
15
22
|
plugin.set_default(:file, '/var/run/status.json')
|
@@ -28,6 +35,9 @@ class Riemann::Babbler::Uplay < Riemann::Babbler
|
|
28
35
|
array = Array.new
|
29
36
|
status = JSON.parse File.read(plugin.file)
|
30
37
|
|
38
|
+
# "myip" - ip шник машинки
|
39
|
+
array << { :service => plugin.service + ' ipaddress', :description => "ipaddress: #{myip}", :metric => 0, :state => 'ok' }
|
40
|
+
|
31
41
|
# "status_update_ts" - время последнего обновления содержимого статусного файла в unix-timestamp
|
32
42
|
if now - status['status_update_ts'] > plugin.statuses.status_update_ts
|
33
43
|
array << { :service => plugin.service + ' status_update_ts', :description => 'update status very old', :metric => now - status['status_update_ts'], :state => 'critical' }
|
data/lib/riemann/version.rb
CHANGED