Disk space shows wrong values


I have a problem with fetching of disk values.

this is the result array of ./poller.php -h client.hostname.tld -m storage -d for the main disk:

array (
  'storage_id' => 4209,
  'device_id' => 165,
  'storage_mib' => 'hrstorage',
  'storage_index' => '31',
  'storage_type' => 'hrStorageFixedDisk',
  'storage_descr' => '/',
  'storage_size' => 63223939072,
  'storage_units' => 4096,
  'storage_used' => 55938183168,
  'storage_free' => 7285755904,
  'storage_perc' => 88,
  'storage_perc_warn' => 60,
  'storage_deleted' => 0,
  'units' => '4096',
  'used' => 55939096576,
  'size' => 63223939072,
  'free' => 7284842496,

while the output of df -B 1 / shows:

Filesystem       1B-blocks        Used  Available Use% Mounted on
/dev/sdb1      63223939072 55940132864 4045864960  94% /

You see, the values for “size” and “used” are correctly fetched (with minor shift in “used” value due to data fetch delay), but the value for “free” is massively wrong.

The LibreNMS server and the client both run on Debian 11, and here’s the validate.php:

Component | Version
--------- | -------
LibreNMS  | 22.10.0-11-ga166df006 (2022-10-21T17:05:49+02:00)
DB Schema | 2022_09_03_091314_update_ports_adsl_table_with_defaults (246)
PHP       | 8.1.10
Python    | 3.9.2
Database  | MariaDB 10.5.15-MariaDB-0+deb11u1
RRDTool   | 1.7.2
SNMP      | 5.9

[OK]    Composer Version: 2.4.3
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database Schema is current
[OK]    SQL Server meets minimum requirements
[OK]    lower_case_table_names is enabled
[OK]    MySQL engine is optimal
[OK]    Database schema correct
[OK]    MySQl and PHP time match
[OK]    Active pollers found
[OK]    Dispatcher Service not detected
[OK]    Locks are functional
[OK]    Python poller wrapper is polling
[OK]    Redis is unavailable
[OK]    rrdtool version ok
[OK]    Connected to rrdcached

any idea where this comes from?

Update: After further investigation I might have found the reason for this.

LibreNMS takes the overall size and the used size of the filesystem and counts the remaining space itself, instead of fetching it from the device.

This leads to the difference, because the filesystem has a portion of its size reserved for root:

[email protected]:~# tune2fs -l /dev/sdb1 |grep -i reserve
Reserved block count:     786417
Reserved GDT blocks:      1019
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
[email protected]:~#

So, df does take this in account and shows the values based on the net size, but LibreNMS does ignore the reservation, which is going to be a problem when using LibreNMS for monitoring and alarming purpose (e.g. warnings at 90% disk space for example will be too late).

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.