system.fs.inodes Metrics from DataDog Agent

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
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 从离别开始 恋上自己 没有一刻不在想你 专注的想你的好 想你的坏 想着你的离开 时空无限的拉长爱的距离 从离别开始...
    梅园遗珠阅读 256评论 3 9
  • 突然安静下来,好像有些不知所措。诗和远方,太美好太遥不可及。大概唯一能触碰的就是当下了。想要做个腹有诗书气自华的女...
    BQdleking阅读 319评论 1 0
  • 每个人在小的时候,一定都会有些一些按着其他要求你的规律所形成的梦想。就像警察,护士,医生,但不会是超人。 慢慢随着...
    咕咕幺儿阅读 234评论 0 0