Kanrisuru

free

Get system memory information in ruby

Basic Usage

require 'kanrisuru'
host = Kanrisuru::Remote::Host.new(host: '127.0.1.1', username: 'ubuntu', keys: ['~/.ssh/id_rsa'])

result = host.free('total')
result.success?
true

result.to_i
16397092

Parameters

Field Type Description
type string
Get memory information for either total, free, swap or swap_total.

Result

Returns the memory stat in bytes.

Exit Status

Code Description
0 Success
1 Failure

Tested On

  • Ubuntu, Debian, Centos, Fedora, Redhat, OpenSuse, SLES