Custom alerts Templates

Hi Guys,

I have tough days with these new alert frankly :slight_smile:

Could you please support me in this - I would like to add info into my UPS alert with next data:

So, during regular alert, I would like to have 3 strings of data Input / Output / Battery voltage.

How can should I create this alert?

BTW, I googled examples like this, and I have not found ones, so, probably this topic will be useful for other people if someone help me with it!

Thanks a lot guys!

P.S. Direct image link: Original image

You can get the value from the column names in your alert template,

for example check this one , i think thats old syntax though so you will need to convert using the convert button on the template page.

Hi Chas,

With static info as %hostname, %state etc it’s okay for me.

I don’t know hot to specify, that I would like to receive info from sensor_id=92 from column sensor_current. That is my problem.

isn’t it this part in the templates docs?

You could specify {{ $value['sensor_current'] }}

Temperature Sensors:

{{ $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 }}
Purpose: {{ $alert->purpose }}
Notes: {{ $alert->notes }}

Rule: @if ($alert->name) {{ $alert->name }} @else {{ $alert->rule }} @endif
@if ($alert->faults) Faults:
@foreach ($faults as $key => $value)
#{{ $key }}: Temperature: {{ $value['sensor_current'] }} °C
** @php echo ($value['sensor_current']-$value['sensor_limit']); @endphp°C over limit
Previous Measurement: {{ $value['sensor_prev'] }} °C
High Temperature Limit: {{ $value['sensor_limit'] }} °C
@endforeach
@endif

[quote=“Chas, post:4, topic:7385”]
Sure, it is, but probably I have not clearly explain my question. Sorry about that.

So, in this example, we got $key as $value, and output all data from this particular sensor.
But how can I request info about another sensor data in the same template? Is it possible?

ahh i see what you mean, you want to grab data from all 3 rows in that alert output. I don’t think its possible, i wonder if you include the sensor ids in your alert query somehow, whether it then appears in the output string

@if ($alert->faults) Faults:
@foreach ($alert->faults as $key => $value)
  {{ $key }}: {{ $value['string'] }}
@endforeach