Log spam: Failed to create rrd directory - happens on every poll

Hi everyone,

Long standing issue here that I can live with but sometimes I really want it fixed. My event log is continually spammed with these lines every time every device is polled:

Failed to create rrd directory: /data/librenms/rrd/<device_name>/

It’s not permissions. I’m a sysadmin and know how to check this, and LibreNMS itself is working just fine. Devices get discovered and polled, graphing is fine and works, alerts work. It’s almost as if it is a purely cosmetic false positive error.

In app/Jobs/PollDevice.php there is a function that looks like it is responsible:

private function initRrdDirectory(): void
    {
        $host_rrd = \Rrd::name($this->device->hostname, '', '');
        if (Config::get('rrd.enable', true) && ! is_dir($host_rrd)) {
            try {
                mkdir($host_rrd);
                Log::info("Created directory : $host_rrd");
            } catch (\ErrorException $e) {
                Eventlog::log("Failed to create rrd directory: $host_rrd", $this->device);
                Log::error($e);
            }
        }
    }

But this is not it. I can comment out the body and nothing changes, the log spam continues. This is also the only file returned by grepping the entire codebase for the error.

This error is being generated somewhere else.
Does anyone know where?

My install is very standard with one exception: rrds are not stored in ./rrd, they are in /data/librenms/rrd and /data is a mountpoint. FS type is XFS.
This is a corporate environment and I must follow my own standards. I update mostly monthly and am one version behind - I need change approval for a code update. None of this should make any difference though.

$ ./validate.php

Component Version
LibreNMS 25.2.0 (2025-02-20T12:55:43+02:00)
DB Schema 2025_01_30_000121_add_ifindex_index_to_ports_table (315)
PHP 8.2.25
Python 3.9.21
Database MariaDB 10.5.27-MariaDB
RRDTool 1.7.2
SNMP 5.9.1
===========================================

[OK] Composer Version: 2.6.6
[OK] Dependencies up-to-date.
[OK] Database connection successful
[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 and column collations are correct
[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] rrd_dir is writable
[OK] rrdtool version ok

OK, this appears to be solved now.

I grep’ed for “rrd/” in /opt/librenms and what came back looked very much like hardcoded paths or perhaps string defaults. So on a hunch I created /opt/librenms/rrd as a symlink to the real storage and changed RRD Location to default.

My issue has gone away, no more spam in event log and it has been 5 poll intervals now.

Could someone with knowledge of the code base replace these hardcoded paths with vars please? I can pay you in beer :smiley:

Do you have an example of where you’ve seen it hard coded to save me checking :slight_smile:

Did you set rrd_dir correctly? What is it currently set to?