msaUtils Module¶
.sysinfo
¶
Provides System Information about devices, OS etc.
Classes¶
MSACPUFrequency ¶
MSACPUStats ¶
Bases: BaseModel
Pydantic CPU Stats Info Model.
Attributes¶
ctx_switches
class-attribute
¶
number of context switches (voluntary + involuntary) since boot.
soft_interrupts
class-attribute
¶
number of software interrupts since boot. Always set to 0 on Windows and SunOS.
syscalls
class-attribute
¶
number of system calls since boot. Always set to 0 on Linux.
MSACPUTimes ¶
Bases: BaseModel
Pydantic CPU Timings Info Model.
Attributes¶
guest
class-attribute
¶
(Linux 2.6.24+): time spent running a virtual CPU for guest operating systems under the control of the Linux kernel
guest_nice
class-attribute
¶
(Linux 3.2.0+): time spent running a niced guest (virtual CPU for guest operating systems under the control of the Linux kernel)
iowait
class-attribute
¶
(Linux): time spent waiting for I/O to complete. This is not accounted in idle time counter.
nice
class-attribute
¶
(UNIX): time spent by niced (prioritized) processes executing in user mode; on Linux this also includes guest_nice time
softirq
class-attribute
¶
(Linux): time spent for servicing software interrupts
steal
class-attribute
¶
(Linux 2.6.11+): time spent by other operating systems running in a virtualized environment
user
class-attribute
¶
time spent by normal processes executing in user mode; on Linux this also includes guest time
MSADiskIO ¶
Bases: BaseModel
Pydantic Disk IO Info Model.
ATTRIBUTE | DESCRIPTION |
---|---|
read_count |
number of reads
TYPE:
|
write_count |
number of writes
TYPE:
|
read_bytes |
number of bytes read
TYPE:
|
write_bytes |
number of bytes written
TYPE:
|
read_time |
(all except NetBSD and OpenBSD) time spent reading from disk (in milliseconds)
TYPE:
|
write_time |
(all except NetBSD and OpenBSD) time spent writing to disk (in milliseconds)
TYPE:
|
busy_time |
(Linux, FreeBSD) time spent doing actual I/Os (in milliseconds)
TYPE:
|
read_merged_count |
number of merged reads (see iostats doc)
TYPE:
|
write_merged_count |
number of merged writes (see iostats doc)
TYPE:
|
Attributes¶
MSAMemoryUsage ¶
Bases: BaseModel
Pydantic Memory Usage Info Model.
Attributes¶
active
class-attribute
¶
(UNIX): memory currently in use or very recently used, and so it is in RAM.
available
class-attribute
¶
the memory that can be given instantly to processes without the system going into swap. This is calculated by summing different memory values depending on the platform and it is supposed to be used to monitor actual memory usage in a cross platform fashion.
buffers
class-attribute
¶
(Linux, BSD): cache for things like file system metadata.
free
class-attribute
¶
memory not being used at all (zeroed) that is readily available; note that this doesn’t reflect the actual memory available (use available instead). total - used does not necessarily match free.
percent
class-attribute
¶
the percentage usage calculated as (total - available) / total * 100
used
class-attribute
¶
memory used, calculated differently depending on the platform and designed for informational purposes only. total - free does not necessarily match used.
MSANetworkAdapter ¶
Bases: BaseModel
Pydantic Network Adapter Info Model.
Attributes¶
family
class-attribute
¶
the address family, either AF_INET or AF_INET6 or psutil.AF_LINK, which refers to a MAC address.
ptp
class-attribute
¶
stands for “point to point”; it’s the destination address on a point to point interface (typically a VPN). broadcast and ptp are mutually exclusive. May be None.
MSANetworkAdapters ¶
MSANetworkConnection ¶
Bases: BaseModel
Pydantic Network Connection Info Model.
Attributes¶
family
class-attribute
¶
the address family, either AF_INET, AF_INET6 or AF_UNIX.
file_descriptor
class-attribute
¶
the socket file descriptor. If the connection refers to the current process this may be passed to socket.fromfd to obtain a usable socket object. On Windows and SunOS this is always set to -1.
local_addr
class-attribute
¶
the local address as a (ip, port)
named tuple or a path
in case of AF_UNIX sockets. For UNIX sockets see notes below.
pid
class-attribute
¶
the PID of the process which opened the socket, if retrievable, else None
. On some platforms (e.g. Linux) the availability of this field changes depending on process privileges (root is needed).
remote_addr
class-attribute
¶
the remote address as a (ip, port)
named tuple or an absolute path
in case of UNIX sockets. When the remote endpoint is not connected you’ll get an empty tuple (AF_INET*) or ""
(AF_UNIX). For UNIX sockets see notes below.
status
class-attribute
¶
represents the status of a TCP connection. The return value is one of the psutil.CONN_*
constants (a string). For UDP and UNIX sockets this is always going to be psutil.CONN_NONE.
type
class-attribute
¶
the address type, either SOCK_STREAM
, SOCK_DGRAM
or SOCK_SEQPACKET
.
MSANetworkIO ¶
Bases: BaseModel
Pydantic Network IO Info Model.
ATTRIBUTE | DESCRIPTION |
---|---|
bytes_sent |
number of bytes sent
TYPE:
|
bytes_recv |
number of bytes received
TYPE:
|
packets_sent |
number of packets sent
TYPE:
|
packets_recv |
number of packets received
TYPE:
|
errin |
total number of errors while receiving
TYPE:
|
errout |
total number of errors while sending
TYPE:
|
dropin |
total number of incoming packets which were dropped
TYPE:
|
dropout |
total number of outgoing packets which were dropped (always 0 on macOS and BSD)
TYPE:
|
Attributes¶
MSANetworkStat ¶
Bases: BaseModel
Pydantic Network Stats Info Model.
Attributes¶
duplex
class-attribute
¶
the duplex communication type; it can be either NIC_DUPLEX_FULL, NIC_DUPLEX_HALF or NIC_DUPLEX_UNKNOWN.
isup
class-attribute
¶
a bool indicating whether the NIC is up and running (meaning ethernet cable or Wi-Fi is connected).
speed
class-attribute
¶
the NIC speed expressed in mega bits (MB), if it can’t be determined (e.g. ‘localhost’) it will be set to 0.
MSANetworkStats ¶
MSASwap ¶
Bases: BaseModel
Pydantic Swapfile Info Model.
MSASystemInfo ¶
MSATemperature ¶
MSATemperatures ¶
Functions¶
get_cpu_freq ¶
Get psutil.cpu_freq()
RETURNS | DESCRIPTION |
---|---|
cpf
|
MSACPUFrequency
TYPE:
|
get_cpu_stats ¶
Get psutil.cpu_times()
RETURNS | DESCRIPTION |
---|---|
cst
|
MSACPUStats
TYPE:
|
get_cpu_times ¶
Get psutil.cpu_times()
RETURNS | DESCRIPTION |
---|---|
cti
|
MSACPUTimes
TYPE:
|
get_cpu_usage ¶
Returns the total CPU usage for all available cores.
PARAMETER | DESCRIPTION |
---|---|
user |
If given, returns only the total CPU usage of all processes for the given user.
TYPE:
|
ignore_self |
If
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
total
|
total usage
TYPE:
|
largest_process
|
largest process usage
TYPE:
|
largest_process_name
|
name of the largest process
TYPE:
|
get_gpus ¶
Get GPUtil.getGPUs()
RETURNS | DESCRIPTION |
---|---|
list_gpus
|
List[MSAGPUInfo] = []
TYPE:
|
get_hostname ¶
Get socket.gethostname()
RETURNS | DESCRIPTION |
---|---|
hostname
|
str
TYPE:
|
get_list_partitions ¶
Get psutil.disk_partitions()
RETURNS | DESCRIPTION |
---|---|
partitions_list
|
List = []
TYPE:
|
get_load_average ¶
Returns the CPU load average in tuple[1min, 5min, 15min].
RETURNS | DESCRIPTION |
---|---|
1min
|
total usage
TYPE:
|
5min
|
largest process usage
TYPE:
|
15min
|
name of the largest process
TYPE:
|
get_map_disk_usage ¶
Get get_partition_usage(get_list_partitions())
RETURNS | DESCRIPTION |
---|---|
rdict
|
Dict
TYPE:
|
get_memory_usage ¶
Get psutil.virtual_memory()
RETURNS | DESCRIPTION |
---|---|
mu
|
MSAMemoryUsage
TYPE:
|
get_network_adapters ¶
Get psutil.net_if_addrs()
RETURNS | DESCRIPTION |
---|---|
ret
|
List[MSANetworkAdapters] = []
TYPE:
|
get_network_connections ¶
Get psutil.net_connections()
RETURNS | DESCRIPTION |
---|---|
rlist
|
List[MSANetworkConnection] = []
TYPE:
|
get_network_io ¶
Get psutil.net_io_counters()
RETURNS | DESCRIPTION |
---|---|
nio
|
MSANetworkIO
TYPE:
|
get_network_stats ¶
Get psutil.net_if_stats()
RETURNS | DESCRIPTION |
---|---|
ret
|
List[MSANetworkStats] = []
TYPE:
|
get_partition_usage ¶
Get psutil.disk_usage(partition)
RETURNS | DESCRIPTION |
---|---|
ret
|
Dict = {"partition": list, "total": list, "used": list, "free": list, "percent": list}
TYPE:
|
get_sysgpuinfo ¶
Get MSASystemGPUInfo
RETURNS | DESCRIPTION |
---|---|
system_gpu_info
|
Pydantic System GPU Info Model.
TYPE:
|
get_sysinfo ¶
Get MSASystemInfo
RETURNS | DESCRIPTION |
---|---|
system_info
|
Pydantic System Info Model.
TYPE:
|
get_temperatures ¶
Get psutil.sensors_temperatures()
RETURNS | DESCRIPTION |
---|---|
ret
|
List[MSATemperatures] = []
TYPE:
|
Created: September 24, 2022