statux的Python项目详细描述
statux是一个用于linux的python库,它提供了获取硬件的方法
以及系统信息。用于监视任务。
电池
Method | Returns |
^{tt1}$ | Manufacturer, model and s/n |
^{tt2}$ | Full, Charging or Discharging |
^{tt3}$ | True if battery is present |
^{tt4}$ | battery voltage (mV) |
^{tt5}$ | battery current (mA) |
^{tt6}$ | battery energy (mWh) |
^{tt7}$ | battery power (mW) |
^{tt8}$ | battery charge (mAh) |
^{tt9}$ | current capacity percent |
^{tt10}$ | Full, Normal, Low or Critical |
^{tt11}$ | value set for low battery level |
^{tt12}$ | value set for critical level |
^{tt13}$ | value set for critical action |
^{tt14}$ | PowerOff, Hibernate or HybridSleep |
^{tt15}$ | Remaining battery life |
^{tt16}$ | Battery health level |
^{tt17}$ | Chemistry of battery |
^{tt18}$ | Battery, Mains, UPS, etc |
^{tt19}$ | Open or Close |
^{tt20}$ | True if AC adapter is online |
CPU
Method | Returns |
^{tt21}$ | CPU Load percentage. Note: Needs
to instantiate ^{tt22}$ class |
^{tt23}$ | Number of logical processors |
^{tt24}$ | Number of physical processor |
^{tt25}$ | Current CPU frequency |
^{tt26}$ | CPU max frequency |
^{tt27}$ | Current CPU frequency percent |
^{tt28}$ | True if CPU is AMD64 or Intel64
i.e. 64 bit capable |
^{tt29}$ | CPU model name |
磁盘
Method | Returns |
^{tt30}$ | sda, sdb, nvmen1, hda, hdb, etc |
^{tt31}$ | sda1,sda2, sdb1, nvmen1p1, hda1, hdb2, etc |
^{tt32}$ | If block device is rotational |
^{tt33}$ | If block device is removable |
^{tt34}$ | Model name of the given device (sda, hdb..) |
^{tt35}$ | a namedtuple with persistent names of a
disk or a partition (id, label, path, uuid
partlabel and partuuid) |
^{tt36}$ | A dict with mounted partitions as key and a
namedtuple with mount point, filesystem and
mount options as value |
^{tt37}$ | mounted partitions and mount points |
^{tt38}$ | Total size of a partition |
^{tt39}$ | Free space of a partition |
^{tt40}$ | Used space of a partition |
^{tt41}$ | Used space percent of a partition |
^{tt42}$ | Bytes read in a partition |
^{tt43}$ | Bytes written in a partition |
^{tt44}$ | Bytes read and wirtten in a partition |
^{tt45}$ | Bytes read and writen in several partitions |
网络
Method | Returns |
^{tt46}$ | All network interfaces |
^{tt47}$ | total bytes downloaded in a interface |
^{tt48}$ | total bytes uploaded in a interface |
^{tt49}$ | total bytes up-downloaded in a interface |
^{tt47}$ | average download speed per second |
^{tt51}$ | average download speed per second |
^{tt52}$ | average up-download speed per second |
内存
Method | Returns |
^{tt53}$ | Total RAM size |
^{tt54}$ | Free RAM |
^{tt55}$ | Free RAM percent |
^{tt56}$ | Available RAM |
^{tt57}$ | Available RAM percent |
^{tt58}$ | Buffer, cached and slab memory |
^{tt59}$ | Used RAM |
^{tt60}$ | Used RAM percent |
系统
Method | Returns |
^{tt61}$ | Time at which the system booted |
^{tt62}$ | Time elapsed since system boot time |
^{tt63}$ | Init system name |
^{tt64}$ | Hostname |
^{tt65}$ | User name |
^{tt66}$ | Kernel release |
^{tt67}$ | Kernel version |
^{tt68}$ | Machine type |
^{tt69}$ | Current session id |
^{tt70}$ | Distro short name |
^{tt71}$ | Full distro description |
^{tt72}$ | Distro version |
^{tt73}$ | Distro url |
^{tt74}$ | Distro info (id, version, codename) |
温度
Method | Returns |
^{tt75}$ | temperature of each core |
^{tt76}$ | CPU temp |
^{tt77}$ | maximum value of the temp sensors obtained |
注:
这些方法基于proc和sys文件系统,并在linux 4.15中进行了测试。
有些方法可能在以前的内核版本中不可用
安装:
通过pip(可能不是最新版本):
pip install statux
克隆此回购:
git clone https://github.com/Arg0s1080/statux.git
cd statux
sudo python3 setup.py install
欢迎加入QQ群-->: 979659372
推荐PyPI第三方库