riemann-babbler 1.0.2 → 1.0.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.
@@ -0,0 +1,27 @@
1
+ require 'json'
2
+
3
+ class Riemann::Babbler::Nvidia < Riemann::Babbler
4
+
5
+ def init
6
+ plugin.set_default(:service, 'nvidia')
7
+ plugin.set_default(:cmd, '/usr/bin/nvidia-info -j')
8
+ plugin.set_default(:interval, 60)
9
+ plugin.states.set_default(:warning, 70)
10
+ plugin.states.set_default(:critical, 90)
11
+ end
12
+
13
+ def run_plugin
14
+ File.exists? '/usr/bin/nvidia-info'
15
+ end
16
+
17
+
18
+ def collect
19
+ hash = JSON.parse shell(plugin.cmd)
20
+ array = Array.new
21
+ hash.each do |info|
22
+ array << { :service => plugin.service + ' memory usage', :metric => (info['memory_usage']['free'].to_f/info['memory_usage']['total'].to_i) * 100, :description => "GPU memory usage in %" }
23
+ end
24
+ array
25
+ end
26
+
27
+ end
@@ -1,5 +1,5 @@
1
1
  module Riemann
2
2
  class Babbler
3
- VERSION = '1.0.2'
3
+ VERSION = '1.0.3'
4
4
  end
5
5
  end
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.2
4
+ version: 1.0.3
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-05-30 00:00:00.000000000 Z
12
+ date: 2013-06-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: riemann-client
@@ -172,6 +172,7 @@ files:
172
172
  - lib/riemann/babbler/plugins/net.rb
173
173
  - lib/riemann/babbler/plugins/netstat.rb
174
174
  - lib/riemann/babbler/plugins/nginx.rb
175
+ - lib/riemann/babbler/plugins/nvidia.rb
175
176
  - lib/riemann/babbler/plugins/panels.rb
176
177
  - lib/riemann/babbler/plugins/runit.rb
177
178
  - lib/riemann/babbler/plugins/selfupdate.rb