Telegraf: Proxmox plugin returns - Error in plugin: unexpected end of JSON input

Created on 22 Oct 2020  路  8Comments  路  Source: influxdata/telegraf

Proxmox plugin returns: _Error in plugin: unexpected end of JSON input_
Proxmox token created for root user. Token permissions to / with Administrator privileges have been granted.

telegraf.conf:

base_url = "https://127.0.0.1:8006/api2/json"
api_token = "root@pam!xxxxxx-xxxxxxx"
node_name = "Firewall"
insecure_skip_verify = true
response_timeout = "5s"
bug

Most helpful comment

For me this worked:

  1. in Datacenter > Permissions > Users create a new user, in my example telegraftest with realm as PAM
  2. in Datacenter > Permissions > API Tokens add a new token, with user telegraftest and some Token ID, i chose monitoring
  3. It will show you a new window with Token Secret:
    Token ID: telegraftest@pam!monitoring
    Secret: 2ad31dce-1a08-4b9f-a284-766f71e1bd58
  4. in Datacenter > Permissions > Add new API Token Permission, with Path /, API Token telegraftest@pam!monitoring and Role PVEAuditor
  5. in telegraf.conf it will then look something like this: api_token = "telegraftest@pam!monitoring=2ad31dce-1a08-4b9f-a284-766f71e1bd58"

However, I'm now facing the same issue with node_name not found as in issue #8300

All 8 comments

Might be something wrong with your API token. I have to same issue but doubts about the token content/format
Can anyone post a fake token to see how it looks like?

Might be something wrong with your API token. I have to same issue but doubts about the token content/format

Can anyone post a fake token to see how it looks like?

I've tried - "telegraf-grafana" token and it won't work.

See here https://www.jamescoyle.net/how-to/2666-getting-started-with-proxmox-http-api-commands

Not working. I've seen this before. First it says that token is valid for 2 hours only. But anyway, putting _CSRFPreventionToken_ into the telegraf conf like this:
api_token = "root@pam:5F9DDEEA:KWgo687wl/2CbfvPCFwqs72Q9MCrwc+Af0zedRr7lWo"
or
putting _ticket_ value like this:
api_token = "root@pam:5F9DDEEA::BYg9d4E41OOV8pfRxkUXyOFTlAdmffAfgHNwRzFtA+rHIhWXN7wcka8g2x9Wsm8L46G5SoY2TgQPUH6feGWK4EkUndynT1ol35N7eOSyxzNgotNDsWd5D8citAE02zQhJ0cHIUL2byj4iLvAlPmNWAuRPfLAGLWWeMgXSyqRXs9SPC1uryd8LdsOdxiEdzs2aKkotMiy3E9VFpy1ckDjnVm45LmCWjUtvD8NiAisEvdsSS9rzsz9pUbV9sfwNt8p/LcOEFjfl1L18q882Th4520qLZixU2LWHIyxlCHPPIi/tqAbdeTSRHLWgF3ZF+ihI6/FkdpLaBRDZGzXHJCRTw=="
won't make plugin work.

Unless instructions on the GitHub for the plugin are not correct and not clear. Please advise.

Update: I have used the Proxmox web interface for API Token generation. However, it also doesn't work.

Something must be wrong here USER@REALM!TOKENID=UUID

In !TOKENID=UUID

It's not clear what and how should be used in TOKENID=UUID.
If
"CSRFPreventionToken": "5F9DDEEA:KWgo687wl/2CbfvPCFwqs72Q8MCrwc+Af0zedRr7lWo"
than
telegraf configuration should look like this:
api_token = "root@pam!5F9DDEEA:KWgo687wl/2CbfvPCFwqs72Q8MCrwc+Af0zedRr7lWo"
or
api_token = "root@pam!TOKENID=5F9DDEEA:KWgo687wl/2CbfvPCFwqs72Q8MCrwc+Af0zedRr7lWo"

In other words, should TOKENID word to be in the parameter? Though I've tried all possible combinations and none of them works.

For me this worked:

  1. in Datacenter > Permissions > Users create a new user, in my example telegraftest with realm as PAM
  2. in Datacenter > Permissions > API Tokens add a new token, with user telegraftest and some Token ID, i chose monitoring
  3. It will show you a new window with Token Secret:
    Token ID: telegraftest@pam!monitoring
    Secret: 2ad31dce-1a08-4b9f-a284-766f71e1bd58
  4. in Datacenter > Permissions > Add new API Token Permission, with Path /, API Token telegraftest@pam!monitoring and Role PVEAuditor
  5. in telegraf.conf it will then look something like this: api_token = "telegraftest@pam!monitoring=2ad31dce-1a08-4b9f-a284-766f71e1bd58"

However, I'm now facing the same issue with node_name not found as in issue #8300

Many thanks @jstehlik your instruction worked fine.
Closing this issue.

Was this page helpful?
0 / 5 - 0 ratings