美文网首页监控采集
system.fs.inodes Metrics from Da

system.fs.inodes Metrics from Da

作者: xufeibuaa | 来源:发表于2018-08-29 20:23 被阅读26次

    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
    

    相关文章

      网友评论

        本文标题:system.fs.inodes Metrics from Da

        本文链接:https://www.haomeiwen.com/subject/kgokwftx.html