From 58a154d894ab8b11eda2e2a831bbb151cddcf878 Mon Sep 17 00:00:00 2001 From: Jellyfrog Date: Tue, 23 Mar 2021 23:08:42 +0100 Subject: [PATCH] Fix a bunch of bugs (#12643) --- LibreNMS/Alert/AlertUtil.php | 2 +- LibreNMS/Alert/Transport/Boxcar.php | 2 +- LibreNMS/Alert/Transport/Telegram.php | 3 +-- LibreNMS/Component.php | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/LibreNMS/Alert/AlertUtil.php b/LibreNMS/Alert/AlertUtil.php index 1285df4050..5065e3385b 100644 --- a/LibreNMS/Alert/AlertUtil.php +++ b/LibreNMS/Alert/AlertUtil.php @@ -221,7 +221,7 @@ class AlertUtil */ public static function runMacros($rule, $x = 1) { - $macros = Config::get('alert.macros.rule', []) . + $macros = Config::get('alert.macros.rule', []); krsort($macros); foreach ($macros as $macro => $value) { if (! strstr($macro, ' ')) { diff --git a/LibreNMS/Alert/Transport/Boxcar.php b/LibreNMS/Alert/Transport/Boxcar.php index 38a45a126c..37f023e353 100644 --- a/LibreNMS/Alert/Transport/Boxcar.php +++ b/LibreNMS/Alert/Transport/Boxcar.php @@ -76,7 +76,7 @@ class Boxcar extends Transport $data['notification[sound]'] = $api['sound_ok']; } break; - case AlertState::Active: + case AlertState::ACTIVE: $title_text = $severity; break; case AlertState::ACKNOWLEDGED: diff --git a/LibreNMS/Alert/Transport/Telegram.php b/LibreNMS/Alert/Transport/Telegram.php index 5a511334f8..7d8a407b77 100644 --- a/LibreNMS/Alert/Transport/Telegram.php +++ b/LibreNMS/Alert/Transport/Telegram.php @@ -54,8 +54,7 @@ class Telegram extends Transport $ret = curl_exec($curl); $code = curl_getinfo($curl, CURLINFO_HTTP_CODE); if ($code != 200) { - var_dump("API '$host' returned Error"); //FIXME: propper debuging - var_dump('Params: ' . $api); //FIXME: propper debuging + var_dump('Telegram returned Error'); //FIXME: propper debuging var_dump('Return: ' . $ret); //FIXME: propper debuging return 'HTTP Status code ' . $code . ', Body ' . $ret; diff --git a/LibreNMS/Component.php b/LibreNMS/Component.php index 17b737d86b..4211ec123a 100644 --- a/LibreNMS/Component.php +++ b/LibreNMS/Component.php @@ -220,7 +220,7 @@ class Component \App\Models\Component::whereIn('id', array_keys($updated)) ->with('prefs') ->get() - ->each(function (\App\Models\Component $component) use ($updated) { + ->each(function (\App\Models\Component $component) use ($device_id, $updated) { $update = $updated[$component->id]; unset($update['type']); // can't change type @@ -256,7 +256,7 @@ class Component $invalid->forget($existing->id); $existing->fill(['value' => $value]); if ($existing->isDirty()) { - Log::event("Component: $component->type($component->id). Attribute: $attribute, was modified from: " . $existing->getOriginal('value') . ", to: $value", $device_id, 'component', 3, $component_id); + Log::event("Component: $component->type($component->id). Attribute: $attribute, was modified from: " . $existing->getOriginal('value') . ", to: $value", $device_id, 'component', 3, $component->id); $existing->save(); } } else {