Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local file paths fail #37

Closed
marcusolsson opened this issue Feb 18, 2021 · 6 comments
Closed

Local file paths fail #37

marcusolsson opened this issue Feb 18, 2021 · 6 comments
Labels
type/bug Unexpected behavior or a feature is broken

Comments

@marcusolsson
Copy link
Contributor

Some users have reported errors when loading local files:

From the log lines in this comment, it seems like Grafana is trying to parse the local file path it as a URL.

The plugin does use the URL field in the data source config to store the file path since that's only way to display the path in the data source list. You can see this by switching between HTTP and Local.

CleanShot 2021-02-18 at 08 21 25@2x

My initial thought was that recent versions of Grafana had introduced additional validation for the URL field. Unfortunately, I seem to be unable to reproduce this on my machine. I've tried both Brave and Safari, for the following versions:

  • 7.3.7
  • 7.4.0
  • 7.4.1

I'd like to figure out under what circumstances this happens. If not, I'll have to stop reusing the URL field for the file path. This will make it hard to find the right data source from the list though.

@marcusolsson marcusolsson added the type/bug Unexpected behavior or a feature is broken label Feb 18, 2021
@Ognian
Copy link

Ognian commented Mar 1, 2021

I ran also into this issue;
After reading the linked issues I must ask, what does actually "local" mean?
Is the grafana code in the browser trying to access a "local" file on the computer where the browser runs?
OR das local mean that the plugin server written in go is trying to access a "local" file on the "server" where grafana is deployed.
From the grafana log I would guess the second...

@marcusolsson
Copy link
Contributor Author

Hi @Ognian, can you confirm that this is the log line you're seeing:

Data source URL doesn't specify protocol, so prepending it with http:// in order to make it unambiguous

Could you share some details on plugin version, Grafana version, and the OS you're running Grafana on?

Local means a file on the server. Would a description next to the button help here, or do you think we should call it something else?

@Ognian
Copy link

Ognian commented Mar 2, 2021

Hi @marcusolsson,
OK, so the misunderstanding is that I thought it means a local file on my machine. When I want to quickly test a csv, I need to upload from my local machine regardless where the rest of the system is. So yes, you should at least clarify what you mean with "local", and actually you should consider to implement the csv file uploader...
The error message is actually totally correct, there is no such file on the server (it is on the local machine).

@marcusolsson marcusolsson added this to Triage in Grafana Plugins via automation Apr 4, 2021
Grafana Plugins automation moved this from Triage to Done May 20, 2021
@yaga8795
Copy link

yaga8795 commented Sep 2, 2022

Hello everyone,

I know this is closed
but I also experienced (and solved) this issue today (2022-09-02),
I had

  • linux grafana server (debian)
  • local path on /home/my_user/some_folder
    where ownership and right of some_folder and everything below were
    grafana:grafana (user:group) and 777
  • got permission denied on "save" or "explore"

Solution (inspired by local csv related topics in "discussion"):

moving some_folder and below to /usr/share/grafana/public/
keeping the same ownership (grafana:grafana) and right (777)

mv /home/my_user/some_folder /usr/share/grafana/public/

now the (new) local path
/usr/share/grafana/public/some_folder
is ok, allowed, usable :)


HTH,
yaga8795

ps. maybe that "right" part (777)
and path depth in /usr/share/grafana/
could be tuned...

ps2. versions:
grafana v9.0.6
marcusolsson-csv-datasource v0.6.1
debian 11.4 / linux 5.10.0-16-amd64

@jeev20
Copy link

jeev20 commented Sep 27, 2022

/usr/share/grafana/public/some_folder

That works for me on a airgapped raspberrypi 2! Thank you @yaga8795

@marcusolsson marcusolsson removed this from Done in Grafana Plugins Sep 30, 2022
@md-toro
Copy link

md-toro commented Apr 7, 2023

Shouldn't this get published on the documentation page?

Setup the data source as: /usr/share/grafana/public/
Optionally add a sub folder in the data source /usr/share/grafana/public/some_folder
When creating the panel either use the csv file in the data source or the relative path to the csv file
some_folder/sample.csv

Good notes in this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Unexpected behavior or a feature is broken
Projects
None yet
Development

No branches or pull requests

5 participants