Name
- system.fs.inodes.total
- inode (unit)
- The total number of inodes.
- system.fs.inodes.used
- inode (unit)
- The number of inodes in use.
- system.fs.inodes.free
- inode (unit)
- The number of free inodes.
- system.fs.inodes.in_use
- fraction (unit)
- The number of inodes in use as a fraction of the total.
计算方式
通过Python的模块os
来实现
import psutil
import os
# parts = [sdiskpart(device='rootfs', mountpoint='/', fstype='rootfs', opts='rw')]
parts = psutil.disk_partitions(all=True)
for part in parts:
# posix.statvfs_result(f_bsize=4096, f_frsize=4096, f_blocks=2618624, f_bfree=2441314, f_bavail=2441314, f_files=5242368, f_ffree=5216866, f_favail=5216866, f_flag=4096, f_namemax=255)
inodes = os.statvfs(part.mountpoint)
total = inodes.f_files
free = inodes.f_ffree
system.fs.inodes.total = total
system.fs.inodes.free = free
system.fs.inodes.used = total - free
system.fs.inodes.in_use = (total - free) / total
网友评论