Kurt Peek
Kurt Peek

Reputation: 57461

Started Grafana, but no logs or server at localhost:3000?

I'm trying to follow the instructions at https://grafana.com/docs/installation/mac/ to install Grafana locally on a Mac. I've installed Grafana using brew install grafana, then started it using brew services start grafana:

> brew services list | grep grafana
grafana    started kurt /Users/kurt/Library/LaunchAgents/homebrew.mxcl.grafana.plist

However, I don't see any Grafana admin page at localhost:3000:

> curl http://localhost:3000/
curl: (7) Failed to connect to localhost port 3000: Connection refused

Also, I don't see any log file at /usr/local/var/log/grafana/grafana.log as documented there:

> tail -f /usr/local/var/log/grafana/grafana.log
tail: /usr/local/var/log/grafana/grafana.log: No such file or directory

How can I interact with Grafana now that it's (supposedly) running?

Upvotes: 2

Views: 1948

Answers (2)

cmore
cmore

Reputation: 21

It looks like some issue with launchd plist? Executing "brew services start grafana -v" yields:

   <?xml version="1.0" encoding="UTF-8"?>
   <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
   <plist version="1.0">
   <dict>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>homebrew.mxcl.grafana</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/opt/grafana/bin/grafana-server</string>
        <string>--config</string>
        <string>/usr/local/etc/grafana/grafana.ini</string>
        <string>--homepath</string>
        <string>/usr/local/opt/grafana/share/grafana</string>
        <string>--packaging=brew</string>
        <string>cfg:default.paths.logs=/usr/local/var/log/grafana</string>
        <string>cfg:default.paths.data=/usr/local/var/lib/grafana</string>
        <string>cfg:default.paths.plugins=/usr/local/var/lib/grafana/plugins</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>StandardErrorPath</key>
    <string>/usr/local/var/log/grafana-stderr.log</string>
    <key>StandardOutPath</key>
    <string>/usr/local/var/log/grafana-stdout.log</string>
    <key>WorkingDirectory</key>
    <string>/usr/local/var/lib/grafana</string>
   </dict>
   </plist>
/bin/launchctl enable gui/501/homebrew.mxcl.grafana
/bin/launchctl bootstrap gui/501 /Users/cmore/Library/LaunchAgents/homebrew.mxcl.grafana.plist
Bootstrap failed: 5: Input/output error
Error: Failure while executing; `/bin/launchctl bootstrap gui/501 /Users/cmore/Library/LaunchAgents/homebrew.mxcl.grafana.plist` exited with 5.

If one takes the strings from the array and executes them on the command line, then grafana starts up:

/usr/local/opt/grafana/bin/grafana-server --config /usr/local/etc/grafana/grafana.ini --homepath /usr/local/opt/grafana/share/grafana --packaging=brew cfg:default.paths.logs=/usr/local/var/log/grafana cfg:default.paths.data=/usr/local/var/lib/grafana cfg:default.paths.plugins=/usr/local/var/lib/grafana/plugins

Upvotes: 1

Kurt Peek
Kurt Peek

Reputation: 57461

I ended up installing it using the instructions for Docker (https://grafana.com/docs/installation/docker/):

> docker run \
                                                -d \
                                                -p 3000:3000 \
                                                --name=grafana \
                                                -e "GF_SERVER_ROOT_URL=http://grafana.server.name" \
                                                -e "GF_SECURITY_ADMIN_PASSWORD=secret" \
                                                grafana/grafana

and can now see a login page (where I logged in with the default username admin and specified password secret):

enter image description here

I still don't know why the MacOS installation didn't work though?

Upvotes: 1

Related Questions