class platypush.plugins.system.SystemPlugin(**kwargs)[source]

Bases: Plugin

Plugin to get system info.


  • py-cpuinfo (pip install py-cpuinfo) for CPU model and info.

  • psutil (pip install psutil) for CPU load and stats.

connected_users() ConnectedUserResponseList[source]

Get the list of connected users. :return: List of platypush.message.response.system.ConnectUserResponse.

cpu_frequency(per_cpu: bool = False) Union[CpuFrequencyResponse, CpuResponseList][source]

Get CPU stats.


per_cpu – Get per-CPU stats (default: False).



cpu_info() CpuInfoResponse[source]

Get CPU info. :return: platypush.message.response.system.CpuInfoResponse

cpu_percent(per_cpu: bool = False, interval: Optional[float] = None) Union[float, List[float]][source]

Get the CPU load percentage.

  • per_cpu – Get per-CPU stats (default: False).

  • interval – When interval is 0.0 or None compares system CPU times elapsed since last call or module import, returning immediately (non blocking). That means the first time this is called it will return a meaningless 0.0 value which you should ignore. In this case is recommended for accuracy that this function be called with at least 0.1 seconds between calls.


float if per_cpu=False, list[float] otherwise.

cpu_stats() CpuStatsResponse[source]

Get CPU stats. :return: platypush.message.response.system.CpuStatsResponse

cpu_times(per_cpu=False, percent=False) Union[CpuTimesResponse, CpuResponseList][source]

Get the CPU times stats.

  • per_cpu – Get per-CPU stats (default: False).

  • percent – Get the stats in percentage (default: False).



disk_io_counters(disk: Optional[str] = None, per_disk: bool = False) Union[DiskIoCountersResponse, DiskResponseList][source]

Get the I/O counter stats for the mounted disks.

  • disk – Select the stats for a specific disk (e.g. ‘sda1’). Default: get stats for all mounted disks.

  • per_disk – Return the stats per disk (default: False).


platypush.message.response.system.DiskIoCountersResponse or list of platypush.message.response.system.DiskIoCountersResponse.

disk_partitions() DiskResponseList[source]

Get the list of partitions mounted on the system. :return: list of platypush.message.response.system.DiskPartitionResponse

disk_usage(path: Optional[str] = None) Union[DiskUsageResponse, DiskResponseList][source]

Get the usage of a mounted disk.


path – Path where the device is mounted (default: get stats for all mounted devices).


platypush.message.response.system.DiskUsageResponse or list of platypush.message.response.system.DiskUsageResponse.

kill(pid: int)[source]

Kill a process. :param pid: Process PID.

load_avg() List[float][source]

Get the average load as a vector that represents the load within the last 1, 5 and 15 minutes.

mem_swap() SwapMemoryUsageResponse[source]

Get the current virtual memory usage stats. :return: list of platypush.message.response.system.SwapMemoryUsageResponse

mem_virtual() VirtualMemoryUsageResponse[source]

Get the current virtual memory usage stats. :return: list of platypush.message.response.system.VirtualMemoryUsageResponse

net_addresses(nic: Optional[str] = None) Union[NetworkAddressResponse, NetworkResponseList][source]

Get address info associated to the network interfaces.


nic – Select the stats for a specific network device (e.g. ‘eth0’). Default: get stats for all NICs.


platypush.message.response.system.NetworkAddressResponse or list of platypush.message.response.system.NetworkAddressResponse.

net_connections(type: Optional[str] = None) Union[NetworkConnectionResponse, NetworkResponseList][source]

Get the list of active network connections. On macOS this function requires root privileges.



Connection type to filter. Supported types:

Kind Value

Connections using

inet inet4 inet6 tcp tcp4 tcp6 udp udp4 udp6 unix all

IPv4 and IPv6 IPv4 IPv6 TCP TCP over IPv4 TCP over IPv6 UDP UDP over IPv4 UDP over IPv6 UNIX socket (both UDP and TCP protocols) the sum of all the possible families and protocols


List of platypush.message.response.system.NetworkConnectionResponse.

net_io_counters(nic: Optional[str] = None, per_nic: bool = False) Union[NetworkIoCountersResponse, NetworkResponseList][source]

Get the I/O counters stats for the network interfaces.

  • nic – Select the stats for a specific network device (e.g. ‘eth0’). Default: get stats for all NICs.

  • per_nic – Return the stats broken down per interface (default: False).


platypush.message.response.system.NetIoCountersResponse or list of platypush.message.response.system.NetIoCountersResponse.

net_stats(nic: Optional[str] = None) Union[NetworkInterfaceStatsResponse, NetworkResponseList][source]

Get stats about the network interfaces.


nic – Select the stats for a specific network device (e.g. ‘eth0’). Default: get stats for all NICs.


platypush.message.response.system.NetworkInterfaceStatsResponse or list of platypush.message.response.system.NetworkInterfaceStatsResponse.

pid_exists(pid: int) bool[source]

pid – Process PID.


True if the process exists, False otherwise.

processes(filter: Optional[str] = '') ProcessResponseList[source]

Get the list of running processes.


filter – Filter the list by name.


List of platypush.message.response.system.ProcessResponse.

resume(pid: int)[source]

Resume a process. :param pid: Process PID.

sensors_battery() SensorBatteryResponse[source]

Get stats from the battery sensor. :return: List of platypush.message.response.system.SensorFanResponse.

sensors_fan(sensor: Optional[str] = None) SensorResponseList[source]

Get stats from the fan sensors.


sensor – Select the sensor name.


List of platypush.message.response.system.SensorFanResponse.

sensors_temperature(sensor: Optional[str] = None, fahrenheit: bool = False) Union[SensorTemperatureResponse, List[SensorTemperatureResponse], Dict[str, Union[SensorTemperatureResponse, List[SensorTemperatureResponse]]]][source]

Get stats from the temperature sensors.

  • sensor – Select the sensor name.

  • fahrenheit – Return the temperature in Fahrenheit (default: Celsius).

suspend(pid: int)[source]

Suspend a process. :param pid: Process PID.

terminate(pid: int)[source]

Terminate a process. :param pid: Process PID.

wait(pid: int, timeout: int = None)[source]

Wait for a process to terminate.

  • pid – Process PID.

  • timeout – Timeout in seconds (default: None).