Documentation
¶
Overview ¶
Package psgo is a ps (1) AIX-format compatible golang library extended with various descriptors useful for displaying container-related data.
The idea behind the library is to provide an easy to use way of extracting process-related data, just as ps (1) does. The problem when using ps (1) is that the ps format strings split columns with whitespaces, making the output nearly impossible to parse. It also adds some jitter as we have to fork and execute ps either in the container or filter the output afterwards, further limiting applicability.
Please visit https://github.com/containers/psgo for further details about supported format descriptors and to see some usage examples.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultDescriptors is the `ps -ef` compatible default format. DefaultDescriptors = []string{"user", "pid", "ppid", "pcpu", "etime", "tty", "time", "comm"} // ErrUnkownDescriptor is returned when an unknown descriptor is parsed. ErrUnkownDescriptor = errors.New("unknown descriptor") )
Functions ¶
func JoinNamespaceAndProcessInfo ¶
JoinNamespaceAndProcessInfo has the same semantics as ProcessInfo but joins the mount namespace of the specified pid before extracting data from `/proc`.
func ListDescriptors ¶
func ListDescriptors() (list []string)
ListDescriptors returns a string slice of all supported AIX format descriptors in the normal form.
func ProcessInfo ¶
ProcessInfo returns the process information of all processes in the current mount namespace. The input format must be a comma-separated list of supported AIX format descriptors. If the input string is empty, the `DefaultDescriptors` is used. The return value is an array of tab-separated strings, to easily use the output for column-based formatting (e.g., with the `text/tabwriter` package).
Types ¶
This section is empty.
Directories
¶
Path | Synopsis |
---|---|
internal
|
|
capabilities
Package capabilities provides a mapping from common kernel bit masks to the alphanumerical represenation of kernel capabilities.
|
Package capabilities provides a mapping from common kernel bit masks to the alphanumerical represenation of kernel capabilities. |
host
Package host extracts data from the host, such as the system's boot time or the tick rate of the system clock.
|
Package host extracts data from the host, such as the system's boot time or the tick rate of the system clock. |