Skip to main content

Get

Get a specific sysctl parameter by key:

$ osapi client node sysctl get --target web-01 --key net.ipv4.ip_forward

Job ID: 550e8400-e29b-41d4-a716-446655440000

KEY VALUE
net.ipv4.ip_forward 1

When targeting all hosts:

$ osapi client node sysctl get --target _all --key vm.swappiness

Job ID: 550e8400-e29b-41d4-a716-446655440000

HOSTNAME KEY VALUE
web-01 vm.swappiness 10
web-02 vm.swappiness 10

When some hosts are skipped, STATUS and ERROR columns appear alongside data columns:

$ osapi client node sysctl get --target _all --key vm.swappiness

Job ID: 550e8400-e29b-41d4-a716-446655440000

HOSTNAME STATUS ERROR KEY VALUE
web-01 ok vm.swappiness 10
mac-01 skipped unsupported platform

JSON Output

Use --json to get the full API response:

$ osapi client node sysctl get --target web-01 --key vm.swappiness --json
{"results":[{"hostname":"web-01","key":"vm.swappiness","value":"10",
"status":"ok"}],"job_id":"..."}

Flags

FlagDescriptionDefault
--keySysctl parameter key to retrieverequired
-T, --targetTarget: _any, _all, hostname, or label (group:web)_any
-j, --jsonOutput raw JSON response