sentry-processes

Retrieves the process list from a remote sentry.

Command properties

PropertyDescription
Command typeTransforming
Required permissionAdministrator
License usageN/A
Parallel executionSupported
Distributed executionNot supported

Syntax

sentry-processes [timeout=INT]

Options

timeout=INT
RPC timeout in seconds. Accepts a value between 1 and 600. (Default: 30)

Input fields

FieldTypeRequiredDescription
guidstringRequiredSentry unique identifier.

Output fields

FieldTypeDescription
guidstringSentry unique identifier.
pidinteger or stringProcess ID.
namestringProcess name.
cpu_usageinteger or stringCPU usage (%).
working_setlong or integerMemory size (unit: bytes).
_errorstringError message added to the original record if an error occurs.

The values and types of the pid, cpu_usage, and working_set fields depend on the operating system where the sentry is installed:

Operating systempidcpu_usageworking_set
LinuxintegerAlways 0 (integer), because CPU usage is not measured.The VmSize value in /proc/[pid]/status, that is, the virtual memory size converted to bytes (long).
WindowsintegerThe CPU usage (%) measured over about 0.1 seconds, divided by the number of processors and truncated to an integer (integer). null for a process whose usage could not be measured.The working set size (long).
AIX, SolarisstringThe %CPU column value in the output of the ps command (string).The VSZ column value in the output of the ps command, that is, the virtual memory size in KB multiplied by 1024 (integer).

For the name field, Linux sentries assign the Name value in /proc/[pid]/status, Windows sentries assign the executable file name including the extension, and AIX and Solaris sentries assign the comm column value in the output of the ps command.

HP-UX sentries cannot retrieve the process list, and an error message is assigned to the _error field of the result record.

Error codes

Parsing errors
Error codeMessageDescription
23100no sentry rpc permissionA user without administrator privileges ran the command.
23101invalid sentry rpc timeout. use timeout between 1 and 600.The timeout option value is not an integer or is outside the range 1–600.
Runtime errors

Errors are returned via the _error field:

Error messageDescription
guid is nullThe guid field value in the input record is null.
guid should be stringThe guid field value in the input record is not a string.
guid should be non empty stringThe guid field value in the input record is an empty string.
not connectedThe sentry is not connected.
timeoutThe RPC request timed out.
disconnectedThe sentry connection was already lost when the RPC request was sent.

Other RPC exception messages may be returned depending on the state of the system where the sentry is installed.

Description

The sentry-processes command reads the guid field of each input record, sends an asynchronous RPC message to the corresponding sentry, and retrieves the list of running processes.

Results are returned in the order RPC response messages are received from sentries, so the output record order may differ from the input record order.

The maximum length of the asynchronous RPC request queue is 100 by default and can be adjusted using the logpresso.core.sentry_rpc_parallel environment variable.

To retrieve results from all Data Nodes at once in a cluster environment, use the sonar-sentry-processes command.

Examples

  1. Retrieve the process list from all sentries

    sentry | fields guid | sentry-processes
    

    Retrieves the list of currently running processes from all connected sentries.

  2. Sort by memory size descending

    sentry | fields guid | sentry-processes | sort -working_set
    

    Retrieves the process list from all sentries sorted by memory size in descending order.

  3. Retrieve with a 60-second timeout

    sentry | fields guid | sentry-processes timeout=60
    

    Retrieves the process list from sentries with the RPC timeout set to 60 seconds.

Change history

The sentry-processes command has been available since before Sonar 4.0.