InitProcessCgroup - File /proc/1/cgroup

This parser reads the content of /proc/1/cgroup. This file shows the cgroup detail of init process. The format of the content is like key-value. We can also use this info to check if the archive is from container or host.

class insights.parsers.init_process_cgroup.InitProcessCgroup(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.LegacyItemAccess

Class InitProcessCgroup parses the content of the /proc/1/cgroup.

is_container

It is used to check if a archive is from host or container. Return True if the archive is from container.

Type

bool

A small sample of the content of this file looks like:

11:hugetlb:/
10:memory:/
9:devices:/
8:pids:/
7:perf_event:/
6:net_prio,net_cls:/
5:blkio:/
4:freezer:/
3:cpuacct,cpu:/
2:cpuset:/
1:name=systemd:/

Examples

>>> type(cgroupinfo)
<class 'insights.parsers.init_process_cgroup.InitProcessCgroup'>
>>> cgroupinfo["memory"]
["10", "/"]
>>> cgroupinfo.is_container
False
parse_content(content)[source]

This method must be implemented by classes based on this class.