Python Psutil Module

Source: Internet
Author: User

Psutil A module is a library of cross-platform acquisition processes and system applications (CPU, memory, disk, network, sensor). This module is used for system monitoring, restricting the management of process resources and running processes.

Psutil implements many UNIX platform command lines (ps|top|lsof|netstat|ifconfig|who|df|kill|free|nice|ionice|iostat|iotop|uptime|pidof|tty| taskset|pmap|) function similar to the function, easy to use.

http://psutil.readthedocs.io/en/latest/

1. CPU

1 psutil.cpu_times (percpu=false)

Returns the CPU usage time ancestor. If percpu=true, returns the list of usage for each CPU.

1 # Return CPU Utilization 2 psutil.cpu_times_percent (Interval=none, percpu=False)3 psutil.cpu_count (logical=true )   # Returns the system logic CPU4 psutil.cpu_stats ()              # returns statistics for the CPU 5 psutil.cpu_freq (percpu=false)   # Returns the frequency of the CPU

2. Memory

1 psutil.virtual_memory ()         # returns statistics about system memory usage 2 psutil.swap_memory ()            # returns system swap memory statistics

3. Disk

1 psutil.disk_partitions (all=false)       # returns all mounted disk devices, including devices, mount points drink a list of file system meta-ancestors 2 Psutil.disk_usage (path)                 # returns disk statistics 3 psutil.disk_io_counters (Perdisk=false, nowrap= True)     # returns disk IO statistics

4. Network

1 psutil.net_io_counters (pernic=false)        # return to System network IO statistics 2 psutil.net_ Connections (kind='inet')         # return system socket connection 3 Psutil.net_if_addrs ()                       # returns the Nic-bound IP, subnet mask, broadcast address 4 psutil.net_if_stats ()                       # returns information about the NIC

5. Sensor

1 psutil.sensors_temperatures (fahrenheit=false)       # returns the hardware temperature 2 psutil.sensors _fans ()                               # return hardware fan speed 3 psutil.sensors_battery ()                            # return battery status

6. Other

1 psutil.boot_time ()          # system boot time 2 psutil.users ()              # List of users connected to the system

Python Psutil Module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.