Skip to main content

Process

The processes of the host. osapi dsl behavior get --name process and osapi dsl behavior method get show the same.

Behavior​

Nameprocess
DescriptionThe processes of the host
Placementnode
Areanode
Internalno
APIyes
CLIyes
Nextno
Platformslinux, darwin
Sudonone
Runsnone
Writesnone
Keeps stateno
Usesnone
Used bynone

Methods (3)​

NAMEVERBHTTPROUTEPERMISSIONDESCRIPTION
listreadGET/api/node/{hostname}/processprocess:readList the processes of the host
getreadGET/api/node/{hostname}/process/{pid}process:readGet one process
signalwritePOST/api/node/{hostname}/process/{pid}/signalprocess:writeSend a signal to a process

Types (3)​

NAMEINPUTOUTPUT
listListInput[]Entry { pid, name, user, state, cpu_percent, mem_percent, mem_rss, command, start_time }
getGetInput { pid* }Entry { pid, name, user, state, cpu_percent, mem_percent, mem_rss, command, start_time }
signalSignalInput { pid*, signal* }Result { pid, signal, changed }

Settings (0)​

None. Declare them with behavior.Config.

Telemetry​

Spanbehavior.process.<method>
Child spansexec kill, exec ps
Metricsosapi_behavior_calls_total, osapi_behavior_duration_seconds, osapi_behavior_changes_total
Attributesosapi.behavior.name, osapi.behavior.method, osapi.behavior.verb, osapi.behavior.outcome, osapi.behavior.changed
Recorded inputspid (get, signal), signal (signal)

Method list​

Namelist
Verbread
DescriptionList the processes of the host
DetailLists each process with its user, state, CPU and memory, its command line and when it started, through gohai: from /proc on Linux and from ps on macOS. A process that stops while the list is read is not in it.
HTTPGET
Route/api/node/{hostname}/process
Permissionprocess:read
Commandosapi client node process list
Input typeListInput
Output type[]Entry

Input (0)​

None. The method takes no input; its command needs only --target.

Output (9)​

FIELDTYPEDESCRIPTION
pidintegerThe process ID
namestringThe name of the process
userstringThe user that runs it
statestringIts state, such as running or sleep
cpu_percentnumberIts CPU time as a percent of the time since it started
mem_percentnumberIts resident memory as a percent of the host's memory
mem_rssintegerIts resident memory in bytes
commandstringIts full command line
start_timestringWhen it started, in RFC 3339

Examples (2)​

EXAMPLEINPUTOUTPUT
A Linux host that runs sleep(none)[command=sleep 300, cpu_percent=5, mem_percent=1, mem_rss=2.097152e+07, name=sleep, pid=1234, start_time=2026-01-02T02:55:45Z, state=sleep, user=alice]
A Mac that runs sleep(none)[command=sleep 300, cpu_percent=5, mem_percent=1, mem_rss=2.097152e+07, name=sleep, pid=1234, state=sleep, user=alice]

Method get​

Nameget
Verbread
DescriptionGet one process
DetailReads one process by its ID, without the others. A process that the host does not have is not found.
HTTPGET
Route/api/node/{hostname}/process/{pid}
Permissionprocess:read
Commandosapi client node process get
Input typeGetInput
Output typeEntry

Input (1)​

FIELDTYPEREQUIREDCONSTRAINTSDESCRIPTION
pidintegeryesmin 1The process ID, such as 1234

Output (9)​

FIELDTYPEDESCRIPTION
pidintegerThe process ID
namestringThe name of the process
userstringThe user that runs it
statestringIts state, such as running or sleep
cpu_percentnumberIts CPU time as a percent of the time since it started
mem_percentnumberIts resident memory as a percent of the host's memory
mem_rssintegerIts resident memory in bytes
commandstringIts full command line
start_timestringWhen it started, in RFC 3339

Examples (2)​

EXAMPLEINPUTOUTPUT
A process of a Linux hostpid=1234pid=1234, name=sleep, user=alice, state=sleep, cpu_percent=5, mem_percent=1, mem_rss=2.097152e+07, command=sleep 300, start_time=2026-01-02T02:55:45Z
A process of a Macpid=1234pid=1234, name=sleep, user=alice, state=sleep, cpu_percent=5, mem_percent=1, mem_rss=2.097152e+07, command=sleep 300

Method signal​

Namesignal
Verbwrite
DescriptionSend a signal to a process
DetailSends TERM, KILL, HUP, INT, USR1 or USR2 to one process with kill, and reports changed: true. A process that the host does not have is not found. A process ID below 1 is refused, because kill sends to a group of processes for 0 and for a negative ID.
HTTPPOST
Route/api/node/{hostname}/process/{pid}/signal
Permissionprocess:execute
Commandosapi client node process signal
Input typeSignalInput
Output typeResult

Input (2)​

FIELDTYPEREQUIREDCONSTRAINTSDESCRIPTION
pidintegeryesmin 1The process ID, such as 1234
signalstringyesone of TERM KILL HUP INT USR1 USR2The signal: TERM, KILL, HUP, INT, USR1 or USR2

Output (3)​

FIELDTYPEDESCRIPTION
pidintegerThe process ID
signalstringThe signal that was sent
changedbooleanWhether the signal was sent

Examples (1)​

EXAMPLEINPUTOUTPUT
Stop a processpid=1234, signal=TERMpid=1234, signal=TERM, changed=true