Graphs in alerts

I’ve been trying to get graphs to show up in selected email alerts (network threshold and port error) and I think I’ve got everything right for creating the graphs other than what variable to use for the time frame. Here’s the alert template that I’m using:

<b>%title</b><br>
<b>Severity:</b> %severity<br>
{if %state == 0}<b>Time elapsed:</b> %elapsed<br>{/if}
<b>Timestamp:</b> %timestamp<br>
<b>Rule:</b> {if %name}%name{else}%rule{/if}<br>
{if %faults}<b>Faults:</b><br> 
{foreach %faults}<a href="http://MYSERVER/device/device=%hostname/">%hostname</a>: %value.ifName (%value.ifAlias) is running errors<br><img src="http://MYSERVER/graph.php?to=%value.poll_time&amp;id=%value.port_id&amp;type=port_errors&amp;from={calc(%value.poll_time-(6*3600))}&amp;legend=no&amp;height=150&amp;width=500"/><br>{/foreach}{/if}

The result that I get is a blank graph and when I look at the URL for the graph and compare it to what should be the same time frame in the web interface the time is WAY off. In fact if I compare the graph URL from several different alerts they all have the same timestamp like this:

http://MYSERVER/graph.php?to=1482505266&id=6329&type=port_errors&from=1482483666&legend=no&height=150&width=500

So is %value.poll_time not the correct variable that I want to use? Or is it just giving me bad times?

I have the following in my devices template.
Give this a try:

graph.php?width=459&height=213&lazy_w=552&from=end-24h&device=%value.device_id&type=device_bits&legend=yes

The from=end-24h gives me a broken link instead of a blank graph. That’s different from the blank one but still no better.

Have you enabled anonymous access to graphs?

Nope and am now feeling really stupid since I can’t find where to set it.

Ok stupid me found it so the graphs draw. Now to see if I can get it to draw the way I want it to.

I was looking for the same thing.

$config['allow_unauth_graphs']      = 1;

Was the missing option in config.php, as found at http://librenms-master.readthedocs.io/Support/Configuration/#authentication/.