grafana / grafana

The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
https://grafana.com
GNU Affero General Public License v3.0
64.49k stars 12.07k forks source link

grafana-cli: command not found / Cannot Install Plugins #15173

Closed BzowK closed 5 years ago

BzowK commented 5 years ago

Hey Guys -

I recently discovered Grafana, set it up with a few sources to monitor lab systems & my SCCM lab, and LOVE it! Everything seems to be working great except for one issue I cannot figure out. I tried installing a couple of plugins, however when trying to use grafana-cli from an SSH session; it states "grafana-cli: command not found." Below is some information about the build plus what I've tried to resolve...

Build Details

What I've Tried So Far

I'm happy to submit any files or logs and would have done so in this case, but didn't think any were relevant since the error isn't in Grafana specifically.

Anything you can suggest to resolve would be fantastic - Thank You!

torkelo commented 5 years ago

Executing Directly: Thinking the path may just not be set, I found that "grafana-cli" was located in "/usr/sbin" so CD'd to the path and executed it, but still got message that it wasn't found. I checked the permissions for "grafana-cli" in that path which were 755

Not sure what could be going on, we have no other similar reports. Must be something going on with your system so that you cannot execute or find a file that is clearly there.

I wish I could help but have no idea why you cannot execute a binary or have no permission to browse a folder.

maybe someone on a linux forum can understand what could be wrong.

melroy89 commented 5 years ago

I'm using Debian 10 now I also could not find the grafana-cli command.

Gives me 'command not found'. As @BzowK said before the script is located in /usr/sbin directory, which is true. Also the rights are correct indeed.

The problem is simple, /usr/sbin is not in the $PATH by default. Try: echo $PATH. Only /usr/local/bin:/usr/bin:/bin and properly some more.

The only way to get access through this script would be using sudo. So sudo grafana-cli will do the trick. Or execute it like so: ./usr/sbin/grafana-cli when you are root user.

Example:

sudo grafana-cli plugins upgrade grafana-piechart-panel
Removing plugin: grafana-piechart-panel
installing grafana-piechart-panel @ 1.3.6
from url: https://grafana.com/api/plugins/grafana-piechart-panel/versions/1.3.6/download
into: /var/lib/grafana/plugins

✔ Installed grafana-piechart-panel successfully 

Restart grafana after installing plugins . <service grafana-server restart>
torkelo commented 5 years ago

Strange, only 2 people have reported this problem, this binary is placed in the recommended standard path according to my findings

vogler commented 4 years ago

Same problem here:

$  ll /usr/sbin | grep grafana
-rwxr-xr-x 1 root root 1.1K Nov 14 14:45 grafana-cli
-rwxr-xr-x 1 root root  39M Nov 14 14:47 grafana-server
$ echo $PATH
/home/pi/.local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/games:/home/pi/.go/bin:/home/pi/.cargo/bin
$  lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster
$  uname -a
Linux rpi4 4.19.88-v8+ #1284 SMP PREEMPT Wed Dec 11 13:57:50 GMT 2019 aarch64 GNU/Linux
ketonic commented 4 years ago

As, for some reason, people are not believed by mr Torkelo i am just posting to say that there is more users that have this issue. I have tried installing it on 3 different Debian 10 systems and i am having the same issue.

Strange, only 2 people have reported this problem, this binary is placed in the recommended standard path according to my findings

I must also add that this answer looks really disrespectful and unwilling to listen. I hope its just the fact that sometimes context get lost in text.

vogler commented 4 years ago

Ignoring that the directory is not in $PATH on Debian 10, it's just not the right one.

$ man hier
...
      /usr/sbin
              This directory contains program binaries for system administration which are not
              essential for the boot process, for mounting /usr, or for system repair.

Also see https://askubuntu.com/questions/308045/differences-between-bin-sbin-usr-bin-usr-sbin-usr-local-bin-usr-local. Since it should be executable by non-root users without sudo, it should be placed in /usr/bin, as others do:

$ type influx chronograf
influx is /usr/bin/influx
chronograf is /usr/bin/chronograf