gen

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Group = endpoint.Define(
	"process",
	"The processes of the host",
	endpoint.Area(area.Node),
	endpoint.Prefix("node/{hostname}"),
	endpoint.Uses[dispatch.Deps](),
	endpoint.Tag("process_operations", "Process", "The processes of the host"),
	endpoint.CommandNotes("The [process behavior](../../../../../reference/behaviors/node/process/process.md) page tells where the behavior runs, what it is built on and its settings."),
	endpoint.Doc[types.RowStatus](dispatch.RowStatusDoc),
	endpoint.Get[ListRequest, ProcessCollectionResponse]("list").
		Handle(HandleList).
		ID("GetNodeProcess").
		Describe("List the processes of the host").
		Permission("process:read").
		Returns("Each target host's result.").
		Explain("Lists 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.").
		Example("--target web-01", "A Linux host that runs sleep").
		Example("--target web-01", "A Mac that runs sleep").
		Result("A Linux host that runs sleep, on one host:\n\n```ansi\n$ osapi client node process list --target web-01\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n  \x1b[38;2;10;143;176mHOSTNAME  \x1b[0m\x1b[38;2;10;143;176mSTATUS  \x1b[0m\x1b[38;2;10;143;176mPID   \x1b[0m\x1b[38;2;10;143;176mNAME   \x1b[0m\x1b[38;2;10;143;176mUSER   \x1b[0m\x1b[38;2;10;143;176mSTATE  \x1b[0m\x1b[38;2;10;143;176mCPU PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM RSS  \x1b[0m\x1b[38;2;10;143;176mCOMMAND    \x1b[0m\x1b[38;2;10;143;176mSTART TIME\x1b[0m\n  \x1b[1mweb-01\x1b[0m    \x1b[38;2;103;234;147mok\x1b[0m      1234  \x1b[1msleep\x1b[0m  alice  sleep  5.00         1.00         20.0 MB  sleep 300  2026-01-02T02:55:45Z\n\n  1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m   \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m   \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node process list --target _all\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n  \x1b[38;2;10;143;176mHOSTNAME  \x1b[0m\x1b[38;2;10;143;176mSTATUS  \x1b[0m\x1b[38;2;10;143;176mPID   \x1b[0m\x1b[38;2;10;143;176mNAME   \x1b[0m\x1b[38;2;10;143;176mUSER   \x1b[0m\x1b[38;2;10;143;176mSTATE  \x1b[0m\x1b[38;2;10;143;176mCPU PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM RSS  \x1b[0m\x1b[38;2;10;143;176mCOMMAND    \x1b[0m\x1b[38;2;10;143;176mSTART TIME\x1b[0m\n  \x1b[1mweb-01\x1b[0m    \x1b[38;2;103;234;147mok\x1b[0m      1234  \x1b[1msleep\x1b[0m  alice  sleep  5.00         1.00         20.0 MB  sleep 300  2026-01-02T02:55:45Z\n  \x1b[1mweb-02\x1b[0m    \x1b[38;2;103;234;147mok\x1b[0m      1234  \x1b[1msleep\x1b[0m  alice  sleep  5.00         1.00         20.0 MB  sleep 300  2026-01-02T02:55:45Z\n\n  3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m   \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m   \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n  \x1b[1mmac-01\x1b[0m  \x1b[38;5;222mskipped\x1b[0m  operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n  \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"results\": [\n    {\n      \"command\": \"sleep 300\",\n      \"cpu_percent\": 5,\n      \"hostname\": \"web-01\",\n      \"mem_percent\": 1,\n      \"mem_rss\": 20971520,\n      \"name\": \"sleep\",\n      \"pid\": 1234,\n      \"start_time\": \"2026-01-02T02:55:45Z\",\n      \"state\": \"sleep\",\n      \"status\": \"ok\",\n      \"user\": \"alice\"\n    }\n  ]\n}\n```\n\nA Mac that runs sleep, on one host:\n\n```ansi\n$ osapi client node process list --target web-01\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n  \x1b[38;2;10;143;176mHOSTNAME  \x1b[0m\x1b[38;2;10;143;176mSTATUS  \x1b[0m\x1b[38;2;10;143;176mPID   \x1b[0m\x1b[38;2;10;143;176mNAME   \x1b[0m\x1b[38;2;10;143;176mUSER   \x1b[0m\x1b[38;2;10;143;176mSTATE  \x1b[0m\x1b[38;2;10;143;176mCPU PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM RSS  \x1b[0m\x1b[38;2;10;143;176mCOMMAND    \x1b[0m\x1b[38;2;10;143;176mSTART TIME\x1b[0m\n  \x1b[1mweb-01\x1b[0m    \x1b[38;2;103;234;147mok\x1b[0m      1234  \x1b[1msleep\x1b[0m  alice  sleep  5.00         1.00         20.0 MB  sleep 300  \n\n  1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m   \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m   \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node process list --target _all\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n  \x1b[38;2;10;143;176mHOSTNAME  \x1b[0m\x1b[38;2;10;143;176mSTATUS  \x1b[0m\x1b[38;2;10;143;176mPID   \x1b[0m\x1b[38;2;10;143;176mNAME   \x1b[0m\x1b[38;2;10;143;176mUSER   \x1b[0m\x1b[38;2;10;143;176mSTATE  \x1b[0m\x1b[38;2;10;143;176mCPU PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM RSS  \x1b[0m\x1b[38;2;10;143;176mCOMMAND    \x1b[0m\x1b[38;2;10;143;176mSTART TIME\x1b[0m\n  \x1b[1mweb-01\x1b[0m    \x1b[38;2;103;234;147mok\x1b[0m      1234  \x1b[1msleep\x1b[0m  alice  sleep  5.00         1.00         20.0 MB  sleep 300  \n  \x1b[1mweb-02\x1b[0m    \x1b[38;2;103;234;147mok\x1b[0m      1234  \x1b[1msleep\x1b[0m  alice  sleep  5.00         1.00         20.0 MB  sleep 300  \n\n  3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m   \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m   \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n  \x1b[1mmac-01\x1b[0m  \x1b[38;5;222mskipped\x1b[0m  operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n  \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"results\": [\n    {\n      \"command\": \"sleep 300\",\n      \"cpu_percent\": 5,\n      \"hostname\": \"web-01\",\n      \"mem_percent\": 1,\n      \"mem_rss\": 20971520,\n      \"name\": \"sleep\",\n      \"pid\": 1234,\n      \"state\": \"sleep\",\n      \"status\": \"ok\",\n      \"user\": \"alice\"\n    }\n  ]\n}\n```").
		Errors(endpoint.NotFound(behavior.ErrNotFound, "The host does not have what the request names, such as the object of a deploy."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")),
	endpoint.Get[GetRequest, ProcessGetResponse]("get").
		Handle(HandleGet).
		ID("GetNodeProcessByKey").
		Describe("Get one process").
		Permission("process:read").
		Returns("Each target host's result.").
		Explain("Reads one process by its ID, without the others. A process that the host does not have is not found.").
		Example("--target web-01 --pid 1234", "A process of a Linux host").
		Example("--target web-01 --pid 1234", "A process of a Mac").
		Result("A process of a Linux host, on one host:\n\n```ansi\n$ osapi client node process get --target web-01 --pid 1234\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n  \x1b[38;2;10;143;176mHOSTNAME  \x1b[0m\x1b[38;2;10;143;176mSTATUS  \x1b[0m\x1b[38;2;10;143;176mPID   \x1b[0m\x1b[38;2;10;143;176mNAME   \x1b[0m\x1b[38;2;10;143;176mUSER   \x1b[0m\x1b[38;2;10;143;176mSTATE  \x1b[0m\x1b[38;2;10;143;176mCPU PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM RSS  \x1b[0m\x1b[38;2;10;143;176mCOMMAND    \x1b[0m\x1b[38;2;10;143;176mSTART TIME\x1b[0m\n  \x1b[1mweb-01\x1b[0m    \x1b[38;2;103;234;147mok\x1b[0m      1234  \x1b[1msleep\x1b[0m  alice  sleep  5.00         1.00         20.0 MB  sleep 300  2026-01-02T02:55:45Z\n\n  1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m   \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m   \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node process get --target _all --pid 1234\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n  \x1b[38;2;10;143;176mHOSTNAME  \x1b[0m\x1b[38;2;10;143;176mSTATUS  \x1b[0m\x1b[38;2;10;143;176mPID   \x1b[0m\x1b[38;2;10;143;176mNAME   \x1b[0m\x1b[38;2;10;143;176mUSER   \x1b[0m\x1b[38;2;10;143;176mSTATE  \x1b[0m\x1b[38;2;10;143;176mCPU PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM RSS  \x1b[0m\x1b[38;2;10;143;176mCOMMAND    \x1b[0m\x1b[38;2;10;143;176mSTART TIME\x1b[0m\n  \x1b[1mweb-01\x1b[0m    \x1b[38;2;103;234;147mok\x1b[0m      1234  \x1b[1msleep\x1b[0m  alice  sleep  5.00         1.00         20.0 MB  sleep 300  2026-01-02T02:55:45Z\n  \x1b[1mweb-02\x1b[0m    \x1b[38;2;103;234;147mok\x1b[0m      1234  \x1b[1msleep\x1b[0m  alice  sleep  5.00         1.00         20.0 MB  sleep 300  2026-01-02T02:55:45Z\n\n  3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m   \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m   \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n  \x1b[1mmac-01\x1b[0m  \x1b[38;5;222mskipped\x1b[0m  operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n  \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"results\": [\n    {\n      \"command\": \"sleep 300\",\n      \"cpu_percent\": 5,\n      \"hostname\": \"web-01\",\n      \"mem_percent\": 1,\n      \"mem_rss\": 20971520,\n      \"name\": \"sleep\",\n      \"pid\": 1234,\n      \"start_time\": \"2026-01-02T02:55:45Z\",\n      \"state\": \"sleep\",\n      \"status\": \"ok\",\n      \"user\": \"alice\"\n    }\n  ]\n}\n```\n\nA process of a Mac, on one host:\n\n```ansi\n$ osapi client node process get --target web-01 --pid 1234\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n  \x1b[38;2;10;143;176mHOSTNAME  \x1b[0m\x1b[38;2;10;143;176mSTATUS  \x1b[0m\x1b[38;2;10;143;176mPID   \x1b[0m\x1b[38;2;10;143;176mNAME   \x1b[0m\x1b[38;2;10;143;176mUSER   \x1b[0m\x1b[38;2;10;143;176mSTATE  \x1b[0m\x1b[38;2;10;143;176mCPU PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM RSS  \x1b[0m\x1b[38;2;10;143;176mCOMMAND    \x1b[0m\x1b[38;2;10;143;176mSTART TIME\x1b[0m\n  \x1b[1mweb-01\x1b[0m    \x1b[38;2;103;234;147mok\x1b[0m      1234  \x1b[1msleep\x1b[0m  alice  sleep  5.00         1.00         20.0 MB  sleep 300  \n\n  1 host: \x1b[38;2;103;234;147m1 ok\x1b[0m   \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m   \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node process get --target _all --pid 1234\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n  \x1b[38;2;10;143;176mHOSTNAME  \x1b[0m\x1b[38;2;10;143;176mSTATUS  \x1b[0m\x1b[38;2;10;143;176mPID   \x1b[0m\x1b[38;2;10;143;176mNAME   \x1b[0m\x1b[38;2;10;143;176mUSER   \x1b[0m\x1b[38;2;10;143;176mSTATE  \x1b[0m\x1b[38;2;10;143;176mCPU PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM PERCENT  \x1b[0m\x1b[38;2;10;143;176mMEM RSS  \x1b[0m\x1b[38;2;10;143;176mCOMMAND    \x1b[0m\x1b[38;2;10;143;176mSTART TIME\x1b[0m\n  \x1b[1mweb-01\x1b[0m    \x1b[38;2;103;234;147mok\x1b[0m      1234  \x1b[1msleep\x1b[0m  alice  sleep  5.00         1.00         20.0 MB  sleep 300  \n  \x1b[1mweb-02\x1b[0m    \x1b[38;2;103;234;147mok\x1b[0m      1234  \x1b[1msleep\x1b[0m  alice  sleep  5.00         1.00         20.0 MB  sleep 300  \n\n  3 hosts: \x1b[38;2;103;234;147m2 ok\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m   \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m   \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n  \x1b[1mmac-01\x1b[0m  \x1b[38;5;222mskipped\x1b[0m  operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n  \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"results\": [\n    {\n      \"command\": \"sleep 300\",\n      \"cpu_percent\": 5,\n      \"hostname\": \"web-01\",\n      \"mem_percent\": 1,\n      \"mem_rss\": 20971520,\n      \"name\": \"sleep\",\n      \"pid\": 1234,\n      \"state\": \"sleep\",\n      \"status\": \"ok\",\n      \"user\": \"alice\"\n    }\n  ]\n}\n```\n\nThe command fails in these cases:\n\n| Call | Flags | Fails with |\n| --- | --- | --- |\n| A process that the host does not have | `--pid 99999` | not found |\n| A process ID below 1 | `--pid -1` | min |").
		Errors(endpoint.NotFound(behavior.ErrNotFound, "The host has no process with that pid."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")),
	endpoint.Post[SignalRequest, ProcessSignalResponse]("signal").
		Handle(HandleSignal).
		ID("PostNodeProcessSignal").
		Describe("Send a signal to a process").
		Permission("process:execute").
		Returns("Each target host's result, with whether it changed.").
		Action("signal").
		Explain("Sends 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.").
		Example("--target web-01 --pid 1234 --signal TERM", "Stop a process").
		Result("Stop a process, on one host:\n\n```ansi\n$ osapi client node process signal --target web-01 --pid 1234 --signal TERM\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n  \x1b[38;2;10;143;176mHOSTNAME  \x1b[0m\x1b[38;2;10;143;176mSTATUS   \x1b[0m\x1b[38;2;10;143;176mPID   \x1b[0m\x1b[38;2;10;143;176mSIGNAL\x1b[0m\n  \x1b[1mweb-01\x1b[0m    \x1b[38;2;103;234;147mchanged\x1b[0m  1234  TERM\n\n  1 host: \x1b[38;2;103;234;147m1 changed\x1b[0m   \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m   \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n```\n\nOn each host, where one cannot run it:\n\n```ansi\n$ osapi client node process signal --target _all --pid 1234 --signal TERM\n\x1b[1;38;2;0;213;255mResults:\x1b[0m\n  \x1b[38;2;10;143;176mHOSTNAME  \x1b[0m\x1b[38;2;10;143;176mSTATUS   \x1b[0m\x1b[38;2;10;143;176mPID   \x1b[0m\x1b[38;2;10;143;176mSIGNAL\x1b[0m\n  \x1b[1mweb-01\x1b[0m    \x1b[38;2;103;234;147mchanged\x1b[0m  1234  TERM\n  \x1b[1mweb-02\x1b[0m    \x1b[38;2;103;234;147mchanged\x1b[0m  1234  TERM\n\n  3 hosts: \x1b[38;2;103;234;147m2 changed\x1b[0m, \x1b[38;5;222m1 skipped\x1b[0m   \x1b[38;2;138;138;138mjob 550e8400-e29b-41d4-a716-446655440000\x1b[0m   \x1b[38;2;138;138;138mtrace 26e448c9dbe1c4a8d216a98c675079c9\x1b[0m\n\n\x1b[1;38;2;255;0;255mDetails:\x1b[0m\n  \x1b[1mmac-01\x1b[0m  \x1b[38;5;222mskipped\x1b[0m  operation not supported on this OS family\n```\n\nWith `--json`, the API's response:\n\n```json\n{\n  \"job_id\": \"550e8400-e29b-41d4-a716-446655440000\",\n  \"results\": [\n    {\n      \"changed\": true,\n      \"hostname\": \"web-01\",\n      \"pid\": 1234,\n      \"signal\": \"TERM\",\n      \"status\": \"ok\"\n    }\n  ]\n}\n```\n\nWith the default settings, each example does this on the host:\n\n| Example | On the host |\n| --- | --- |\n| Stop a process | runs `kill -TERM 1234` |\n\nThe command fails in these cases:\n\n| Call | Flags | Fails with |\n| --- | --- | --- |\n| A process that the host does not have | `--pid 99999 --signal TERM` | not found |\n| A process ID below 1 | `--pid -1 --signal TERM` | min |\n| A signal that osapi does not send | `--pid 1234 --signal STOP` | enum |").
		Errors(endpoint.NotFound(behavior.ErrNotFound, "The host has no process with that pid."), endpoint.Conflict(behavior.ErrNotManaged, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotManaged), endpoint.Conflict(behavior.ErrNotInstalled, "osapi did not deploy the item, so it does not change it, or the host does not have a program that the method needs.").Because(types.ReasonNotInstalled), endpoint.Invalid(dispatch.ErrInvalid, "The request is not valid, or the host refuses the input, such as a path that is a directory.")),
)

Group is process as an endpoint group, which its spec comes from.

Functions

func Routes

func Routes(
	s *server.Server,
) []server.Route

Routes are the process group's endpoints, as its definition declares them.

Types

type GetRequest

type GetRequest struct {
	Hostname string `` /* 182-byte string literal not displayed */
	PID      int    `doc:"The process ID, such as 1234" in:"path" json:"pid" param:"ProcessPid" validate:"required,min=1"`
}

GetRequest is the request of process get: its target and its input.

type ListRequest

type ListRequest struct {
	Hostname string `` /* 182-byte string literal not displayed */
}

ListRequest is the request of process list: its target and its input.

type ProcessCollectionResponse

type ProcessCollectionResponse struct {
	JobID   string         `` /* 133-byte string literal not displayed */
	Results []ProcessEntry `json:"results"`
}

ProcessCollectionResponse is each target host's result.

func HandleList

HandleList runs process list on the target, for the endpoint server.

type ProcessEntry

type ProcessEntry struct {
	Hostname   string          `doc:"Hostname of the agent that produced this result." json:"hostname"`
	Status     types.RowStatus `doc:"The status of the operation for this host." json:"status"`
	PID        *int            `doc:"The process ID" json:"pid,omitempty"`
	Name       *string         `doc:"The name of the process" json:"name,omitempty"`
	User       *string         `doc:"The user that runs it" json:"user,omitempty"`
	State      *string         `doc:"Its state, such as running or sleep" json:"state,omitempty"`
	CPUPercent *float64        `doc:"Its CPU time as a percent of the time since it started" json:"cpu_percent,omitempty"`
	MemPercent *float32        `doc:"Its resident memory as a percent of the host's memory" json:"mem_percent,omitempty"`
	MemRSS     *int64          `doc:"Its resident memory in bytes" json:"mem_rss,omitempty"`
	Command    *string         `doc:"Its full command line" json:"command,omitempty"`
	StartTime  *string         `doc:"When it started, in RFC 3339" json:"start_time,omitempty"`
	Error      *string         `doc:"Error message if the agent failed." json:"error,omitempty"`
}

ProcessEntry is the result of process on one host.

type ProcessGetResponse

type ProcessGetResponse struct {
	JobID   string         `` /* 133-byte string literal not displayed */
	Results []ProcessEntry `json:"results"`
}

ProcessGetResponse is each target host's result.

func HandleGet

func HandleGet(
	ctx context.Context,
	d dispatch.Deps,
	in GetRequest,
) (ProcessGetResponse, error)

HandleGet runs process get on the target, for the endpoint server.

type ProcessResult

type ProcessResult struct {
	Hostname string          `doc:"Hostname of the agent that produced this result." json:"hostname"`
	Status   types.RowStatus `doc:"The status of the operation for this host." json:"status"`
	PID      *int            `doc:"The process ID" json:"pid,omitempty"`
	Signal   *types.Signal   `doc:"The signal that was sent" json:"signal,omitempty"`
	Changed  *bool           `doc:"Whether the signal was sent" json:"changed,omitempty"`
	Error    *string         `doc:"Error message if the agent failed." json:"error,omitempty"`
}

ProcessResult is the result of process on one host.

type ProcessSignalRequest

type ProcessSignalRequest struct {
	Signal types.Signal `doc:"The signal: TERM, KILL, HUP, INT, USR1 or USR2" json:"signal" validate:"required,enum"`
}

ProcessSignalRequest is the body of process signal.

type ProcessSignalResponse

type ProcessSignalResponse struct {
	JobID   string          `` /* 133-byte string literal not displayed */
	Results []ProcessResult `json:"results"`
}

ProcessSignalResponse is each target host's result.

func HandleSignal

func HandleSignal(
	ctx context.Context,
	d dispatch.Deps,
	in SignalRequest,
) (ProcessSignalResponse, error)

HandleSignal runs process signal on the target, for the endpoint server.

type SignalRequest

type SignalRequest struct {
	Hostname string               `` /* 182-byte string literal not displayed */
	PID      int                  `doc:"The process ID, such as 1234" in:"path" json:"pid" param:"ProcessPid" validate:"required,min=1"`
	Body     ProcessSignalRequest `in:"body" validate:"required"`
}

SignalRequest is the request of process signal: its target and its input.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL