Error creating new service template

Hello everybody.

I have installed Librenms for a few days and I am very happy with it, thank you very much.

I cannot create a new template service, I still have an application error.
I have tested several combinations but nothing seems to work.

Here is my configuration
Version 21.2.0-1-g01019cfc0 - Tue Feb 16 2021 06:45:56 GMT+0100
Database Schema 2021_02_09_084318_remove_perf_times (199)
Web Server nginx/1.14.2
PHP 7.3.19-1~deb10u1
Python 3.7.3
MySQL 10.3.27-MariaDB-0+deb10u1
Laravel 8.27.0
RRDtool 1.7.1

Here is the error

# Whoops, looks like something went wrong. Check your librenms.log.

Check your log for more details. (librenms.log)

If you need additional help, you can find how to get help at https://docs.librenms.org/Support.

Here is the librenms.log

[2021-02-18 12:38:54] production.ERROR: Undefined index: rules {“userId”:1,“exception”:"[object] (ErrorException(code: 0): Undefined index: rules at /opt/librenms/LibreNMS/Alerting/QueryBuilderParser.php:116)`
[stacktrace]
#0 /opt/librenms/LibreNMS/Alerting/QueryBuilderParser.php(116): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, ‘Undefined index…’, ‘/opt/librenms/L…’, 116, Array)
#1 /opt/librenms/LibreNMS/Alerting/QueryBuilderParser.php(100): LibreNMS\Alerting\QueryBuilderParser->findTablesRecursive(Array)
#2 /opt/librenms/LibreNMS/Alerting/QueryBuilderParser.php(375): LibreNMS\Alerting\QueryBuilderParser->getTables()
#3 /opt/librenms/LibreNMS/Alerting/QueryBuilderFluentParser.php(176): LibreNMS\Alerting\QueryBuilderParser->generateGlue()
#4 /opt/librenms/app/Models/ServiceTemplate.php(76): LibreNMS\Alerting\QueryBuilderFluentParser->generateJoins()
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(392): App\Models\ServiceTemplate::App\Models\{closure}(Object(App\Models\ServiceTemplate))
#6 /opt/librenms/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(237): Illuminate\Events\Dispatcher->Illuminate\Events\{closure}(‘eloquent.saving…’, Array)
#7 /opt/librenms/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(210): Illuminate\Events\Dispatcher->dispatch(‘eloquent.saving…’, Array, true)
#8 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Concerns/HasEvents.php(189): Illuminate\Events\Dispatcher->until(‘eloquent.saving…’, Object(App\Models\ServiceTemplate))
#9 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(841): Illuminate\Database\Eloquent\Model->fireModelEvent(‘saving’)
#10 /opt/librenms/app/Http/Controllers/ServiceTemplateController.php(106): Illuminate\Database\Eloquent\Model->save()
#11 /opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): App\Http\Controllers\ServiceTemplateController->store(Object(Illuminate\Http\Request))
#12 /opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\Routing\Controller->callAction(‘store’, Array)
#13 /opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Route.php(254): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\ServiceTemplateController), ‘store’)
#14 /opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Route.php(197): Illuminate\Routing\Route->runController()
#15 /opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Router.php(693): Illuminate\Routing\Route->run()
#16 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#17 /opt/librenms/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authorize.php(45): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#18 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Auth\Middleware\Authorize->handle(Object(Illuminate\Http\Request), Object(Closure), ‘create’, ‘App\\Models\\Serv…’)
#19 /opt/librenms/app/Http/Middleware/LoadUserPreferences.php(30): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#20 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\LoadUserPreferences->handle(Object(Illuminate\Http\Request), Object(Closure))
#21 /opt/librenms/app/Http/Middleware/VerifyTwoFactor.php(39): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#22 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\VerifyTwoFactor->handle(Object(Illuminate\Http\Request), Object(Closure))
#23 /opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#24 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#25 /opt/librenms/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(44): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#26 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Auth\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
#27 /opt/librenms/app/Http/Middleware/LegacyExternalAuth.php(42): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#28 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\LegacyExternalAuth->handle(Object(Illuminate\Http\Request), Object(Closure))
#29 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(78): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#30 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#31 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#32 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#33 /opt/librenms/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(121): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#34 /opt/librenms/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(63): Illuminate\Session\Middleware\StartSession->handleStatefulRequest(Object(Illuminate\Http\Request), Object(Illuminate\Session\Store), Object(Closure))
#35 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#36 /opt/librenms/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#37 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#38 /opt/librenms/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(67): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#39 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#40 /opt/librenms/app/Http/Middleware/CheckInstalled.php(61): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#41 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): App\Http\Middleware\CheckInstalled->handle(Object(Illuminate\Http\Request), Object(Closure))
#42 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#43 /opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Router.php(695): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#44 /opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Router.php(670): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#45 /opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Router.php(636): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))
#46 /opt/librenms/vendor/laravel/framework/src/Illuminate/Routing/Router.php(625): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#47 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(166): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#48 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#49 /opt/librenms/vendor/genealabs/laravel-caffeine/src/Http/Middleware/LaravelCaffeineDripMiddleware.php(11): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#50 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): GeneaLabs\LaravelCaffeine\Http\Middleware\LaravelCaffeineDripMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#51 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#52 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#53 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(21): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#54 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))
#55 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#56 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))
#57 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php(86): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#58 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(Object(Illuminate\Http\Request), Object(Closure))
#59 /opt/librenms/vendor/fruitcake/laravel-cors/src/HandleCors.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#60 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fruitcake\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))
#61 /opt/librenms/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#62 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(167): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))
#63 /opt/librenms/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#64 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(141): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#65 /opt/librenms/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#66 /opt/librenms/html/index.php(52): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#67 {main}
"}

====================================
Component | Version
--------- | -------
LibreNMS  | 21.2.0-1-g01019cfc0
DB Schema | 2021_02_09_084318_remove_perf_times (199)
PHP       | 7.3.19-1~deb10u1
Python    | 3.7.3
MySQL     | 10.3.27-MariaDB-0+deb10u1
RRDTool   | 1.7.1
SNMP      | NET-SNMP 5.7.3
====================================

[OK]    Composer Version: 2.0.9
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct

and config.php

# Enable the in-built services support (Nagios plugins)
$config['show_services'] = 1;
$config['discover_services'] = true;
$config['discover_services_templates'] = true;
$config['nagios_plugins'] = "/usr/lib/nagios/plugins";
$config['service_poller_enabled'] = true;
$config['service_poller_workers'] = 16;
$config['service_poller_frequency'] = 300;
$config['service_poller_down_retry'] = 5;
$config['service_discovery_enabled'] = true;
$config['service_discovery_workers'] = 16;
$config['service_discovery_frequency'] = 3600;
$config['service_services_enabled'] = true;
$config['service_services_workers'] = 16;
$config['service_services_frequency'] = 60;
1 Like

I’m having the same problem with a newer version:

Component Version
LibreNMS 21.2.0-8-g3d5f4bdad
DB Schema 2021_02_21_203415_location_add_fixed_coordinates_flag (200)
PHP 7.4.3
Python 3.8.5
MySQL 10.3.25-MariaDB-0ubuntu0.20.04.1
RRDTool 1.7.2
SNMP NET-SNMP 5.8

Same error

Version 21.2.0-18-g4ae452640 - Sun Feb 28 2021 07:04:42 GMT+0800
Database Schema 2021_02_21_203415_location_add_fixed_coordinates_flag (200)
Web Server Apache/2.4.41 (Ubuntu)
PHP 7.4.3
Python 3.8.5
MySQL 5.7.33
Laravel 8.27.0
RRDtool 1.7.21.7.2

Hi All, thanks for the report, sorry for the delay in responding.
I’m looking into this now, hopefully will have a fix soon.

1 Like

It may not be related to the “looks like something went wrong” error that others have reported, but I am getting an error when trying to set up a template based on dynamic device rules. It’s showing:

The drules field is required when dtype is dynamic

but the device rules section is populated

Form before saving

Form after

I just happened to hit the same bug. Unable to create a Service Template, no matter what I’m entering in the form. It’s always a

“The drules field is required when dtype is dynamic.”

No error in any logfile, though.