robin
2 August 2018 07:45
1
Hi,
I have some problems with alerts/transport for mail and Telegram which have worked till 23th July.
Now I have updated the OS, libreNMS and converted the four preinstalled alert templates to the new format as suggested. “validate.php” is OK
In libreNMS log I can find the following:
[2018-08-02 09:42:01] production.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError:
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier
(T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in
/opt/librenms/includes/alerts.inc.php(394) : eval()'d code:7
Stack trace:
#0 /opt/librenms/LibreNMS/Alert/Template.php(174): RunJail('$ret .= "Alert ...', Array)
#1 /opt/librenms/LibreNMS/Alert/Template.php(65): LibreNMS\Alert\Template->legacyBody(Array)
#2 /opt/librenms/includes/alerts.inc.php(847): LibreNMS\Alert\Template->getBody(Array)
#3 /opt/librenms/includes/alerts.inc.php(598): ExtTransports(Array)
#4 /opt/librenms/includes/alerts.inc.php(790): IssueAlert(Array)
#5 /opt/librenms/alerts.php(48): RunAlerts()
#6 {main}
any idea how to fix this?
laf
2 August 2018 07:46
2
Show your template to start with. Put it on pastebin or format it here correctly.
robin
2 August 2018 07:48
3
This is the default alert template:
{{ $alert->title }}
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 Alert sent to: @foreach ($alert->contacts as $key => $value){{ $value }} <{{ $key }}>
@endforeach
laf
2 August 2018 19:20
4
Try updating and see if it works again after.
robin
3 August 2018 08:21
5
As I mentioned previously, I have already converted and updated the template as suggested in the dialog (convert -> update). Is there anything else to do?
Would be nice if alerting will works again
laf
3 August 2018 08:40
6
Update your install I meant/
robin
3 August 2018 09:37
7
1.42 is newest version, isn´t it?
robin:
$value[‘string’]
$value[‘string’] should be {{ $value['string'] }}
there is an error in the template conversion utility.
1 Like
robin
6 August 2018 13:30
9
yes, thats it! Thank you
Any Idea for the non working trelegram transport?
The “test transport” button sends a test message to the telegram chat. But a real alert doesn´t…