Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always create rrd folder on localhost #15457

Merged
merged 1 commit into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions LibreNMS/Data/Store/Rrd.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -524,10 +523,9 @@ public function getRrdApplicationArrays($device, $app_id, $app_name, $category =
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);
}
Expand Down
2 changes: 1 addition & 1 deletion LibreNMS/Poller.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ private function initDevice(int $device_id): void
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");
Expand Down