-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
bug - Component "error" length issue - WIP #15918
base: master
Are you sure you want to change the base?
Conversation
Shouldnt the field be extended instead? |
The field contains the vip name that can be almost any length. So extending it will not solve the issue, only make it less frequent. And whatever length we choose, we need to ensure that we don't try any longer string. |
LibreNMS/Component.php
Outdated
@@ -229,6 +229,15 @@ public function setComponentPrefs($device_id, $updated) | |||
|
|||
// update component attributes | |||
$component->fill($update); | |||
// sanity check | |||
if (! is_null($component->error)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be better to put these in the model as mutators?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good occasion to learn how a mutator works :) just had a look at the doc and it makes sense indeed.
Will send a patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @murrant
Seems that my mutators do not get called. I still receive the Exceptions if I disable the sanity check in the LTM poller code (includes/polling/loadbalancers/f5-ltm.inc.php) .
Error polling loadbalancers module for xxxxxxxxxxx. PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'error' at row 1 in /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php:612
Stack trace:
#0 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(612): PDOStatement->execute()
#1 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(816): Illuminate\Database\Connection->Illuminate\Database\{closure}('update `compone...', Array)
#2 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(783): Illuminate\Database\Connection->runQueryCallback('update `compone...', Array, Object(Closure))
#3 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(619): Illuminate\Database\Connection->run('update `compone...', Array, Object(Closure))
#4 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(552): Illuminate\Database\Connection->affectingStatement('update `compone...', Array)
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(3487): Illuminate\Database\Connection->update('update `compone...', Array)
#6 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1060): Illuminate\Database\Query\Builder->update(Array)
#7 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1213): Illuminate\Database\Eloquent\Builder->update(Array)
#8 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1130): Illuminate\Database\Eloquent\Model->performUpdate(Object(Illuminate\Database\Eloquent\Builder))
#9 /opt/librenms/LibreNMS/Component.php(270): Illuminate\Database\Eloquent\Model->save()
#10 /opt/librenms/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(240): LibreNMS\Component->LibreNMS\{closure}(Object(App\Models\Component), 453)
#11 /opt/librenms/LibreNMS/Component.php(301): Illuminate\Support\Collection->each(Object(Closure))
#12 /opt/librenms/includes/polling/loadbalancers/f5-ltm.inc.php(214): LibreNMS\Component->setComponentPrefs(566, Array)
#13 /opt/librenms/includes/polling/loadbalancers.inc.php(13): include('/opt/librenms/i...')
#14 /opt/librenms/LibreNMS/Modules/LegacyModule.php(114): include('/opt/librenms/i...')
#15 /opt/librenms/LibreNMS/Poller.php(176): LibreNMS\Modules\LegacyModule->poll(Object(LibreNMS\OS\F5), Object(LibreNMS\Data\Store\Datastore))
#16 /opt/librenms/LibreNMS/Poller.php(103): LibreNMS\Poller->pollModules()
#17 /opt/librenms/app/Console/Commands/DevicePoll.php(45): LibreNMS\Poller->poll()
#18 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Commands\DevicePoll->handle(Object(App\Polling\Measure\MeasurementManager))
#19 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#20 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#21 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#22 /opt/librenms/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#23 /opt/librenms/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\Container\Container->call(Array)
#24 /opt/librenms/vendor/symfony/console/Command/Command.php(326): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#25 /opt/librenms/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#26 /opt/librenms/vendor/symfony/console/Application.php(1096): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /opt/librenms/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(App\Console\Commands\DevicePoll), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /opt/librenms/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#29 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#30 /opt/librenms/app/Console/Kernel.php(66): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#31 /opt/librenms/lnms(40): App\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#32 {main}
This DB field is limited to 255 chars currently. This PR checks for longer strings to avoid errors.
DO NOT DELETE THE UNDERLYING TEXT
Please note
Testers
If you would like to test this pull request then please run:
./scripts/github-apply <pr_id>
, i.e./scripts/github-apply 5926
After you are done testing, you can remove the changes with
./scripts/github-remove
. If there are schema changes, you can ask on discord how to revert.