SystemD service configuration

Service systemd files are in /usr/lib/systemd/system/ or /etc/systemd/, and their content format is similar to a ‘.ini’ file.

Parsers included in this module are:

SystemdDocker - file /usr/lib/systemd/system/docker.service

SystemdLogindConf - file /etc/systemd/logind.conf

SystemdRpcbindSocketConf - unit file rpcbind.socket

SystemdOpenshiftNode - file /usr/lib/systemd/system/atomic-openshift-node.service

SystemdSystemConf - file /etc/systemd/system.conf

SystemdOriginAccounting - file /etc/systemd/system.conf.d/origin-accounting.conf

class insights.parsers.systemd.config.MultiOrderedDict(*args, **kwargs)[source]

Bases: dict

Warning

This class is deprecated.

Class for condition that duplicate keys exist

class insights.parsers.systemd.config.SystemdConf(context, extra_bad_lines=None)[source]

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

Base class for parsing systemd INI like configuration files

parse_content(content)[source]

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

class insights.parsers.systemd.config.SystemdDocker(context, extra_bad_lines=None)[source]

Bases: insights.parsers.systemd.config.SystemdConf

Class for docker service systemd configuration.

Typical content of /usr/lib/systemd/system/docker.service file is:

[Service]
Type=notify
EnvironmentFile=-/etc/sysconfig/docker
EnvironmentFile=-/etc/sysconfig/docker-storage
EnvironmentFile=-/etc/sysconfig/docker-network
Environment=GOTRACEBACK=crash
ExecStart=/bin/sh -c '/usr/bin/docker-current daemon \
    --authorization-plugin=rhel-push-plugin \
    --exec-opt native.cgroupdriver=systemd \
    $OPTIONS \
    $DOCKER_STORAGE_OPTIONS \
    $DOCKER_NETWORK_OPTIONS \
    $ADD_REGISTRY \
    $BLOCK_REGISTRY \
    $INSECURE_REGISTRY \
    2>&1 | /usr/bin/forward-journald -tag docker'
LimitNOFILE=1048576

Example

>>> docker_service["Service"]["ExecStart"].endswith("-tag docker'")
True
>>> len(docker_service["Service"]["EnvironmentFile"])
3
class insights.parsers.systemd.config.SystemdLogindConf(context, extra_bad_lines=None)[source]

Bases: insights.parsers.systemd.config.SystemdConf

Class for systemd logind configuration.

Typical content of the /etc/systemd/logind.conf file is:

[Login]
ReserveVT=6
KillUserProcesses=Yes
RemoveIPC=no

Example

>>> logind_conf["Login"]["ReserveVT"]
'6'
>>> logind_conf["Login"]["KillUserProcesses"]  # 'Yes' turns to 'True'
'True'
>>> logind_conf.get("Login").get("RemoveIPC")  # 'no' turns to 'False'
'False'
class insights.parsers.systemd.config.SystemdOpenshiftNode(context, extra_bad_lines=None)[source]

Bases: insights.parsers.systemd.config.SystemdConf

Class for atomic-openshift-node systemd configuration.

Typical output of /usr/lib/systemd/system/atomic-openshift-node.service file is:

[Service]
Type=notify
RestartSec=5s
OOMScoreAdjust=-999
ExecStartPost=/usr/bin/sleep 10
ExecStartPost=/usr/sbin/sysctl --system

Example

>>> openshift_node_service["Service"]["RestartSec"]
'5s'
>>> len(openshift_node_service["Service"]["ExecStartPost"])
2
class insights.parsers.systemd.config.SystemdOriginAccounting(context, extra_bad_lines=None)[source]

Bases: insights.parsers.systemd.config.SystemdConf

Class for systemd master configuration in the /etc/systemd/system.conf.d/origin-accounting.conf file.

Typical content of the /etc/systemd/system.conf.d/origin-accounting.conf file is:

[Manager]
DefaultCPUAccounting=yes
DefaultMemoryAccounting=yes
DefaultBlockIOAccounting=yes

Example

>>> system_origin_accounting["Manager"]["DefaultCPUAccounting"]
'True'
class insights.parsers.systemd.config.SystemdRpcbindSocketConf(context, extra_bad_lines=None)[source]

Bases: insights.parsers.systemd.config.SystemdConf

Class for systemd configuration for rpcbind.socket unit.

Typical content of the rpcbind.socket unit file is:

[Unit]
Description=RPCbind Server Activation Socket
DefaultDependencies=no
Wants=rpcbind.target
Before=rpcbind.target

[Socket]
ListenStream=/run/rpcbind.sock

# RPC netconfig can't handle ipv6/ipv4 dual sockets
BindIPv6Only=ipv6-only
ListenStream=0.0.0.0:111
ListenDatagram=0.0.0.0:111
ListenStream=[::]:111
ListenDatagram=[::]:111

[Install]
WantedBy=sockets.target

Example

>>> rpcbind_socket["Socket"]["ListenStream"]
['/run/rpcbind.sock', '0.0.0.0:111', '[::]:111']
class insights.parsers.systemd.config.SystemdSystemConf(context, extra_bad_lines=None)[source]

Bases: insights.parsers.systemd.config.SystemdConf

Class for systemd master configuration in the /etc/systemd/system.conf file.

Typical content of the /etc/systemd/system.conf file is:

[Manager]
RuntimeWatchdogSec=0
ShutdownWatchdogSec=10min

Example

>>> system_conf["Manager"]["RuntimeWatchdogSec"]
'0'