Alert Transport stopped working

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?

Show your template to start with. Put it on pastebin or format it here correctly.

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

Try updating and see if it works again after.

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

Update your install I meant/

1.42 is newest version, isn´t it?

$value[‘string’] should be {{ $value['string'] }} there is an error in the template conversion utility.

1 Like

yes, thats it! Thank you :slight_smile:

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…

Look at this: