sysctl
Get kernel parameters from a remote server in ruby.
linux manual
Basic Usage
require 'kanrisuru'
host = Kanrisuru::Remote::Host.new(host: '127.0.1.1', username: 'ubuntu', keys: ['~/.ssh/id_rsa'])
result = host.sysctl('kernel.ostype')
result.success?
true
result.kernel.ostype
'Linux'
Parameters
Field | Type | Description |
---|---|---|
variable |
string
|
The name of a key to read from, in '.' notation. |
Result
Returns a nested struct that maps the ‘.’ notation keys from sysctl data.
Return Example
host.sysctl('fs.nfs').data
#<Struct:#<Class:0x000055dfe747b310>:0x00003278
fs = #<Struct:#<Class:0x000055dfe747afa0>:0x000032a0
nfs = #<Struct:#<Class:0x000055dfe747ac80>:0x000032c8
nlm_grace_period = 0,
nlm_tcpport = 0,
nlm_timeout = 10,
nlm_udpport = 0,
nsm_local_state = 0,
nsm_use_hostnames = 0
>
>
>
Exit Status
Code | Description |
---|---|
0 | Success |
1 | Failure |
Tested On
- Ubuntu, Debian, Centos, Fedora, Redhat, OpenSuse, SLES