How do I modify the email alert template to include the CPU Percentage at the current moment when the alert is generated?
You should create a specific template.
Take a look to https://docs.librenms.org/#Alerting/Templates/
Okay, I may pick your brain on this further. So far none of my alert templates that I have attempted to create or modify have done nothing. And I know I am probably not doing it correctly. So back to the basic and seeking help from the community.
After creating the template, did you map them to the alert? Its the yellow button in the templates list.
I’m using %value.processor_usage
to get % Load at the time of alert.
But, did you map your template to the cpu alert rule?
I have mapped the template to my alert.
This wasn’t clear to me in the beginning - if you are using %value. to display data, make sure it is between the {foreach %faults} and {/faults} Post the code of the template?
Yes, can you please post your code?
Well - was asking for your template… but here is one of mine in any case. You can put in the %value.processor_usage in where you want after the foreach
<div style="font-family:Helvetica;">
<b>%Title</b><br>
<h2>{if %state == 1}<span style="color:red;">%severity{/if}
{if %state == 2}<span style="color:goldenrod;">Incident Acknowledged{/if}</span>
{if %state == 3}<span style="color:green;">Incident Recovering{/if}</span>
{if %state == 0}<span style="color:green;">%hostname OK{/if}</span>
</h2>
{if %faults}
{foreach %faults}
<b>Device:</b> {if %transport == mail}
<a href="http://librenms/device/device=%hostname/">%hostname</a>
{else}
%hostname
{/if} <br>
{if %alert_notes}
<b>Alert Notes:</b> %alert_notes<br>
{/if}
{if %location}
<b>Location:</b> %location<br>
{else}
<b>Location:</b> LOCATION NOT DEFINED YET!!<br>
{/if}
<b>Uptime:</b> %uptime_long<br>
<b>Duration:</b> %elapsed<br>
{if %description}
<b>Description:</b> %description<br>
{/if}
{if %features}
<b>Features:</b> %features<br>
{/if}
{if %purpose}
<b>Purpose:</b> %purpose<br>
{/if}
{if %notes}
<b>Notes:</b> %notes<br>
{/if}
<br><br>
<img src="http://librenms/graph.php?width=459&height=213&lazy_w=552&from=end-7d&device=%value.device_id&type=device_bits&legend=yes"><br>
<b>Device: </b>%value.sysDescr<br><br>
{/foreach}
{/if}
<br>
<B>Alerts sent to:</b> {foreach %contacts}%value <%key> {/foreach} <br>
insert:
<b>Processor %: </b>%value.processor_usage <br>
Worked! Appreciate all the help!
Is there also a way to include that Processor % value in the subject?
Not really, that data is in an array.
Appreciate it anyways!