Docker Geek Magic Mirror

Grafana in Magic Mirror

This is just an update of my previous post of how to use MMM-Grafana-Chart and MMM-Grafana-gauge in your magic mirror. I wanted to post this as I have been struggling myself to get this working. There are two things that you might run into.

  • The background might be gray instead of black

This could be fixed before Grafana 5 by changing the CSS. However this is not really possible now as you will have to rebuild

  • If running Grafana in Docker there are issues when setting the permissions.

The setting will also be lost when recreating and pulling the latest image. You will also run into problems in the container as teher is no nano or vi.

But we will take this from start. You will end up with a working Grafana Gauge panel with black background on your Magic Mirror.

Start by installing the MMM-GrafanaGauges

I will not install MMM-GrafanaCharts as there will be no good way to get the background all black. You will see this later.

Edit your configuration file like above. Make sure you use a dashboardname that will be created soon.

Now tonnect via ssh to your dockerhost running Grafana. In there type:

This will open a root prompt in the container. Will should now edite the grafana.ini. However this will not be possible as there is no editor installed. Install nano by typing:

Usually you want to keep the container as small as possible and this is the reason there is no editor installed. Edit /etc/grafana/grafana.ini. I know you may think that your grafana.ini file is within your local path of your docker container. In my case /srv/docker/grafana/ and the file is there but changing this here wont affect Grafana. When you change the file you will enable annonymous access for the orgname magic mirror. We will create that. You may not want to enable this for your main org.

Open Grafana and add an new org. Name this the same as you wrote in the config.

Now create your gauge.The secret is to set the thresholds colors to all black. Use any other setting you want. Now also chech the url:

https://mygrafanahost/d/V12csvwiz/sun?tab=visualization&orgId=2&fullscreen&edit&panelId=5

The important stuff is the org id and the panel id. This should be in the module config as above.

If you have done everything correct now you will see the info on your mirror without any username and with black background. I have used this with Grafana 6.