# alert_templates

name: BGP Sessions.
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'] }}
    Peer: {{ $value['astext'] }}
    Peer IP: {{ $value['bgpPeerIdentifier'] }}
    Peer AS: {{ $value['bgpPeerRemoteAs'] }}
    Peer EstTime: {{ $value['bgpPeerFsmEstablishedTime'] }}
    Peer State: {{ $value['bgpPeerState'] }}
  @endforeach
  @endif


name: Ports
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'] }}
    Port: {{ $value['ifName'] }}
    Port Name: {{ $value['ifAlias'] }}
    Port Status: {{ $value['message'] }}
  @endforeach
  @endif


name: Sensors
template:
  {{ $alert->title }}

  Device Name: {{ $alert->hostname }}
  Severity: {{ $alert->severity }}
  Timestamp: {{ $alert->timestamp }}
  Uptime: {{ $alert->uptime_short }}
  @if ($alert->state == 0)
  Time elapsed: {{ $alert->elapsed }}
  @endif
  Location: {{ $alert->location }}
  Description: {{ $alert->description }}
  Features: {{ $alert->features }}
  Notes: {{ $alert->notes }}

  Rule: {{ $alert->name ?? $alert->rule }}
  @if ($alert->faults)
  Faults:
  @foreach ($alert->faults as $key => $value)
  @php($unit = __("sensors.${value["sensor_class"]}.unit"))
  #{{ $key }}: {{ $value['sensor_descr'] ?? 'Sensor' }}

  Current: {{ $value['sensor_current'].$unit }}
  Previous: {{ $value['sensor_prev'].$unit }}
  Limit: {{ $value['sensor_limit'].$unit }}
  Over Limit: {{ round($value['sensor_current']-$value['sensor_limit'], 2).$unit }}

  @endforeach
  @endif


name: Default Alert Template
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


