Skip to main content

Get

Show a behavior: its surfaces, chain, methods, types and telemetry.

It shows where osapi serves the behavior, its platforms, the programs that it runs with sudo, the behaviors that it uses and that use it, its methods with their routes and permissions, its types, its settings and its telemetry.

**Uses** lists the behaviors this one is built on. The agent builds their providers first, and the methods of this behavior call theirs on the same host, in the same job. If a behavior that it uses cannot run on a platform, this one reports skipped there too. **Used by** lists the behaviors built on this one. A behavior with Internal: yes has no route, no command and no permission. Only the behaviors under **Used by** call it. osapi dsl behavior method get shows one method in full: its fields with their constraints, its output and its examples.

osapi dsl behavior get [flags]

Examples​

osapi dsl behavior get --name sysctl
osapi dsl behavior get --name sysctl --json

Result​

The command prints:

$ osapi dsl behavior get --name sysctl
Behavior:
  Name:         sysctl
  Description:  Kernel parameters, written to sysctl.d files and applied
  Placement:    node
  Internal:     no
  API:          yes
  CLI:          yes
  Next:         no
  Platforms:    debian
  Sudo:         sysctl
  Runs:         none
  Writes:       /etc/sysctl.d/osapi-*.conf
  Keeps state:  no
  Uses:         managedfile
  Used by:      none

Methods (2):
  NAME    VERB   HTTP  ROUTE                              PERMISSION    DESCRIPTION
  get     read   GET   /api/node/{hostname}/sysctl/{key}  sysctl:read   Get a kernel parameter's current value, and whether osapi manages it
  update  write  PUT   /api/node/{hostname}/sysctl/{key}  sysctl:write  Set a kernel parameter, manage it, and apply it

Types (2):
  NAME    INPUT                         OUTPUT
  get     GetInput { key* }             Entry { key, value, managed }
  update  UpdateInput { key*, value* }  MutationResult { key, changed }

Settings (1):
  KEY                   AGENT FLAG    TYPE    DEFAULT
  behaviors.sysctl.dir  --sysctl-dir  string  /etc/sysctl.d

Telemetry:
  Span:             behavior.sysctl.<method>
  Child spans:      behavior.managedfile.<method>, exec sysctl
  Metrics:          osapi_behavior_calls_total, osapi_behavior_duration_seconds
  Attributes:       osapi.behavior.name, osapi.behavior.method
  Recorded inputs:  key (get, update)

With --json, the command prints:

{
"name": "sysctl",
"doc": "Kernel parameters, written to sysctl.d files and applied",
"placement": "node",
"internal": false,
"api": true,
"cli": true,
"next": false,
"platforms": ["debian"],
"sudo": ["sysctl"],
"runs": null,
"writes": ["/etc/sysctl.d/osapi-*.conf"],
"keeps_state": false,
"uses": ["managedfile"],
"used_by": null,
"methods": [
{
"name": "get",
"verb": "read",
"http_method": "GET",
"route": "/api/node/{hostname}/sysctl/{key}",
"permission": "sysctl:read",
"command": "osapi client node sysctl get",
"doc": "Get a kernel parameter's current value, and whether osapi manages it"
},
{
"name": "update",
"verb": "write",
"http_method": "PUT",
"route": "/api/node/{hostname}/sysctl/{key}",
"permission": "sysctl:write",
"command": "osapi client node sysctl update",
"doc": "Set a kernel parameter, manage it, and apply it"
}
],
"types": [
{
"name": "get",
"input": "GetInput { key* }",
"output": "Entry { key, value, managed }"
},
{
"name": "update",
"input": "UpdateInput { key*, value* }",
"output": "MutationResult { key, changed }"
}
],
"settings": [
{
"key": "behaviors.sysctl.dir",
"flag": "sysctl-dir",
"type": "string",
"default": "/etc/sysctl.d"
}
],
"telemetry": {
"span": "behavior.sysctl.\u003cmethod\u003e",
"child_spans": ["behavior.managedfile.\u003cmethod\u003e", "exec sysctl"],
"metrics": [
"osapi_behavior_calls_total",
"osapi_behavior_duration_seconds"
],
"attributes": ["osapi.behavior.name", "osapi.behavior.method"],
"recorded": "key (get, update)",
"inputs": {
"get": ["key"],
"update": ["key"]
}
}
}

Flags​

FlagDescriptionDefault
--nameThe behavior, from osapi dsl behavior list (required)

Global flags​

FlagDescriptionDefault
-d, --debugEnable or disable debug mode
-j, --jsonEnable JSON output
-f, --osapi-filePath to config file; without one at the default path, osapi runs on the defaults/etc/osapi/osapi.yaml

Output tells how the result is printed, and what --json gives.