apricote / grafana-hcloud-datasource

Metrics for your Hetzner Cloud Servers and Load Balancers in Grafana.
https://grafana.com/grafana/plugins/apricote-hcloud-datasource/
Apache License 2.0
18 stars 0 forks source link

How to provision apiToken? #8

Open vshuraeff opened 1 month ago

vshuraeff commented 1 month ago

Hi! I use provisioned DataSources via docker-compose and include file like this

  - name: HetznerCloud
    type: 'apricote-hcloud-datasource'
    access: proxy
    isDefault: false
    orgId: 1
    version: 1
    secureJsonData:
      apiToken: ${HETZNER_CLOUD_TOKEN}

But it's not working =( How I should do this right way? Moreover, if I paste working API Toket to field, I've got an error:

API Token was not configured or does not work, a valid API Token is required for the data source to access the Hetzner Cloud API

How to diagnose what's going wrong? In Grafana Logs, after pressing Test button I see only this: logger=context userId=1 orgId=1 uname=admin t=2024-08-07T13:30:12.529959137Z level=info msg="Request Completed" method=GET path=/api/datasources/uid/PC8C36DBD0101EDFD/health status=400 remote_addr=192.168.65.1 time_ms=311 duration=311.669667ms size=159 referer=http://localhost:3000/connections/datasources/edit/PC8C36DBD0101EDFD handler=/api/datasources/uid/:uid/health status_source=server

apricote commented 1 month ago

Can you test the following?

  1. Enable debug logging in the data source settings (Under "Development > Options")
  2. Paste in the token
  3. Test
  4. Check the Grafana Logs again

You should see a request being made to the Hetzner Cloud API. Can you share that here?

vshuraeff commented 1 month ago

I can't enable Debug, I assume this is because this datasource is provisioned. Of course I've tried to enable Debug, but nothing happen.