Unable to set up image rendering in the new version of Grafana

I have installed the new plugin for image rendering in Grafana, but it doesn’t work.
Grafana version:8.2.1

Have installed chromium browser and all the Linux libraries related to it, still image rendering doesn’t work. Please help.

What errors are you seeing in the Grafana server log?

Hi,

Please find the logs.

t=2021-11-01T11:43:38+0400 lvl=info msg=“Validated license token” logger=licensing appURL=http://192.168.101.202:3000/ source=disk status=NotFound
t=2021-11-01T11:43:38+0400 lvl=warn msg=“failed to load or validate token” logger=licensing.renewal err=“license token file not found: /var/lib/grafana/license.jwt”
t=2021-11-01T11:44:17+0400 lvl=info msg=“level=debug component=dispatcher msg=“Received alert” alert=“L34-Edge04 Alerts[40b6977][active]”” logger=alertmanager org=1
t=2021-11-01T11:44:19+0400 lvl=info msg=“level=debug component=dispatcher aggrGroup={}:{} msg=flushing alerts=”[L34-Edge04 Alerts[40b6977][active]]"" logger=alertmanager org=1
t=2021-11-01T11:44:28+0400 lvl=info msg=“level=debug component=dispatcher msg=“Received alert” alert=“IT-Ops | (023) Dedicated 100Mbps | MGMT[62dfc47][active]”” logger=alertmanager org=1
t=2021-11-01T11:45:08+0400 lvl=info msg=“level=debug component=dispatcher msg=“Received alert” alert=“IT-Ops | (023) Dedicated 100Mbps | MGMT[62dfc47][resolved]”” logger=alertmanager org=1
t=2021-11-01T11:45:17+0400 lvl=info msg=“level=debug component=dispatcher msg=“Received alert” alert=“L34-Edge04 Alerts[40b6977][active]”” logger=alertmanager org=1
t=2021-11-01T11:46:17+0400 lvl=info msg=“level=debug component=dispatcher msg=“Received alert” alert=“L34-Edge04 Alerts[40b6977][active]”” logger=alertmanager org=1
t=2021-11-01T11:47:17+0400 lvl=info msg=“level=debug component=dispatcher msg=“Received alert” alert=“L34-Edge04 Alerts[40b6977][active]”” logger=alertmanager org=1
t=2021-11-01T11:48:17+0400 lvl=info msg=“level=debug component=dispatcher msg=“Received alert” alert=“L34-Edge04 Alerts[40b6977][active]”” logger=alertmanager org=1
t=2021-11-01T11:49:17+0400 lvl=info msg=“level=debug component=dispatcher msg=“Received alert” alert=“L34-Edge04 Alerts[40b6977][active]”” logger=alertmanager org=1
t=2021-11-01T11:49:19+0400 lvl=info msg=“level=debug component=dispatcher aggrGroup={}:{} msg=flushing alerts=”[L34-Edge04 Alerts[40b6977][active] IT-Ops | (023) Dedicated 100Mbps | MGMT[62dfc47][resolved]]"" logger=alertmanager org=1
t=2021-11-01T11:50:17+0400 lvl=info msg=“level=debug component=dispatcher msg=“Received alert” alert=“L34-Edge04 Alerts[40b6977][active]”” logger=alertmanager org=1
t=2021-11-01T11:51:17+0400 lvl=info msg=“level=debug component=dispatcher msg=“Received alert” alert=“L34-Edge04 Alerts[40b6977][active]”” logger=alertmanager org=1
t=2021-11-01T11:51:38+0400 lvl=info msg=“level=debug component=dispatcher msg=“Received alert” alert=“IT-Ops | (023) Dedicated 100Mbps | MGMT[62dfc47][active]”” logger=alertmanager org=1
t=2021-11-01T11:52:17+0400 lvl=info msg=“level=debug component=dispatcher msg=“Received alert” alert=“L34-Edge04 Alerts[40b6977][active]”” logger=alertmanager org=1
t=2021-11-01T11:53:17+0400 lvl=info msg=“level=debug component=dispatcher msg=“Received alert” alert=“L34-Edge04 Alerts[40b6977][active]”” logger=alertmanager org=1
t=2021-11-01T11:54:17+0400 lvl=info msg=“level=debug component=dispatcher msg=“Received alert” alert=“L34-Edge04 Alerts[40b6977][active]”” logger=alertmanager org=1
t=2021-11-01T11:54:19+0400 lvl=info msg=“level=debug component=dispatcher aggrGroup={}:{} msg=flushing alerts=”[L34-Edge04 Alerts[40b6977][active] IT-Ops | (023) Dedicated 100Mbps | MGMT[62dfc47][resolved]]"" logger=alertmanager org=1
t=2021-11-01T11:55:17+0400 lvl=info msg=“level=debug component=dispatcher msg=“Received alert” alert=“L34-Edge04 Alerts[40b6977][active]”” logger=alertmanager org=1

I don’t see any error related to image rendering.
Also I am running the open source version so license error is not relevant here.

Can you describe how it isn’t working if you are not getting an error message?

Hi,

My alert notifications do not have the image in it.

image

Can you please help me link the images with the alerts?

I am using Grafana 8.2.1 and it doesnt have include image option like it did in the earlier versions.

Thanks

Also I am trying to do image rendering using docker-compose.yml.

When I tried to build it, I am getting following error.

Error:
Creating docker-build_grafana_1 … done

ERROR: for renderer a bytes-like object is required, not ‘str’
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/docker/api/client.py”, line 261, in _raise_for_status
response.raise_for_status()
File “/usr/lib/python3/dist-packages/requests/models.py”, line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v1.22/containers/384290c86924b20bff5991f946de688d648b4a7c93f29ed28ec32347ab47c774/start

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/compose/service.py”, line 625, in start_container
container.start()
File “/usr/lib/python3/dist-packages/compose/container.py”, line 241, in start
return self.client.start(self.id, **options)
File “/usr/lib/python3/dist-packages/docker/utils/decorators.py”, line 19, in wrapped
return f(self, resource_id, *args, **kwargs)
File “/usr/lib/python3/dist-packages/docker/api/container.py”, line 1095, in start
self._raise_for_status(res)
File “/usr/lib/python3/dist-packages/docker/api/client.py”, line 263, in _raise_for_status
raise create_api_error_from_http_exception(e)
File “/usr/lib/python3/dist-packages/docker/errors.py”, line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 400 Client Error: Bad Request (“b’failed to create shim: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting “/usr/local/bin/docker-build/config.json” to rootfs at “/usr/src/app/config.json” caused: mount through procfd: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type’”)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/bin/docker-compose”, line 11, in
load_entry_point(‘docker-compose==1.25.0’, ‘console_scripts’, ‘docker-compose’)()
File “/usr/lib/python3/dist-packages/compose/cli/main.py”, line 72, in main
command()
File “/usr/lib/python3/dist-packages/compose/cli/main.py”, line 128, in perform_command
handler(command, command_options)
File “/usr/lib/python3/dist-packages/compose/cli/main.py”, line 1107, in up
to_attach = up(False)
File “/usr/lib/python3/dist-packages/compose/cli/main.py”, line 1088, in up
return self.project.up(
File “/usr/lib/python3/dist-packages/compose/project.py”, line 565, in up
results, errors = parallel.parallel_execute(
File “/usr/lib/python3/dist-packages/compose/parallel.py”, line 112, in parallel_execute
raise error_to_reraise
File “/usr/lib/python3/dist-packages/compose/parallel.py”, line 210, in producer
result = func(obj)
File “/usr/lib/python3/dist-packages/compose/project.py”, line 548, in do
return service.execute_convergence_plan(
File “/usr/lib/python3/dist-packages/compose/service.py”, line 545, in execute_convergence_plan
return self._execute_convergence_create(
File “/usr/lib/python3/dist-packages/compose/service.py”, line 460, in _execute_convergence_create
containers, errors = parallel_execute(
File “/usr/lib/python3/dist-packages/compose/parallel.py”, line 112, in parallel_execute
raise error_to_reraise
File “/usr/lib/python3/dist-packages/compose/parallel.py”, line 210, in producer
result = func(obj)
File “/usr/lib/python3/dist-packages/compose/service.py”, line 465, in
lambda service_name: create_and_start(self, service_name.number),
File “/usr/lib/python3/dist-packages/compose/service.py”, line 457, in create_and_start
self.start_container(container)
File “/usr/lib/python3/dist-packages/compose/service.py”, line 627, in start_container
if “driver failed programming external connectivity” in ex.explanation:
TypeError: a bytes-like object is required, not ‘str’
root@grafana:/usr/local/bin/docker-build#

Docker-compose.yml

version: ‘2’

services:
grafana:
image: grafana/grafana:latest
ports:
- 3000
environment:
GF_RENDERING_SERVER_URL: http://ip:8081/render
GF_RENDERING_CALLBACK_URL: http:/ip:3000/
GF_LOG_FILTERS: rendering:debug
renderer:
image: grafana/grafana-image-renderer:latest
ports:
- 8081
volumes:
- ./config.json:/usr/src/app/config.json

Hey,

Finally I have some errors in my log file for rendering.

t=2021-11-02T15:57:36+0400 lvl=info msg=“warming cache for startup” logger=ngalert
t=2021-11-02T15:57:36+0400 lvl=info msg=“HTTP Server Listen” logger=http.server address=[::]:3000 protocol=http subUrl= socket=
t=2021-11-02T15:57:36+0400 lvl=info msg=“starting MultiOrg Alertmanager” logger=ngalert.multiorg.alertmanager
t=2021-11-02T15:57:36+0400 lvl=dbug msg=“calling remote rendering service” logger=rendering renderer=http url=http://192.168.101.202:8081/render/version
t=2021-11-02T15:57:36+0400 lvl=eror msg=“Failed to send request to remote rendering service” logger=rendering renderer=http error=“Get “http://192.168.101.202:8081/render/version”: dial tcp 192.168.101.202:8081: connect: connection refused”
t=2021-11-02T15:57:36+0400 lvl=info msg=“Couldn’t get remote renderer version” logger=rendering renderer=http err=“failed to send request to remote rendering service: Get “http://192.168.101.202:8081/render/version”: dial tcp 192.168.101.202:8081: connect: connection refused”
t=2021-11-02T15:57:36+0400 lvl=info msg=“Backend rendering via external http server” logger=rendering renderer=http version=
t=2021-11-02T15:57:37+0400 lvl=info msg=“Request Completed” logger=context userId=1 orgId=1 uname=admin method=GET path=/api/live/ws status=0 remote_addr=172.16.190.18 time_ms=6 size=0 referer=

Image rendering in notifications is not supported in Grafana 8 alerting. The short reason for this is, alertmanager.

The longer explanation is that we embed an instance of alertmanager to handle notifications in the new alerting system. Because alertmanager doesn’t support images, we are also not able to do so. The feature has been discussed by the alertmanager folks and, so far, they have elected to not support the feature. This doesn’t mean we will never support this again, just trying to lay out why, as of today, it’s not an option. The best thing you can do is add your voice to one of the feature requests for this.