Console don't show graph images

Hi. Since yesterday my LibreNMS console does not show the graphics. When I try to access through the URL it shows the PNG file in machine code. Some like this:

�PNG IHDR���y9DbKGD������� IDATx��{|eՙ����lK��_e’�’1!i��\!�J�H(k�JC�B�v�R(5��I��@p�]��m�/m�@˷�kih ���8���q|�/��r~Hc˲l�[������D��9�%��3�9@AAAAAAAAA

Please can you help me?

Thanks.

Can you run ./validate.php on cli and post the output.

Hi Chas, this is the output:

====================================
Component | Version
--------- | -------
LibreNMS | 1.51-70-g83522c6
DB Schema | 2019_02_10_220000_add_dates_to_fdb (132)
PHP | 7.2.15-1+ubuntu16.04.1+deb.sury.org+1
MySQL | 10.0.36-MariaDB-0ubuntu0.16.04.1
RRDTool | 1.5.5
SNMP | NET-SNMP 5.7.3
====================================
[OK] Composer Version: 1.8.5
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct

Is it the same across different browsers?

Are you seeing this on all pages ?

Try change from png to svg in Global Settings in the UI SVG graphs are now available

Yes, in different browsers (IE, Edge, Chrome, FF)
Yes, in all pages, include the mini graphs.
We apply this change (PNG to SVG) and now we can see the images when copy and paste the URL directly in the browser, but only when we replace the “amp;” in the original URL. Example:

Yesterday, all the URLs in the HTML file of the console did not have the “amp;” They only had “&”. Do you know if this parameterization is configured in any configuration file?

Might be related to https://github.com/librenms/librenms/pull/10241/ but not sure.

Thanks Chas, we will read the post.

@cjals Can you provide info on how to reproduce your issue? What url are you on when you try to access graphs? Do you use a subdirctory or reverse proxy?

Hi Murrant,

The URL we are trying to access is the one that is in the attribute data-original, inside img tag.
For example:
[…]
<img class="lazy img-responsive" data-original="**http://librenms.domain.com/graph.php?type=device_conns&amp;device=25&amp;height=158&amp;width=339&amp;from=1558508100**" style="border:0;" src="">
[…]

By the way, if we acces to the same URL adding “&debug” it is showing image with the graph.
In this case, if we inspect html code we can see the image encoded in Base64:

<img src="data:image/svg+xml;base64,iVBORw0KGgoAAAANSUhEUgAAAaQAAADVCAYAAAAYRYTlAAAABmJLR0QA/... alt="graph">

As you can see in the example we are not using subdirectorys or reverse proxys.
It can be lazyload.js not loading images?

Thanks for your help

That is very odd. I don’t see that at all. Are there any errors in the javascript console?

Does it work if you set: $config['enable_lazy_load'] = false; in config.php?

Can you show a screenshot of a page with the broken graphs?

I have set: $config['enable_lazy_load'] = false; in config. php, now the html code for the graphs are different:
<img class="img-responsive" src="http://librenms.domain.com/graph.php?height=158&amp;width=339&amp;to=1558624200&amp;id=1156&amp;type=port_bits&amp;from=1558019400" style="border:0;">

But still the same result:

In the javascript console now we do not have any error, before config.php change we had this:
Error en el mapeo fuente: SyntaxError: JSON.parse: unexpected character at line 2 column 1 of the JSON data URL del recurso: http://librenms.cdrsbg.com/js/jquery.min.js URL del mapa fuente: jquery-1.10.2.min.map

Thanks for your help.

Can you access librenms by IP address , same issue ?

If you force the & for png, does png work or still corrupt ?

Do you have any lines in your php.ini (locate via php --ini) that match “arg_separator” ?

Hi Chas,

Can you access librenms by IP address , same issue ?
If I access librenms by IP address I have the same result

_ If you force the &amp; for png, does png work or still corrupt ?_
If I force the & it does not show any code or image, it shows a blank page.

Do you have any lines in your php.ini (locate via php --ini) that match “arg_separator” ?
I have two lines commented:
;arg_separator.output = "&amp;"
;arg_separator.input = ";&"

It’s like the graph.php is not sending the base64 encoded image.

Thanks for your help

In your developer inspect tool can you edit the img src to remove the initial domain part

For example

http://librenms.domain.com/graph.php?height=158&width=339&to=1558624200&id=1156&type=port_bits&from=1558019400

to

graph.php?height=158&width=339&to=1558624200&id=1156&type=port_bits&from=1558019400

Does it load ?

Maybe try the monthly release to check it works again, and then compare the exact differences to the latest daily branch or are you sure its only the &amp; part?(although i think the monthly is due to upgrade soon)

Hi Chas,

We have resolved it, and we are under investigation because we don’t know why now is showing graphs correctly.

We have reformatted php.ini file and now is working, we only removed all comments and spaces in order to be more readable, after that graphs are showing up.

Here are the php.ini files:
Bad one: https://pastebin.com/XKgWRX6Z
Good one: https://pastebin.com/L0FzsdPG

Thans for your help

Good that it’s working now,

The only difference from “Good one” that i can see are

+ display_startup_errors=Off
- date.timezone=Europe/Madrid

maybe it was just the reload of php that fixed it?

We suspect that the value of: date.timezone = must be the problem, but we try to add it to php.ini good file and is still working.

Maybe there is something else in Bad php.ini that was in conflict before removing spaces and comments…

It is strange that we don’t modified the bad php.ini file until last wednesday when we detect the graphs were not showing up.

Many thanks @Chas and @murrant for your support.

1 Like
<img alt="Embedded Image" src="data:image/png;base64,<?php echo base64_encode($result['image']); ?>" />