Expose inode-related metrics

Test Plan: - Check `:9100/metrics` for existence of inode-related metrics

Reviewers: h.marvi, mhyousefi

Reviewed By: h.marvi

Differential Revision: https://phab.hamravesh.ir/D816
This commit is contained in:
Mehran Kholdi 2020-06-12 15:55:37 +04:30
parent 8e5cb5de78
commit be2cd1b72c

View File

@ -23,6 +23,16 @@ class VolumeStatsCollector(object):
"Filesystem free space in bytes", "Filesystem free space in bytes",
labels=[VOLUME_ID], labels=[VOLUME_ID],
) )
fs_files = GaugeMetricFamily(
"rawfile_filesystem_files",
"Filesystem total file nodes.",
labels=[VOLUME_ID],
)
fs_files_free = GaugeMetricFamily(
"rawfile_filesystem_files_free",
"Filesystem total free file nodes",
labels=[VOLUME_ID],
)
dev_size = GaugeMetricFamily( dev_size = GaugeMetricFamily(
"rawfile_device_size_bytes", "Device size in bytes.", labels=[VOLUME_ID] "rawfile_device_size_bytes", "Device size in bytes.", labels=[VOLUME_ID]
) )
@ -43,8 +53,10 @@ class VolumeStatsCollector(object):
fs_stat = os.statvfs(mountpoint) fs_stat = os.statvfs(mountpoint)
fs_size.add_metric(labels, fs_stat.f_frsize * fs_stat.f_blocks) fs_size.add_metric(labels, fs_stat.f_frsize * fs_stat.f_blocks)
fs_free.add_metric(labels, fs_stat.f_frsize * fs_stat.f_bfree) fs_free.add_metric(labels, fs_stat.f_frsize * fs_stat.f_bfree)
fs_files.add_metric(labels, fs_stat.f_files)
fs_files_free.add_metric(labels, fs_stat.f_ffree)
return [fs_size, fs_free, dev_size, dev_free] return [fs_size, fs_free, fs_files, fs_files_free, dev_size, dev_free]
def volume_to_mountpoint(img_file): def volume_to_mountpoint(img_file):