Hmm. It doesn’t…
About the generic
camera, the main benefit is that is does not require curl
or temporary files. Thus, it should work in restricted containers such as Hass.io.
Hello. Sorry to wake this thread again, but I’m having trouble starting up Grafana. I run the following command in Ubuntu 16.04 server: docker run -p 3000:3000 --name="grafana" -v /home/<user>/docker_files/grafana:/var/lib/grafana grafana/grafana
and I get this in the log:
GF_PATHS_DATA='/var/lib/grafana' is not writable.
You may have issues with file permissions, more information here: http://docs.grafana.org/installation/docker/#migration-from-a-previous-version-of-the-docker-container-to-5-1-or-later
mkdir: cannot create directory '/var/lib/grafana/plugins': Permission denied
Any idea how I could fix this? I have googled, but this seems to be a problem not many other people are experiencing.
Yes, this error is caused by the update to Grafana 5.1.
To fix it, just follow the link given in the error message.
I executed the commands listed under “Modifying permissions” and after that everything came back to life.
I see my comment was short, I did read the information on that page, and figured out the solution would have to be about “modifying permissions”, but this is where I struggle a little bit. How do I do this in docker and keep the changes? Still learning Docker…
So, basically you’re fixing the permissions of your config files from inside the container. You could normally do this by getting a console on the running container and then execute the given commands. However, since the Grafana container keeps crashing you have to start it differently (so that it does not start the grafana process after spinning up the container and just start with a shell).
Before you begin stop and remove your grafana container
docker stop grafana && docker rm grafana
Then, the first command in the link provided is the docker run
command that gives you just the shell on (a new) grafana container (--entrypoint bash
). You provide the command with the same volume (=config) as your previous grafana container.
So it should look something like this:
docker run -ti --user root --volume=/home/<user>/docker_files/grafana:/var/lib/grafana --entrypoint bash grafana/grafana
This spins up a new container in interactive mode so that you can copy/paste the second command listed in the “modify permissions” section. Hit enter.
Your grafana config files in your docker_files folder should now be corrected.
Quit the shell and spin up a “normal” grafana container with your normal docker run command
Thats it.
Sorry for the late response, but haven’t gotten around with this until today., but it worked like a charm. Getting to understand Docker more and more, and enjoying it more and more! Thanks again!
Thanks you @arsaboo for sharing this. To get my config to work:
- make sure the downloads directory exists
- make sure homeassistant has access to the above directory
I am using the latest version of grafana (5.1.3)
- platform: command_line
name: "grafana_living_temp"
command: 'curl -H "Authorization: Bearer abcyourkeyhere=="
"http://192.168.50.5:3003/render/d-solo/FtPzG7Smz/main-dash?refresh=5m&orgId=1&panelId=13&from=1520419206405&to=1528198806405&width=1000&height=500&tz=UTC%2B10%3A00"
> /home/homeassistant/.homeassistant/downloads/temperature.png'
Using options -S & -L with cURL didnt work for me. The temperature.png was actually a text file with <a href="/login">Found</a>
inside.
Anyway hope this helps some one
Thanks a lot for this @arsaboo. Just reinstalled all using each docker rather than a pre-made package… Only way to use latest versions! Works great and spared me a memory leak.
Using the generic camera. This works great. Thanks @amelchio. Does anyone know how to generate a dynamic url with a specific time range? E.g.: since midnight or 1 day ago from midnight to midnight.
I’m looking at using graphs such as “today so far” or “yesterday” for consumption. Using the following type of url is not dynamic and the image does not update:
http://192.168.xx.xxx:3000/d/NsLz0XSmz/power?orgId=1&from=1528905600000&to=1528930854073&panelId=4&fullscreen
This is why some people in this thread could not get the image to update as generic cameras do. This grab the image for the same time period always.
Try https://github.com/CCOSTAN/Home-AssistantConfig/blob/master/config/packages/grafana.yaml#L21
&from=now-24h&to=now
-Carlo
You need to update from
and to
in the URL (as indicated in Point #12 in the original post). The time range options are available here.
Cheers guys. I realised I messed up the install and was not using a local folder. I’m trying to reinstall using persistence. For some reason, using @arsaboo 's code does not work:
docker run -d -p 3000:3000 \
--name="grafana" \
-v /volume1/docker/grafana:/var/lib/grafana \
grafana/grafana
This results in the container crashing constantly. I have a folder called “/volume1/docker/grafana” on my DSM6.2 Synology NAS.
I had installed by using the suggestion from the Grafana docs:
# create a persistent volume for your data in /var/lib/grafana (database and plugins)
docker volume create grafana-storage
# start grafana
docker run \
-d \
-p 3000:3000 \
--name=grafana \
-v grafana-storage:/var/lib/grafana \
grafana/grafana
This worked, but means it’s hard to access the config files… Any one has any idea how to solve this?
UPDATE:
It looks like I got this running by cd’ing into the desired folder and typing:
mkdir data
ID=$(id -u)
sudo docker run -d -p 3000:3000 \
--name="grafana" \
--user $ID --volume "$PWD/data:/var/lib/grafana" \
grafana/grafana
I’m leaving this here in case anyone else runs into this kind of trouble… Now let’s recreate all dashboard…
@fanaticDavid could you share the files you’re using for your docker containers ?
- /etc/influxdb/influxdb.conf
- /etc/grafana/grafana.ini
Thanks
Is anyone seeing massive ressource use by Grafana when pulling the generic camera rendering of the graphs?
I’m seeing 120MB memory use and 25% CPU spikes when an image is rendered. This is with just a single graph with 8 variables and data since midnight. Are other users also noticing spikes?
I’m using the generic camera component’s framerate variable on minimal setting (value 1) that allows a single image per second. It’s a pity this variable does not currently allow for decimals (float rather than integer) as this would allow for less frequent updates: e.g. 0.2 for one render every 5 seconds or 0.017 for one image per minute…
Did my first commit on GitHub as it seems easy enough to change this, but is there another way to do just that? I would be happy with an update every minute or two for some graphs as this would allow for more graphs to be rendered…
Does anyone know if it’s possible to aggregate state data grouped by day in Grafana?
Eg could you have a graph for the hours of TV watched per day? By using the state of the tv
I have only been able to do this for measurement data so far eg temperature
So I have been folllowing this thread for a week or two now after succesfully setting up InfluxDB and Grafana in Docker containers on my QNAP NAS. The dashboard I have created works perfectly in Grafana, so now on to the next step of integrating into HA.
So using ARSABOO’s guide in the first post Step 5, Other Notes, I am trying to use the generic camera component. I have a user created in Grafana with viewer rights and I have added the following to my configuration file.
camera:
- platform: generic
name: Grafana_temperature
still_image_url: http://192.168.1.53:32768/d/Ddv23hKmz/bedroom-temperatures?panelId=2&fullscreen&orgId=1&from=now%2Fw&to=now
username: !secret grafana_user
password: !secret grafana_password
This creates the entity camera.grafana_temperature, but when I try to add the dashboard to a View then nothing comes up.
I am obviously doing something clearly wrong, so I would appreciate any guidance
Do you see the image when you view it in the browser?
Yes it works in the browser. However, when I clear the cache and then enter the URL, I only get as far as the Grafana logon screen. Is this normal?
Then you are not copying the right link. You should be copying the Direct Link Rendered Image
, which will not require the password.