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

Error getting VM curent VM status - Proxmox error #9611

Closed
abrondijk opened this issue Aug 11, 2021 · 8 comments · Fixed by #10068
Closed

Error getting VM curent VM status - Proxmox error #9611

abrondijk opened this issue Aug 11, 2021 · 8 comments · Fixed by #10068
Labels
area/syslog bug unexpected problem or unintended behavior

Comments

@abrondijk
Copy link

Relevant telegraf.conf:

# Provides metrics from Proxmox nodes (Proxmox Virtual Environment > 6.2).
[[inputs.proxmox]]
  ## API connection configuration. The API token was introduced in Proxmox v6.2. Required permissions for user and token: PVEAuditor role on /.
  base_url = "https://localhost:8006/api2/json"
  api_token = "<api_token>"
  ## Node name, defaults to OS hostname
  #node_name = ""

  ## Optional TLS Config
  # tls_ca = "/etc/telegraf/ca.pem"
  # tls_cert = "/etc/telegraf/cert.pem"
  # tls_key = "/etc/telegraf/key.pem"

  ## Use TLS but skip chain & host verification
  insecure_skip_verify = true
  # HTTP response timeout (default: 5s)
  response_timeout = "5s"

System info:

PVE 7.0-11 based on debian 11
Telegraf version 1.19.2, installed according to this guide.

Steps to reproduce:

  1. Start the telegraf service

Expected behavior:

I expect telegraf to behave normally and to not spam errors in syslog.

Actual behavior:

The following error on every poll:

Aug 11 12:51:05 Raptor telegraf[625244]: 2021-08-11T10:51:05Z E! [inputs.proxmox] Error getting VM curent VM status: json: cannot unmarshal number into Go struct field VMStat.data.vmid of type string
Aug 11 12:51:05 Raptor telegraf[625244]: 2021-08-11T10:51:05Z E! [inputs.proxmox] Error getting VM stats: %vjson: cannot unmarshal number into Go struct field VMStat.data.vmid of type string

Besides the fact that current is spelled with only 1 R, I expect the data from proxmox to be gathered and sent to my output plugins.

Additional info:

I can confirm that the api token I use is correct, because if I change it, I get a completely different error.

@abrondijk abrondijk added the bug unexpected problem or unintended behavior label Aug 11, 2021
@atetevoortwis
Copy link
Contributor

I've managed to fix this by changing the type of the VM ID from string to int: https://github.com/atetevoortwis/telegraf/tree/bugfix/9611
With that change I can read stats from a Proxmox 7 host.
I don't know whether this int/string change is a Proxmox 6 vs 7 thing though...

@abrondijk
Copy link
Author

That seems like a simple enough fix

I've managed to fix this by changing the type of the VM ID from string to int: https://github.com/atetevoortwis/telegraf/tree/bugfix/9611

@atetevoortwis Where are the proxmox scrips located? I can't seem to find the files to edit in my installation.

@atetevoortwis
Copy link
Contributor

@abrondijk , see the only commit in my branch: atetevoortwis@9dd992f

@rare-magma
Copy link

@atetevoortwis I've tested your changes and it solves the problem for me as well. I'd suggest perhaps opening a pull request so this can get fixed?

@zeus86
Copy link

zeus86 commented Oct 5, 2021

i can btw. confirm this error with the following versions:
pve-manager/7.0-11/63d82f4e (running kernel: 5.11.22-4-pve)
telegraf 1.20.0-1
another node with latest proxmox 6 and the same telegraf version with the same config runs fine.

@zeus86
Copy link

zeus86 commented Oct 5, 2021

the issue btw. still remains, because the contribution license is not accepted in the PR...

@UniverseXXX
Copy link

UniverseXXX commented Oct 5, 2021

I have 2 nodes and both not working.
Update: manual build as per above has fixed the issue.

@abrondijk
Copy link
Author

You can just build telegraf yourself from the branch mentioned by atetevoortwis, that works fine for me on the latest proxmox 7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/syslog bug unexpected problem or unintended behavior
Projects
None yet
5 participants