Graphs on Email

I am having an issue.I am getting text-based alerts.Is it possible if I get graphs in email alerts rather than text-based alerts.

Thanks in advance

Didn’t know this is possible! I’m going to take a look now :smiley:

I also use Grafana and this feature was very handy

It is possible you would need to change the alerts templates to use html and then link in the graphs and allow non-authenticated graphs. this questions have been asked b4 in the forums search around.

Also -> https://docs.librenms.org/#Alerting/Templates/#examples-html

1 Like

Ahh yes got it attaching the graphs internally by following that link to the docs :sunglasses:

My LibreNMS isn’t public so the graphs won’t appear in emails outside the installation which is a bit of a downside. Cacti/Grafana and a few others seem to use some kind of image attachment and cid embed. By attaching the image it would up the mail payload but be accessible anywhere. I saw a related thread here Embed Graph in Alert Email

I don’t suppose anyone has got that working?

The embed graph would be more useful than link.
It give me a more clear view on how the monitored item doing when I got alert mail.

Is it possible ?

If your email client has access to librenms then yes, from the docs;

Note: To use HTML emails you must set HTML email to Yes in the WebUI under Global Settings > Alerting Settings > Email transport > Use HTML emails

Note: To include Graphs you must enable unauthorized graphs in config.php. Allow_unauth_graphs_cidr is optional, but more secure.

$config['allow_unauth_graphs_cidr'] = array('127.0.0.1/32');  
$config['allow_unauth_graphs'] = true;

and then look at the example in here which contains img src https://docs.librenms.org/Alerting/Templates/

if your email client has no direct access to your librenms install, then your best shot is this recent thread Embed images not working on IOS devices

1 Like

Thanks.
But what I mean is something like image attachment, like Cacti.
Because I don’t want every time I read an alert mail, it have to get date from librenms.
Save time and bandwidth, plus I can still check alert mail outside the office.

Update:
Sorry I didn’t notice the last link you provide, I’ll check it out.

After adding those new code into functions.php,
set allow unauthorized graphs in config.php,
modify the alert Template,
I finally got the graph in my alert mail!

There is only one last question…how could I add other graph like interface utilization?
I think [type=device_processor] is the key, but I don’t know where to look for other type.

I linked to @CircumFlex_sigma new work to get it working purely based on alert templating, Did that not work for you?

You should not have edited functions.php from my original PR, it didn’t get merged into the project so now you won’t be able to update LibreNMS as you have created a conflict.

To reverse the change, you need to run

git checkout -- includes/functions.php
git pull
chown librenms:librenms includes/functions.php

Back to your question on graphing interface utilization, you can click on any graph and copy the graph url , if you want it dynamic in your alerting for loop, it would be something like

https://URL/graphs/id={{ $value['port_id'] }}/type=port_bits/from=end-72h
2 Likes

My bad, I totally forgot the update. :sweat_smile:

I’ve rewrite my alert template and now I finally got the correct port graph !

Thanks for the help~~~ :smile:

1 Like