0

我在运行 Ubuntu 16.04 的机器上使用 Librato 的 collectd 5.5 版来collect衡量使用指标。但是,在我的一个集群中,我无法让df插件报告所有可用空间。//home

如您所见,这些挂载点位于不同的ext4分区中。/我预计它会分别报告 17G和1.7T 可用/home。尽管我正确收到了与 关联的空间/,但它报告了大约 4GB 的/home.

$ df -h 
Filesystem Size Used Avail Use% Mounted on 
/dev/root  20G  1.4G 17G   8%   / 
devtmpfs   3.9G 0    3.9G  0%   /dev 
tmpfs      3.9G 0    3.9G  0%   /dev/shm 
tmpfs      3.9G 125M 3.8G  4%   /run 
tmpfs      5.0M 0    5.0M  0%   /run/lock 
tmpfs      3.9G 0    3.9G  0%   /sys/fs/cgroup 
/dev/sda3  1.8T 8.9G 1.7T  1%   /home 
tmpfs      789M 0    789M  0%   /run/user/0

$ cat /etc/fstab 
# <file system> <mount point> <type> <options> <dump> <pass> 
/dev/sda2       /             ext4   errors=remount-ro,relatime 0 1 
/dev/sda3       /home         ext4   defaults,relatime 1 2 
/dev/sda4       swap          swap   defaults 0 0 
proc            /proc         proc   defaults 0 0 
sysfs           /sys          sysfs  defaults 0 0 
devtmpfs        /dev          devtmpfs rw 0 0

这是我当前关于 df 的配置:

<Plugin "df"> 
    MountPoint "/" 
    MountPoint "/home" 
</Plugin>

...

LoadPlugin "match_regex"

<Chain "PostCache"> 
    <Rule "ignore_df_reserved_used_metrics"> 
        <Match "regex"> 
            Plugin "^df" 
            TypeInstance "^(reserved|used)" 
        </Match> 
        Target "stop" 
    </Rule>

    # Default behavior 
    Target "write" 
</Chain>

我已经尝试了几种配置组合(以及df一遍又一遍地阅读插件文档),当只使用如下的 FSType 时,我收到了几个测量值(usr, boot, bin, lib, lib64, root...),所有报告的大小都相同关于17G. 此外,没有测量home

<Plugin df>
  FSType "ext4"
</Plugin>

我也尝试过将 FSType 与 一起使用MountPoint "/",但root当时才被报告。

我最后一次尝试是Device在配置中使用,但它没有改变任何东西。

<Plugin "df">
  Device "/dev/sda2"
  Device "/dev/sda3"
  MountPoint "/"
  MountPoint "/home"
  FSType "ext4"
  IgnoreSelected false
  ReportInodes false
</Plugin>

在所有尝试中,collectd不会在其日志中显示任何错误:

[2017-01-13 17:06:15] Exiting normally.
[2017-01-13 17:06:15] collectd: Stopping 5 read threads.
[2017-01-13 17:06:15] collectd: Stopping 5 write threads.
[2017-01-13 17:06:15] supervised by systemd, will signal readyness
[2017-01-13 17:06:15] Initialization complete, entering read-loop.

你有什么建议吗?

4

1 回答 1

1

事实证明,可能collectd 在他们的最新版本5.7 中修复了这个错误,该版本在 Ubuntu 16.04 中apt-get尚不可用。通过下载并安装他们最新的夜间版本df开始报告正确的值。

于 2017-02-20T18:49:32.213 回答