riemann-babbler 0.8.2 → 0.8.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.
@@ -68,11 +68,13 @@ module Riemann
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def get_hostname
|
71
|
+
# разбор fqdn
|
71
72
|
if options.riemann.use_fqdn.nil? || options.riemann.use_fqdn == false
|
72
73
|
hostname = File.read('/proc/sys/kernel/hostname').strip.downcase
|
73
74
|
else
|
74
75
|
hostname = Socket.gethostbyname(Socket.gethostname).first
|
75
76
|
end
|
77
|
+
# разбор инсталяции
|
76
78
|
if options.riemann.installation.nil?
|
77
79
|
hostname += options.riemann.suffix unless options.riemann.suffix.nil?
|
78
80
|
else
|
@@ -1,7 +1,9 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
1
3
|
class Riemann::Babbler::Cpu < Riemann::Babbler
|
2
4
|
|
3
5
|
def desc
|
4
|
-
"usage\n\n#{shell('ps -eo pcpu,pid,cmd
|
6
|
+
"usage\n\n#{shell('ps -eo pcpu,pid,cmd --sort -pcpu | head -10').chomp}"
|
5
7
|
end
|
6
8
|
|
7
9
|
def init
|
@@ -30,7 +32,7 @@ class Riemann::Babbler::Cpu < Riemann::Babbler
|
|
30
32
|
end
|
31
33
|
|
32
34
|
@old_cpu[cpu_number] = [u2, n2, s2, i2]
|
33
|
-
array << { :service => plugin.service + " cpu#{cpu_number}", :metric => fraction, :description => description } if fraction
|
35
|
+
array << { :service => plugin.service + " cpu#{cpu_number}", :metric => fraction, :description => "Утилизация cpu#{cpu_number} \n\n" + description } if fraction
|
34
36
|
end
|
35
37
|
array
|
36
38
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
1
3
|
class Riemann::Babbler::Disk < Riemann::Babbler
|
2
4
|
|
3
5
|
require 'sys/filesystem'
|
@@ -26,10 +28,10 @@ class Riemann::Babbler::Disk < Riemann::Babbler
|
|
26
28
|
point_stat = Filesystem.stat point
|
27
29
|
human_point = point == "/" ? "/root" : point
|
28
30
|
human_point.gsub!(/^\//, "").gsub!(/\//, "_")
|
29
|
-
disk << { :service => plugin.service + " #{human_point} % block", :metric => (1- point_stat.blocks_available.to_f/point_stat.blocks).round(2) * 100 }
|
30
|
-
disk << { :service => plugin.service + " #{human_point} % inode", :metric => (1 - point_stat.files_available.to_f/point_stat.files).round(2) * 100 }
|
31
|
-
disk << { :service => plugin.service + " #{human_point} abs free", :metric => point_stat.blocks_free * point_stat.block_size, :state => 'ok'}
|
32
|
-
disk << { :service => plugin.service + " #{human_point} abs total", :metric => point_stat.blocks * point_stat.block_size, :state => 'ok'}
|
31
|
+
disk << { :service => plugin.service + " #{human_point} % block", :description => "Процент утилизации: #{point_stat}", :metric => (1- point_stat.blocks_available.to_f/point_stat.blocks).round(2) * 100 }
|
32
|
+
disk << { :service => plugin.service + " #{human_point} % inode", :description => "Процент утилизации inode: #{point_stat}", :metric => (1 - point_stat.files_available.to_f/point_stat.files).round(2) * 100 }
|
33
|
+
disk << { :service => plugin.service + " #{human_point} abs free", :description => "Всего диск (b): #{point_stat}", :metric => point_stat.blocks_free * point_stat.block_size, :state => 'ok'}
|
34
|
+
disk << { :service => plugin.service + " #{human_point} abs total", :description => "Утилизация диск (b): #{point_stat}", :metric => point_stat.blocks * point_stat.block_size, :state => 'ok'}
|
33
35
|
end
|
34
36
|
disk
|
35
37
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
1
3
|
class Riemann::Babbler::La < Riemann::Babbler
|
2
4
|
|
3
5
|
def collect
|
4
|
-
{ :service => plugin.service + " la_1", :metric => File.read('/proc/loadavg').split(/\s+/)[2].to_f }
|
6
|
+
{ :service => plugin.service + " la_1", :description => "LA усредненный по минуте", :metric => File.read('/proc/loadavg').split(/\s+/)[2].to_f }
|
5
7
|
end
|
6
8
|
|
7
9
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
|
1
3
|
class Riemann::Babbler::Memory < Riemann::Babbler
|
2
4
|
|
3
5
|
def collect
|
@@ -16,17 +18,17 @@ class Riemann::Babbler::Memory < Riemann::Babbler
|
|
16
18
|
fraction = 1 - (free_bc.to_f / total)
|
17
19
|
swap_fraction = m['SwapTotal'] == 0 ? 0 : 1 - m['SwapFree'].to_f/m['SwapTotal']
|
18
20
|
|
19
|
-
desc = "usage\n\n#{shell('ps -eo
|
21
|
+
desc = "usage\n\n#{shell('ps -eo pcpu,pid,cmd --sort -pmem | head -10').chomp}"
|
20
22
|
|
21
23
|
[
|
22
|
-
{ :service => plugin.service + " % free", :metric => fraction.round(2) * 100 },
|
23
|
-
{ :service => plugin.service + " % swap", :metric => swap_fraction.round(2) * 100 },
|
24
|
-
{ :service => plugin.service + " abs free", :metric => free, :state => 'ok', :description => desc },
|
25
|
-
{ :service => plugin.service + " abs total", :metric => total, :state => 'ok', :description => desc },
|
26
|
-
{ :service => plugin.service + " abs cached", :metric => cached, :state => 'ok', :description => desc },
|
27
|
-
{ :service => plugin.service + " abs buffers", :metric => buffers, :state => 'ok', :description => desc },
|
28
|
-
{ :service => plugin.service + " abs used", :metric => used , :state => 'ok', :description => desc },
|
29
|
-
{ :service => plugin.service + " abs free_bc", :metric => free_bc , :state => 'ok', :description => desc }
|
24
|
+
{ :service => plugin.service + " % free", :description => "Процент утилизации памяти", :metric => fraction.round(2) * 100 },
|
25
|
+
{ :service => plugin.service + " % swap", :description => "Процент утилизации своп", :metric => swap_fraction.round(2) * 100 },
|
26
|
+
{ :service => plugin.service + " abs free", :description => "Утилизация памяти (kB)", :metric => free, :state => 'ok', :description => desc },
|
27
|
+
{ :service => plugin.service + " abs total", :description => "Памяти всего (kB)", :metric => total, :state => 'ok', :description => desc },
|
28
|
+
{ :service => plugin.service + " abs cached", :description => "Утилизация памяти cached (kB)", :metric => cached, :state => 'ok', :description => desc },
|
29
|
+
{ :service => plugin.service + " abs buffers", :description => "Утилизация памяти buffers (kB)", :metric => buffers, :state => 'ok', :description => desc },
|
30
|
+
{ :service => plugin.service + " abs used", :description => "Утилизация памяти used (kB)", :metric => used , :state => 'ok', :description => desc },
|
31
|
+
{ :service => plugin.service + " abs free_bc", :description => "Утилизация памяти с cache и buffers (kB)", :metric => free_bc , :state => 'ok', :description => desc }
|
30
32
|
]
|
31
33
|
end
|
32
34
|
|
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: 0.8.
|
4
|
+
version: 0.8.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -165,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
165
|
version: '0'
|
166
166
|
segments:
|
167
167
|
- 0
|
168
|
-
hash: -
|
168
|
+
hash: -2747088378221526707
|
169
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
170
|
none: false
|
171
171
|
requirements:
|