mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Always create rrd folder on localhost (#15457)
for some reason rrdcached cannot create folders when it is running on localhost Always create directories on the local poller in case rrdcached is running on the same machine A few small changes to checkRrdExists() too
This commit is contained in:
@@ -26,7 +26,6 @@
|
||||
namespace LibreNMS\Data\Store;
|
||||
|
||||
use App\Polling\Measure\Measurement;
|
||||
use Illuminate\Support\Str;
|
||||
use LibreNMS\Config;
|
||||
use LibreNMS\Exceptions\FileExistsException;
|
||||
use LibreNMS\Exceptions\RrdGraphException;
|
||||
@@ -524,10 +523,9 @@ class Rrd extends BaseDatastore
|
||||
public function checkRrdExists($filename)
|
||||
{
|
||||
if ($this->rrdcached && version_compare($this->version, '1.5', '>=')) {
|
||||
$chk = $this->command('last', $filename, '');
|
||||
$filename = str_replace([$this->rrd_dir . '/', $this->rrd_dir], '', $filename);
|
||||
$check_output = implode($this->command('last', $filename, ''));
|
||||
|
||||
return ! Str::contains(implode($chk), "$filename': No such file or directory");
|
||||
return ! (str_contains($check_output, $filename) && str_contains($check_output, 'No such file or directory'));
|
||||
} else {
|
||||
return is_file($filename);
|
||||
}
|
||||
|
||||
+1
-1
@@ -278,7 +278,7 @@ class Poller
|
||||
private function initRrdDirectory(): void
|
||||
{
|
||||
$host_rrd = \Rrd::name($this->device->hostname, '', '');
|
||||
if (Config::get('rrd.enable', true) && ! Config::get('rrdcached') && ! is_dir($host_rrd)) {
|
||||
if (Config::get('rrd.enable', true) && ! is_dir($host_rrd)) {
|
||||
try {
|
||||
mkdir($host_rrd);
|
||||
$this->logger->info("Created directory : $host_rrd");
|
||||
|
||||
Reference in New Issue
Block a user