Updated example for new alerting engine (#9193)

* Updated example for new alerting engine

Using the example of port utilization caused errors when trying to use it with the new alert system.  Putting variables in curly braces and removing php calls resolved it.  Updating docs to reflect this.

Also removed examples with hash tags in the body of the template as pasting this in will cause syntax errors by the alerts script.

* Update Templates.md
This commit is contained in:
Peter Musolino
2018-09-13 22:08:40 -04:00
committed by Tony Murray
parent e769d6b648
commit 4e1a8bdcc4

View File

@@ -116,7 +116,7 @@ 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'] }}
{{ $key }}: {{ $value['string'] }}
@endforeach
@endif
Alert sent to:
@@ -133,11 +133,11 @@ Severity: {{ $alert->severity }}
Timestamp: {{ $alert->timestamp }}
Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
@foreach ($alert->faults as $key => $value)
Physical Interface: $value['ifDescr']
Interface Description: $value['ifAlias']
Interface Speed: @php echo ($value['ifSpeed']/1000000000); @endphp Gbs
Inbound Utilization: @php echo (($value['ifInOctets_rate']*8)/$value['ifSpeed'])*100; @endphp%
Outbound Utilization: @php echo (($value['ifOutOctets_rate']*8)/$value['ifSpeed'])*100; @endphp%
Physical Interface: {{ $value['ifDescr'] }}
Interface Description: {{ $value['ifAlias'] }}
Interface Speed: {{ ($value['ifSpeed']/1000000000) }} Gbs
Inbound Utilization: {{ (($value['ifInOctets_rate']*8)/$value['ifSpeed'])*100 }}
Outbound Utilization: {{ (($value['ifOutOctets_rate']*8)/$value['ifSpeed'])*100 }}
@endforeach
```
@@ -281,7 +281,7 @@ Alert-ID: {{ $alert->id }} <br>
Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif <br>
@if ($alert->faults) Faults:
@foreach ($alert->faults as $key => $value)
#{{ $key }}: {{ $value['string'] }}<br>
{{ $key }}: {{ $value['string'] }}<br>
@endforeach
@if ($alert->faults) <b>Faults:</b><br>
@foreach ($alert->faults as $key => $value)<img src="https://server/graph.php?device={{ $value['device_id'] }}&type=device_processor&width=459&height=213&lazy_w=552&from=end-72h><br>