Alert template with graph

Hi, I am trying to get working graphs in my html email alerts. I used new alert template for CPU

> Severity: %severity  <br>
> {if %state == 0}Time elapsed: %elapsed{/if}
> Timestamp: %timestamp <br>
> Alert-ID: %id <br>
> Rule: {if %name}%name{else}%rule{/if} <br>
> {if %faults}Faults:
> {foreach %faults}
> #%key: %value.string <br>
> {/foreach}
> {if %faults}<b>Faults:</b><br>
> {foreach %faults}<img src="http://librenms/graph.php?device=%value.device_id&type=device_processor&width=459&height=213&lazy_w=552&from=end-1h<br>
> http://librenms/graphs/id=%value.device_id/type=device_processor/device=%value.device_id/<br>
> {/foreach}
> Template: CPU alert <br>
> {/if}
> {/if}

But its not work for me. In emails I just getting this

When i use http://librenms/graph.php?device=16&type=device_processor&width=459&height=213&lazy_w=552&from=end-1h

I am getting correct image for graph

And of course i have this config in my config.php
$config[‘allow_unauth_graphs’] = true;

What i doing wrong ? Why I cant get graphs in my email alerts ? Is needed to be with my librenms on public IP address or ?

Thank you for your help :slight_smile:

If you look at the source code of your alert, you are embedding a link to the graph as the source of the image rather than attaching a snapshot image of the graph (as it appeared at the time the alert was created)

<img src="http://librenms/graph.php?device=%value.device_id&type=device_processor&width=459&height=213&lazy_w=552&from=end-1h<br>

Also the img src statement doesn’t appear to have a closing quote…

How you resolve this to in effect generate an image file containing the graph is beyond my knowledge though - totally agree it should be possible, I’d quite like to do it too :smiley:

1 Like

Same here. I was wondering how to accomplish this yesterday.