After updating PHP on 20-04-2024 I am getting an error from my Ping Latency Template:
Error:
Warning! Fallback template used due to error in template Ping Latency:
Cannot access offset of type string on string (View:
/opt/librenms/storage/framework/views/ac9320ec436bd3d75f6f77f18ce9409e.blade.php)
Template:
Operating System: {{ LibreNMS\Config::getOsSetting($alert->os, ‘text’) }} {{ $alert->version }}
@if ($alert->hardware)
Hardware: {{ $alert->hardware }}
@endif
@if ($alert->location)
Location: {{ $alert->location }}
@endif
Device URL: http://librenms.dssc.nso.edu/device/device={{ $alert->hostname }}/
{{ $alert->title }}
Severity: {{ $alert->severity }}
@if ($alert->description)
@endif
@if ($alert->state == 0)
Time elapsed: {{ $alert->elapsed }}
@endif
Timestamp: {{ $alert->timestamp }}
Unique-ID: {{ $alert->uid }}
Ping Average: {{ $alert->ping_avg }}
Ping Loss: {{ $alert->ping_loss }}
Ping Min: {{ $alert->ping_min }}
Ping Max: {{ $alert->ping_max }}
TraceRoute: {{ $alert->debug[‘traceroute’] }}
Any help would be appreciated
I also have the exact same issue after the latest LibreNMS update 24.4.1. Seems like blade.php doesnt like something that existed before the upgrade in the template.
This is the error I see:
Alert sent to: Warning! Fallback template used due to error in template Default Alert Template: Cannot access offset of type string on string (View: /opt/librenms/storage/framework/views/a6099e3adee4123ae46654f428bcb043.blade.php)
Here is my template that is throwing this error:
Severity: {{ $alert->severity }}
@if ($alert->state == 0) Time elapsed: {{ $alert->elapsed }} @endif
Timestamp: {{ $alert->timestamp }}
Unique-ID: {{ $alert->uid }}
Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
@if ($alert->faults) Faults:
@foreach ($alert->faults as $key => $value)
{{ $key }}: {{ $value['string'] }}
@endforeach
@endif
@if ($alert->status == 0)
@if ($alert->status_reason == 'icmp')
{{ $alert->debug['traceroute'] }}
@endif
@endif
Whats strange is the error shows “Alert sent to:” in the message. However the alert template “device-template” does NOT have any “Alert sent to:” text in it.
Error Message:
Alert sent to: Warning! Fallback template used due to error in template device-template: Cannot access offset of type string on string (View: /opt/librenms/storage/framework/views/3bfbb67f542ab74cb9c182e1e90695e1.blade.php)
Contents of device-template:
Severity: {{ $alert->severity }}
@if ($alert->state == 0) Time elapsed: {{ $alert->elapsed }} @endif
Timestamp: {{ $alert->timestamp }}
Unique-ID: {{ $alert->uid }}
Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
@if ($alert->faults) Faults:
@foreach ($alert->faults as $key => $value)
{{ $key }}: {{ $value['string'] }}
@endforeach
@endif
@if ($alert->status == 0)
@if ($alert->status_reason == 'icmp')
{{ $alert->debug['traceroute'] }}
@endif
@endif
Wonder where is it getting the “Alert Sent To:” from?