13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/neutrino/reporter.rb', line 13
def self.get_metrics
ms = [
ShellMetric.new({
:name => "User CPU",
:commands => {:user => "iostat | grep -A1 avg-cpu | tail -1 | awk '{print $1}'"},
:group => "system",
:type => "CPU",
:display_options => {:min => 0, :max => 1}
}),
ShellMetric.new({
:name => "Idle CPU",
:commands => {:idle => "iostat | grep -A1 avg-cpu | tail -1 | awk '{print $6}'"},
:group => "system",
:type => "CPU",
:display_options => {:min => 0, :max => 100}
}),
ShellMetric.new({
:name => "Free Memory",
:commands => {:free => "cat /proc/meminfo | grep 'MemFree' | awk '{print $2}'"},
:group => "system",
:type => 'memory'
}),
ShellMetric.new({
:name => "Load Avg (15m)",
:commands => {
"1_min" => "cat /proc/loadavg | awk '{print $1}'",
"5_min" => "cat /proc/loadavg | awk '{print $2}'",
"15_min" => "cat /proc/loadavg | awk '{print $3}'",
},
:group => "system",
:type => 'load'
}),
ShellMetric.new({
:name => "Process Count",
:commands => {:processes => "ps aux | wc -l"},
:group => "system",
:type => 'process'
})
]
Dir.glob(Config.munin_plugin_globs).each{|plugin_path| ms << MuninMetric.new(:munin_plugin_path => plugin_path)}
ms
end
|