ps – Gather process, thread, and workload partition information using ps on AIX
Synopsis
This module runs the AIX ps command to collect detailed information about running processes and kernel threads.
It provides multiple filtering and formatting options including PID, user, group, workload class, and thread-level details.
Supports mutual exclusiveness validation among key display modes and ensures correctness of flag combinations.
Requirements
The below requirements are needed on the host that executes this module.
AIX >= 7.1
Parameters
- all_processes (optional, bool, False)
Displays all processes currently on the system (-A).
Includes both system and user processes.
Useful for a complete view of system activity.
- processes_on_terminals (optional, bool, False)
Displays all processes associated with a terminal except session leaders (-a).
Excludes background daemons or non-terminal processes.
Helpful for viewing user-interactive processes only.
- exclude_session_leaders (optional, bool, False)
Writes information to standard output about all processes, except the session leaders.
Excludes session leaders from the process list (-d).
- exclude_kernel (optional, bool, False)
Writes information to standard output about all processes, except kernel processes (-e).
- full_list (optional, bool, False)
Generates a full-format listing (-f).
Displays UID, PID, PPID, C, STIME, TTY, TIME, and CMD columns.
- long_list (optional, bool, False)
Generates a long listing (-l).
Provides extended columns such as F, s, UID, PID, PPID, C, PRI, NI, ADDR, SZ, PSS, WCHAN, TTY, TIME, and CMD fields..
- kernel_processes (optional, bool, False)
Displays only kernel processes (-k).
- kernel_threads_processes (optional, bool, False)
Displays kernel threads and associated processes (-m).
Output lines for processes are followed by an extra output line for each kernel thread.
Use with “-o THREAD” for thread-specific columns like TID, PRI, and SC.
- all_64bit (optional, bool, False)
Lists all 64-bit processes (-M).
Allows performance analysis specific to 64-bit applications.
- no_thread_stats (optional, bool, False)
Gathers no thread statistics (-N).
With this flag, ‘ps’ reports those statistics that can be obtained by not traversing through the threads chain for the process.
Useful when thread enumeration causes performance overhead.
- groups (optional, str, None)
Displays processes belonging to specific effective groups (-G Glist).
Accepts group names or numeric GIDs (comma- or space-separated).
Useful for filtering process ownership by Unix group.
- process_groups (optional, str, None)
Writes information only about processes that are in the process groups that are listed for the Glist variable (-g Glist).
The Glist variable is either a comma-separated list of process group identifiers or a list of process group identifiers .
- pids (optional, str, None)
Displays only processes with specified PIDs (-p Plist).
Accepts one or more comma-separated process IDs.
Provides focused information on specific target processes.
- descendants (optional, str, None)
Generates a list of descendants of every pid that has been passed to it in the ‘pidlist’ variable (-L pidlist).
The list of descendants from all the given pid is printed in the order in which they appear in the process table.
- ttys (optional, str, None)
Displays processes associated with specific TTY devices (-t Tlist).
Accepts comma-separated or quoted terminal identifiers.
- users_in_current_env (optional, str, None)
Displays processes owned by specific users in the current environment (-u Ulist).
Accepts user names or numeric UIDs.
Supports comma- or space-separated values up to 128 entries.
- all_users (optional, str, None)
Displays only information about processes with the user ID numbers or login names that are specified for the Ulist variable(-U Ulist).
The ‘-U’ flag only applies to the current operating environment
In the listing, the ps command displays the numerical user ID unless the ‘-f ‘ flag is used; then the command displays the login name.
Lists numeric or textual user identifiers.
- alt_name_list (optional, str, None)
Specifies an alternate system name list file (-n NameList).
The operating system does not use the ‘-n’ flag because information is supplied directly to the kernel..
- project (optional, bool, False)
Displays the Project name, Project origin, and subproject identifier for the project. (-P).
If the stick bit is set for the process, the project name is preceded by an asterisk ‘*’ character.
The Project origin field designates the currently loaded project repository (LOCAL or LDAP).
- full_names (optional, bool, False)
Prints all available characters of each user/group name instead of truncating to the first eight characters.(-X).
- page_sizes_settings (optional, bool, False)
Displays data, text, stack, and shared memory page size settings (-Z).
Provides insight into page usage for memory analysis.
- output_format (optional, str, None)
Customizes output columns using a user-defined format string (-o Format).
Accepts multiple field specifiers such as pid, user, pcpu, pmem, comm.
- sysv_format (optional, str, None)
Displays information in the System V format (-F format).
Functions similar to the -o option but uses traditional System V field naming.
- tree_pid (optional, int, None)
Displays the process hierarchy rooted at the given PID (-T pid).
Uses ASCII art to show parent-child relationships.
Commonly used for visualizing process trees.
- recorded_output (optional, str, None)
Specifies a file path to save the ps command output.
If not provided, results are only returned in stdout.
- concatenated_output (True, bool, None)
Determines whether to append or overwrite the output file.
When true, new output is appended to existing logs.
Notes
Note
You can refer to the IBM documentation for additional information on the fcstat command at https://www.ibm.com/docs/en/aix/7.3.0?topic=p-ps-command.
Examples
- name: Display all processes in long format
ibm.power_aix.ps:
all_processes: true
long_list: true
- name: Display kernel threads with thread IDs
ibm.power_aix.ps:
kernel_threads_processes: true
output_format: "pid,tid,user,pcpu,comm"
- name: Show process tree for PID 1000
ibm.power_aix.ps:
tree_pid: 1000
full_list: true
- name: Save ps output to /tmp/ps_report.txt
ibm.power_aix.ps:
all_processes: true
output_format: "pid,user,pcpu,pmem,comm"
recorded_output: /tmp/ps_report.txt
concatenated_output: true
Return Values
- msg (always, str, ps comamnd executed SUCCESSFULLY)
The execution message.
- rc (If the command failed., int, )
The return code.
- stdout (If the command failed., str, )
The standard output.
- stderr (If the command failed., str, )
The standard error.