disk.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:sauna 作者: NicolasLM 项目源码 文件源码
def used_inodes_percent(self, check_config):
        check_config = self._strip_percent_sign_from_check_config(check_config)
        for part in self.psutil.disk_partitions(all=False):
            s = os.statvfs(part.mountpoint)
            try:
                inodes_usage = int((s.f_files - s.f_favail) * 100 / s.f_files)
            except ZeroDivisionError:
                continue
            status = self._value_to_status_less(
                inodes_usage, check_config, self._strip_percent_sign
            )
            if status != self.STATUS_OK:
                return (
                    status,
                    'Partition {} uses {}% of inodes'.format(part.mountpoint,
                                                             inodes_usage)
                )
        return self.STATUS_OK, 'Inodes usage correct'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号