Another test :
./scripts/test-alert.php -r 18 -h 4 -d
SQL[SELECT alerts.id, alerts.alerted, alerts.device_id, alerts.rule_id, alerts.state, alerts.note, alerts.info FROM alerts WHERE alerts.device_id = 4 && alerts.rule_id = 18 [] 0.36ms]
SQL[SELECT alert_log.id,alert_log.rule_id,alert_log.device_id,alert_log.state,alert_log.details,alert_log.time_logged,alert_rules.rule,alert_rules.severity,alert_rules.extra,alert_rules.name,alert_rules.query,alert_rules.builder,alert_rules.proc FROM alert_log,alert_rules WHERE alert_log.rule_id = alert_rules.id && alert_log.device_id = ? && alert_log.rule_id = ? && alert_rules.disabled = 0 ORDER BY alert_log.id DESC LIMIT 1 [4,18] 0.48ms]
SQL[SELECT DISTINCT a.* FROM alert_rules a
LEFT JOIN alert_device_map d ON a.id=d.rule_id AND (a.invert_map = 0 OR a.invert_map = 1 AND d.device_id = ?)
LEFT JOIN alert_group_map g ON a.id=g.rule_id AND (a.invert_map = 0 OR a.invert_map = 1 AND g.group_id IN (SELECT DISTINCT device_group_id FROM device_group_device WHERE device_id = ?))
LEFT JOIN alert_location_map l ON a.id=l.rule_id AND (a.invert_map = 0 OR a.invert_map = 1 AND l.location_id IN (SELECT DISTINCT location_id FROM devices WHERE device_id = ?))
LEFT JOIN devices ld ON l.location_id=ld.location_id AND ld.device_id = ?
LEFT JOIN device_group_device dg ON g.group_id=dg.device_group_id AND dg.device_id = ?
WHERE a.disabled = 0 AND (
(d.device_id IS NULL AND g.group_id IS NULL AND l.location_id IS NULL)
OR (a.invert_map = 0 AND (d.device_id=? OR dg.device_id=? OR ld.device_id=?))
OR (a.invert_map = 1 AND (d.device_id != ? OR d.device_id IS NULL) AND (dg.device_id != ? OR dg.device_id IS NULL) AND (ld.device_id != ? OR ld.device_id IS NULL))
) [4,4,4,4,4,4,4,4,4,4,4] 1.28ms]
SQL[select * from `devices` where `device_id` = ? limit 1 [4] 0.42ms]
SQL[select * from `locations` where `locations`.`id` = ? limit 1 [4] 0.27ms]
SQL[select * from `devices_attribs` where `devices_attribs`.`device_id` = ? and `devices_attribs`.`device_id` is not null [4] 0.29ms]
RRD[lastupdate 10.0.16.45/icmp-perf.rrd --daemon unix:/var/run/rrdcached.sock]
SQL[select * from `alert_templates` where exists (select * from `alert_template_map` where `alert_templates`.`id` = `alert_template_map`.`alert_templates_id` and `alert_rule_id` = ?) limit 1 [18] 0.56ms]
SQL[select * from `alert_templates` where `name` = ? limit 1 ["Default Alert Template"] 0.27ms]
Exception: ErrorException Attempt to read property "title" on null @ /opt/librenms/LibreNMS/Alert/RunAlerts.php:137
#0 /opt/librenms/LibreNMS/Alert/RunAlerts.php(137): App\Providers\ErrorReportingProvider->handleError()
#1 /opt/librenms/LibreNMS/Alert/RunAlerts.php(258): LibreNMS\Alert\RunAlerts->describeAlert()
#2 /opt/librenms/scripts/test-alert.php(28): LibreNMS\Alert\RunAlerts->issueAlert()
#3 {main}
SQL[select * from `cache` where `key` = ? limit 1 ["laravel_cache_runtimeCacheLibreNMS\\Util\\GitisAvailable"] 0.27ms]
SQL[select * from `cache` where `key` = ? limit 1 ["laravel_cache_runtimeCacheLibreNMS\\Util\\GitremoteUrl"] 0.26ms]
SQL[select * from `cache` where `key` = ? limit 1 ["laravel_cache_runtimeCacheLibreNMS\\Util\\GithasChanges"] 0.24ms]
SQL[select * from `cache` where `key` = ? limit 1 ["laravel_cache_runtimeCacheLibreNMS\\Util\\GitisOfficialCommit"] 0.24ms]
SQL[select * from `cache` where `key` = ? limit 1 ["laravel_cache_recently_reported_error"] 0.23ms]
Issuing Alert-UID #141/1:
SQL[SELECT `rule_id` FROM `alerts` WHERE `id`=? [77] 0.27ms]
SQL[SELECT b.transport_id, b.transport_type, b.transport_name FROM alert_transport_map AS a LEFT JOIN alert_transports AS b ON b.transport_id=a.transport_or_group_id WHERE a.target_type='single' AND a.rule_id=? UNION DISTINCT SELECT d.transport_id, d.transport_type, d.transport_name FROM alert_transport_map AS a LEFT JOIN alert_transport_groups AS b ON a.transport_or_group_id=b.transport_group_id LEFT JOIN transport_group_transport AS c ON b.transport_group_id=c.transport_group_id LEFT JOIN alert_transports AS d ON c.transport_id=d.transport_id WHERE a.target_type='group' AND a.rule_id=? [18,18] 0.54ms]
Exception: ErrorException Attempt to read property "template" on null @ /opt/librenms/LibreNMS/Alert/Template.php:78
#0 /opt/librenms/LibreNMS/Alert/Template.php(78): App\Providers\ErrorReportingProvider->handleError()
#1 /opt/librenms/LibreNMS/Alert/Template.php(65): LibreNMS\Alert\Template->bladeBody()
#2 /opt/librenms/LibreNMS/Alert/RunAlerts.php(521): LibreNMS\Alert\Template->getBody()
#3 /opt/librenms/LibreNMS/Alert/RunAlerts.php(262): LibreNMS\Alert\RunAlerts->extTransports()
#4 /opt/librenms/scripts/test-alert.php(28): LibreNMS\Alert\RunAlerts->issueAlert()
#5 {main}
Exception: ErrorException strlen(): Passing null to parameter #1 ($string) of type string is deprecated @ /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Component.php:173
#0 [internal function]: App\Providers\ErrorReportingProvider->handleError()
#1 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Component.php(173): strlen()
#2 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Component.php(150): Illuminate\View\Component->extractBladeViewFromString()
#3 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Component.php(156): Illuminate\View\Component->Illuminate\View\{closure}()
#4 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(333): Illuminate\View\Component->resolveView()
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\View\Compilers\BladeCompiler::render()
#6 /opt/librenms/LibreNMS/Alert/Template.php(78): Illuminate\Support\Facades\Facade::__callStatic()
#7 /opt/librenms/LibreNMS/Alert/Template.php(65): LibreNMS\Alert\Template->bladeBody()
#8 /opt/librenms/LibreNMS/Alert/RunAlerts.php(521): LibreNMS\Alert\Template->getBody()
#9 /opt/librenms/LibreNMS/Alert/RunAlerts.php(262): LibreNMS\Alert\RunAlerts->extTransports()
#10 /opt/librenms/scripts/test-alert.php(28): LibreNMS\Alert\RunAlerts->issueAlert()
#11 {main}
Exception: ErrorException trim(): Passing null to parameter #1 ($string) of type string is deprecated @ /opt/librenms/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php:75
#0 [internal function]: App\Providers\ErrorReportingProvider->handleError()
#1 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/FileViewFinder.php(75): trim()
#2 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Factory.php(286): Illuminate\View\FileViewFinder->find()
#3 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Component.php(173): Illuminate\View\Factory->exists()
#4 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Component.php(150): Illuminate\View\Component->extractBladeViewFromString()
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Component.php(156): Illuminate\View\Component->Illuminate\View\{closure}()
#6 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(333): Illuminate\View\Component->resolveView()
#7 /opt/librenms/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\View\Compilers\BladeCompiler::render()
#8 /opt/librenms/LibreNMS/Alert/Template.php(78): Illuminate\Support\Facades\Facade::__callStatic()
#9 /opt/librenms/LibreNMS/Alert/Template.php(65): LibreNMS\Alert\Template->bladeBody()
#10 /opt/librenms/LibreNMS/Alert/RunAlerts.php(521): LibreNMS\Alert\Template->getBody()
#11 /opt/librenms/LibreNMS/Alert/RunAlerts.php(262): LibreNMS\Alert\RunAlerts->extTransports()
#12 /opt/librenms/scripts/test-alert.php(28): LibreNMS\Alert\RunAlerts->issueAlert()
#13 {main}
Exception: ErrorException hash(): Passing null to parameter #2 ($data) of type string is deprecated @ /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Component.php:194
#0 [internal function]: App\Providers\ErrorReportingProvider->handleError()
#1 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Component.php(194): hash()
#2 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Component.php(177): Illuminate\View\Component->createBladeViewFromString()
#3 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Component.php(150): Illuminate\View\Component->extractBladeViewFromString()
#4 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Component.php(156): Illuminate\View\Component->Illuminate\View\{closure}()
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(333): Illuminate\View\Component->resolveView()
#6 /opt/librenms/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\View\Compilers\BladeCompiler::render()
#7 /opt/librenms/LibreNMS/Alert/Template.php(78): Illuminate\Support\Facades\Facade::__callStatic()
#8 /opt/librenms/LibreNMS/Alert/Template.php(65): LibreNMS\Alert\Template->bladeBody()
#9 /opt/librenms/LibreNMS/Alert/RunAlerts.php(521): LibreNMS\Alert\Template->getBody()
#10 /opt/librenms/LibreNMS/Alert/RunAlerts.php(262): LibreNMS\Alert\RunAlerts->extTransports()
#11 /opt/librenms/scripts/test-alert.php(28): LibreNMS\Alert\RunAlerts->issueAlert()
#12 {main}
:: Transport mail => SQL[select * from `alert_transports` where `alert_transports`.`transport_id` = ? limit 1 [8] 0.26ms]
Attempting to email Alert for device 10.0.16.45 - Device Down Due to no ICMP response. to: xxxxxxom
OKSQL[insert into `eventlog` (`reference`, `type`, `datetime`, `severity`, `message`, `username`, `device_id`) values (?, ?, ?, ?, ?, ?, ?) [null,"alert","2024-07-19 10:43:06",0,"Issued critical alert for rule 'Device Down Due to no ICMP response.' to transport 'mail'","",4] 0.36ms]
Exception: ErrorException Attempt to read property "template" on null @ /opt/librenms/LibreNMS/Alert/Template.php:78
#0 /opt/librenms/LibreNMS/Alert/Template.php(78): App\Providers\ErrorReportingProvider->handleError()
#1 /opt/librenms/LibreNMS/Alert/Template.php(65): LibreNMS\Alert\Template->bladeBody()
#2 /opt/librenms/LibreNMS/Alert/RunAlerts.php(521): LibreNMS\Alert\Template->getBody()
#3 /opt/librenms/LibreNMS/Alert/RunAlerts.php(262): LibreNMS\Alert\RunAlerts->extTransports()
#4 /opt/librenms/scripts/test-alert.php(28): LibreNMS\Alert\RunAlerts->issueAlert()
#5 {main}
:: Transport mail => SQL[select * from `alert_transports` where `alert_transports`.`transport_id` = ? limit 1 [12] 0.29ms]
Attempting to email Alert for device 10.0.16.45 - Device Down Due to no ICMP response. to: infxxx.com
OKSQL[insert into `eventlog` (`reference`, `type`, `datetime`, `severity`, `message`, `username`, `device_id`) values (?, ?, ?, ?, ?, ?, ?) [null,"alert","2024-07-19 10:43:06",0,"Issued critical alert for rule 'Device Down Due to no ICMP response.' to transport 'mail'","",4] 0.25ms]