Would it be possible to have images embedded into the emails, using base64 or something, so that images can be loaded irrespective of connection used (At the moment I have it restricted to local VPN range only). However, this isn’t ideal.
I hope I’ve described this well enough…
Cheers
EDIT: Can’t be in data:uri format, otherwise gmail webmail will reject the images.
If you want to help test,
./scripts/github-apply 8646
Add this line somewhere in your config.php $config['allow_unauth_graphs'] = true;
Add this line in your HTML template and change the alt value to your graph. <img width="800" height="300" src="cid:embedimage" alt="https://SERVERIP/GRAPHLINK">
That’s fine if your LibreNMS is accessible from the internet - a better fix would be to somehow embed/attach the actual graphic generated by the graph URL - I realise this would be a snapshot in time of the graph, but better than the current state of affairs.
I believe this issue is to attach an image in the email that is a snapshot in time. That way you can see the image if you can’t access the server.
Am I correct that your PR still needs access to the server to display the image? We can currently do images with HTML alerts but that isn’t ideal. Many don’t want to connect to a VPN to see the graphs.
it attaches it on the server side before the email is sent , so theoretically you could start the link with https://127.0.0.1/graph.php etc . The server is still trying to access the link which is protected by LibreNMS auth just like on normal LAN.
The email is then sent off with the attached image (not linked) .
You could lock down unauth to be allowed on the server only, $config['allow_unauth_graphs_cidr'] = array('127.0.0.1/32');
So I tested it, my librenms server is on local lan network,it is not accesible from the internet, only from local network. We have our own mail server, I am using smtp in email transport througt our own mail server, which is in DMZ, so i have real email address in our mail server which i using to send email to whatever email. I had a problem with sending graphs to email, but now i am using @chas PR with $config['allow_unauth_graphs'] = true; and this link in my html emails.: <img width="800" height="300" src="cid:embedimage" alt="https://SERVERIP/GRAPHLINK">
In real life it is looking something like this: (I edited it to english for you), but in real life I am using Slovak Language
and in email for example, I am tested it into gmail for example, where it is working the best, because I can click on that graph and zoom it, but it is working great with my mail address from the our mail server too. In outlook was the problem with spam assasin, but when i added mail addres to the whitelist in my mail server it is working great.
And here is the final email html alert. (In Slovak language, sorry)
It appears if using Outlook at as mail client (I know, don’t judge me) that if you have the graph type set to SVG it doesn’t work. Setting to PNG allows it to work.
I just added logic for SVGs in my latest commit, you may need to run ./scripts/github-apply 8646 again to get the latest code, it works in office365, but for some reason it attaches it also.
It may not work in your email client if you choose SVG format. Apparently it’s a bit hit and miss.
Seems to work - albeit with spotty mail client support for SVG. 90kB is a rounding error these days - I remember when it was over half a floppy disc though