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

How to use apitoken in datasource yaml file? #1949

Closed
robinpecha opened this issue Jan 13, 2025 · 3 comments
Closed

How to use apitoken in datasource yaml file? #1949

robinpecha opened this issue Jan 13, 2025 · 3 comments

Comments

@robinpecha
Copy link

robinpecha commented Jan 13, 2025

Describe the bug
I can't find any documentation on how to set up authentication to zabbix using the api token in the yaml datasource.

Expected behavior
Set api token and authenticate as with username/password.

Software versions

Grafana Zabbix Grafana-Zabbix Plugin
10.4.3 6.0.8 4.6.1

Description
From version [4.4.0] - 2023-08-17 is implemented this feature:
Able to use API tokens for authentication, #1513

- Able to use API tokens for authentication, [#1513](https://github.com/alexanderzobnin/grafana-zabbix/issues/1513)

So Im able to set it via the grafana web ui. But Im failing to do it via datasource yaml file. I cannot find any documentation about this, in official one https://grafana.com/docs/plugins/alexanderzobnin-zabbix-app/latest/configuration/provisioning/ is descried only basic one username/password.
So only thing I found is this commit: ab528e2 and there I found in src/datasource/type.ts value apitoken:
Image

Please do you have some advice?

This is not working:

apiVersion: 1
datasources:
  - name: Zabbix
    type: alexanderzobnin-zabbix-datasource
    url: https://myzabbix.url/api_jsonrpc.php
    access: proxy
    jsonData:
      apitoken: 123456789abcdefghij
    secureJsonData:
      apitoken: 123456789abcdefghij

But this works well on the same server:

apiVersion: 1
datasources:
  - name: Zabbix
    type: alexanderzobnin-zabbix-datasource
    url: https://myzabbix.url/api_jsonrpc.php
    access: proxy
    jsonData:
      username: myuser
    secureJsonData:
      password: mypassword
@zoltanbedi
Copy link
Member

it is in the secureJsonData with a capital T apiToken.

@ashg0
Copy link

ashg0 commented Feb 3, 2025

Is authType: token also necessary?

@zoltanbedi
Copy link
Member

it is, yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants