hassio-addons / addon-grafana

Grafana - Home Assistant Community Add-ons
https://addons.community
MIT License
226 stars 62 forks source link

Anonymous Login currently broken? #404

Closed AlexHuebi closed 1 month ago

AlexHuebi commented 4 months ago

Problem/Motivation

I wanted to set up Grafana with Anonymous Login since not all Users have direct access and I wanted to embed some of the graphs into HA pages.

Expected behavior

Non-Admin Users should be able to View the Graphs that I had included in some Dashboards.

Actual behavior

Non-Admin Users and even sometimes Admin Users don't get shown a graph but instead 401: Unauthorized.

Steps to reproduce

Currently I am not sure if there are Issues with my Setup or if it really is the Grafana Addon.

The current configuration file for the Grafana Addon looks like this:

plugins: []
custom_plugins: []
env_vars:
  - name: GF_AUTH_ANONYMOUS_ENABLED
    value: "true"
  - name: GF_AUTH_ANONYMOUS_ORG_NAME
    value: Main Org.
  - name: GF_AUTH_ANONYMOUS_ORG_ROLE
    value: Viewer
ssl: true
certfile: fullchain.pem
keyfile: privkey.pem
Here are the Logs of the Addon Container. ``` s6-rc: info: service s6rc-oneshot-runner: starting s6-rc: info: service s6rc-oneshot-runner successfully started s6-rc: info: service base-addon-banner: starting ----------------------------------------------------------- Add-on: Grafana The open platform for beautiful analytics and monitoring ----------------------------------------------------------- Add-on version: 10.0.0 You are running the latest version of this add-on. System: Debian GNU/Linux 12 (bookworm) (amd64 / qemux86-64) Home Assistant Core: 2024.5.5 Home Assistant Supervisor: 2024.05.1 ----------------------------------------------------------- Please, share the above information when looking for help or support in, e.g., GitHub, forums or the Discord chat. ----------------------------------------------------------- s6-rc: info: service base-addon-banner successfully started s6-rc: info: service fix-attrs: starting s6-rc: info: service base-addon-timezone: starting s6-rc: info: service base-addon-log-level: starting s6-rc: info: service fix-attrs successfully started [19:17:58] INFO: Configuring timezone (Europe/Vienna)... s6-rc: info: service base-addon-log-level successfully started s6-rc: info: service base-addon-timezone successfully started s6-rc: info: service legacy-cont-init: starting s6-rc: info: service legacy-cont-init successfully started s6-rc: info: service init-nginx: starting s6-rc: info: service init-grafana: starting s6-rc: info: service memcached: starting s6-rc: info: service memcached successfully started [19:17:58] INFO: Starting Memcached... s6-rc: info: service init-nginx successfully started s6-rc: info: service init-grafana successfully started s6-rc: info: service grafana: starting s6-rc: info: service grafana successfully started s6-rc: info: service nginx: starting s6-rc: info: service nginx successfully started s6-rc: info: service legacy-services: starting [19:17:58] INFO: Starting Grafana... s6-rc: info: service legacy-services successfully started [19:17:59] INFO: Setting GF_AUTH_ANONYMOUS_ENABLED to true [19:17:59] INFO: Setting GF_AUTH_ANONYMOUS_ORG_NAME to Main Org. [19:17:59] INFO: Setting GF_AUTH_ANONYMOUS_ORG_ROLE to Viewer Grafana server is running with elevated privileges. This is not recommended logger=settings t=2024-05-26T19:17:59.407523663+02:00 level=info msg="Starting Grafana" version=11.0.0 commit=277ef258d4b9a5acdf2932347c6a4ca72d739b28 branch=HEAD compiled=2024-05-26T19:17:59+02:00 logger=settings t=2024-05-26T19:17:59.408078098+02:00 level=info msg="Config loaded from" file=/usr/share/grafana/conf/defaults.ini logger=settings t=2024-05-26T19:17:59.408288192+02:00 level=info msg="Config loaded from" file=/etc/grafana/grafana.ini logger=settings t=2024-05-26T19:17:59.408526299+02:00 level=info msg="Config overridden from Environment variable" var="GF_AUTH_ANONYMOUS_ENABLED=true" logger=settings t=2024-05-26T19:17:59.408738284+02:00 level=info msg="Config overridden from Environment variable" var="GF_AUTH_ANONYMOUS_ORG_NAME=Main Org." logger=settings t=2024-05-26T19:17:59.409008971+02:00 level=info msg="Config overridden from Environment variable" var="GF_AUTH_ANONYMOUS_ORG_ROLE=Viewer" logger=settings t=2024-05-26T19:17:59.409225797+02:00 level=info msg=Target target=[all] logger=settings t=2024-05-26T19:17:59.409443052+02:00 level=info msg="Path Home" path=/usr/share/grafana logger=settings t=2024-05-26T19:17:59.409639218+02:00 level=info msg="Path Data" path=/data logger=settings t=2024-05-26T19:17:59.409848453+02:00 level=info msg="Path Logs" path=/var/logs/grafana logger=settings t=2024-05-26T19:17:59.410043577+02:00 level=info msg="Path Plugins" path=/var/lib/grafana/plugins logger=settings t=2024-05-26T19:17:59.410251223+02:00 level=info msg="Path Provisioning" path=/usr/share/grafana/conf/provisioning logger=settings t=2024-05-26T19:17:59.410450218+02:00 level=info msg="App mode production" logger=sqlstore t=2024-05-26T19:17:59.414883993+02:00 level=info msg="Connecting to DB" dbtype=sqlite3 logger=migrator t=2024-05-26T19:17:59.432849498+02:00 level=info msg="Locking database" logger=migrator t=2024-05-26T19:17:59.433264028+02:00 level=info msg="Starting DB migrations" logger=migrator t=2024-05-26T19:17:59.457218607+02:00 level=info msg="migrations completed" performed=0 skipped=558 duration=763.321µs logger=migrator t=2024-05-26T19:17:59.458374477+02:00 level=info msg="Unlocking database" logger=secrets t=2024-05-26T19:17:59.459594458+02:00 level=info msg="Envelope encryption state" enabled=true currentprovider=secretKey.v1 logger=plugins.registration t=2024-05-26T19:18:02.708647156+02:00 level=info msg="Plugin registered" pluginId=grafana-image-renderer logger=plugin.angulardetectorsprovider.dynamic t=2024-05-26T19:18:02.709829846+02:00 level=info msg="Restored cache from database" duration=497.292µs logger=plugin.store t=2024-05-26T19:18:02.779340308+02:00 level=info msg="Loading plugins..." logger=plugins.registration t=2024-05-26T19:18:02.825321635+02:00 level=error msg="Could not register plugin" pluginId=xychart error="plugin xychart is already registered" logger=plugins.initialization t=2024-05-26T19:18:02.825751076+02:00 level=error msg="Could not initialize plugin" pluginId=xychart error="plugin xychart is already registered" logger=plugin.store t=2024-05-26T19:18:02.829340588+02:00 level=info msg="Plugins loaded" count=54 duration=50.00148ms logger=query_data t=2024-05-26T19:18:02.834470221+02:00 level=info msg="Query Service initialization" logger=live.push_http t=2024-05-26T19:18:02.838010722+02:00 level=info msg="Live Push Gateway initialization" logger=ngalert.notifier.alertmanager org=1 t=2024-05-26T19:18:02.842308122+02:00 level=info msg="Applying new configuration to Alertmanager" configHash=0890ab650f2d7bf43bc44243d438e3b3 logger=ngalert t=2024-05-26T19:18:02.845638028+02:00 level=warn msg="Unexpected number of rows updating alert configuration history" rows=0 org=1 hash=8c409350c88d78d2ee938448449e628d logger=ngalert.state.manager t=2024-05-26T19:18:02.847072315+02:00 level=info msg="Running in alternative execution of Error/NoData mode" logger=infra.usagestats.collector t=2024-05-26T19:18:02.849017926+02:00 level=info msg="registering usage stat providers" usageStatsProvidersLen=2 logger=provisioning.alerting t=2024-05-26T19:18:02.850115924+02:00 level=info msg="starting to provision alerting" logger=provisioning.alerting t=2024-05-26T19:18:02.85035433+02:00 level=info msg="finished to provision alerting" logger=http.server t=2024-05-26T19:18:02.852624129+02:00 level=info msg="HTTP Server Listen" address=[::]:3000 protocol=http subUrl=/api/hassio_ingress/vUUTd5YzDTOsB6_vC5LdC2Hi7uNGxoaXin_hYiIxfg4 socket= logger=ngalert.state.manager t=2024-05-26T19:18:02.852915676+02:00 level=info msg="Warming state cache for startup" logger=ngalert.state.manager t=2024-05-26T19:18:02.85345106+02:00 level=info msg="State cache has been initialized" states=0 duration=534.424µs logger=provisioning.dashboard t=2024-05-26T19:18:02.854763454+02:00 level=info msg="starting to provision dashboards" logger=provisioning.dashboard t=2024-05-26T19:18:02.85500157+02:00 level=info msg="finished to provision dashboards" logger=grafanaStorageLogger t=2024-05-26T19:18:02.857175776+02:00 level=info msg="Storage starting" logger=ngalert.multiorg.alertmanager t=2024-05-26T19:18:02.897355352+02:00 level=info msg="Starting MultiOrg Alertmanager" logger=ngalert.scheduler t=2024-05-26T19:18:02.897803604+02:00 level=info msg="Starting scheduler" tickInterval=10s maxAttempts=1 logger=ticker t=2024-05-26T19:18:02.898056071+02:00 level=info msg=starting first_tick=2024-05-26T19:18:10+02:00 [19:18:03] INFO: Starting NGINX... logger=grafana.update.checker t=2024-05-26T19:18:03.231563837+02:00 level=info msg="Update check succeeded" duration=376.309992ms logger=grafana-apiserver t=2024-05-26T19:18:05.067571249+02:00 level=info msg="Adding GroupVersion playlist.grafana.app v0alpha1 to ResourceManager" logger=grafana-apiserver t=2024-05-26T19:18:05.069489228+02:00 level=info msg="Adding GroupVersion featuretoggle.grafana.app v0alpha1 to ResourceManager" logger=plugin.grafana-image-renderer t=2024-05-26T19:18:05.860941732+02:00 level=warn msg="Plugin process is running with elevated privileges. This is not recommended" logger=plugins.update.checker t=2024-05-26T19:18:05.935034989+02:00 level=info msg="Update check succeeded" duration=3.078712396s ``` <\details> It seems that the config is correctly loaded but why do I get the 401 response then..
github-actions[bot] commented 3 months ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

AlexHuebi commented 3 months ago

HA Core 2024.6.4 Grafana 10.0.0 still persistent

github-actions[bot] commented 2 months ago

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

AlexHuebi commented 2 months ago

HA Core 2024.7.4 Grafana 10.0.0 still persistent

thomas-midgley commented 2 months ago

same here.
Ver 2024.7.4 in a Unraid VM+Grafana 10+InfluxDB3.0 anonymous login not possible, 401 Error.

Even logged in with an admin HA user, I have a "401:Unauthorized", but when I just click once on either Grafana or InfluxDB and then go back, all the visualizations are there and work fine.

image image

Bodengriller commented 1 month ago

same here

Core 2024.8.2 Supervisor 2024.08.0 Operating System 13.0 Frontend 20240809.0 Grafana 10.0.0

sinclairpaul commented 1 month ago

You need the cookie via logging onto the app if you want to embed iframes. There isn't anything that can be fixed here.