Class: Pimon::Probe::CpuUsage

Inherits:
Object
  • Object
show all
Defined in:
lib/pimon/probe/cpu_usage.rb

Class Method Summary collapse

Class Method Details

.check(date = Time.now) ⇒ Object



4
5
6
7
# File 'lib/pimon/probe/cpu_usage.rb', line 4

def self.check(date = Time.now)
  value = 100 - `vmstat 1 2`.split(/\n/)[3].split(' ')[14].to_i
  OpenStruct.new(date: date.strftime('%Y-%m-%d %H:%M:%S'), probe_name: 'cpu', value: value, unit: unit)
end

.unitObject



9
10
11
# File 'lib/pimon/probe/cpu_usage.rb', line 9

def self.unit
  '%'
end