[GH-ISSUE #33] Ping() return current state #9

Closed
opened 2026-03-03 14:44:36 +03:00 by kerem · 2 comments
Owner

Originally created by @alebeta90 on GitHub (May 9, 2022).
Original GitHub issue: https://github.com/luthermonson/go-proxmox/issues/33

Hi friends,

I had been trying this module and it is great.

I just have a question regarding the Ping() method. As far as I can see it returns an error if occurred.

But I had in mind that i could be useful(for me) to get the actual current information from the VM. Is there another method similar to ping that can bring the current state with its full body?

I had a look at the endpoint we are sending the request and it has different kind of information I would like to use
https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/qemu/{vmid}/status/current

or is there a way to get the body of that request?

hope my question is understandable and if you need more info I can provide it

thanks in advance!

Originally created by @alebeta90 on GitHub (May 9, 2022). Original GitHub issue: https://github.com/luthermonson/go-proxmox/issues/33 Hi friends, I had been trying this module and it is great. I just have a question regarding the Ping() method. As far as I can see it returns an error if occurred. But I had in mind that i could be useful(for me) to get the actual current information from the VM. Is there another method similar to ping that can bring the current state with its full body? I had a look at the endpoint we are sending the request and it has different kind of information I would like to use https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/qemu/{vmid}/status/current or is there a way to get the body of that request? hope my question is understandable and if you need more info I can provide it thanks in advance!
kerem closed this issue 2026-03-03 14:44:36 +03:00
Author
Owner

@luthermonson commented on GitHub (May 9, 2022):

I'm glad you enjoy the library!

https://github.com/luthermonson/go-proxmox/blob/main/virtual_machines.go#L16

the last element passed to Get is a pointer to the struct you're currently calling Ping on, this will unmarshall directly into it so the contents of the struct you are working with will be updated when you call Ping. I'm trying to avoid giving full access to returned JSON data from the API and instead using native go structs for everything.

Look at the struct https://github.com/luthermonson/go-proxmox/blob/main/types.go#L194-L218 to see what could be updated from the response sent from the status/current endpoint and if we are missing something you are expecting you can add more members.

<!-- gh-comment-id:1121226925 --> @luthermonson commented on GitHub (May 9, 2022): I'm glad you enjoy the library! https://github.com/luthermonson/go-proxmox/blob/main/virtual_machines.go#L16 the last element passed to Get is a pointer to the struct you're currently calling Ping on, this will unmarshall directly into it so the contents of the struct you are working with will be updated when you call Ping. I'm trying to avoid giving full access to returned JSON data from the API and instead using native go structs for everything. Look at the struct https://github.com/luthermonson/go-proxmox/blob/main/types.go#L194-L218 to see what could be updated from the response sent from the status/current endpoint and if we are missing something you are expecting you can add more members.
Author
Owner

@alebeta90 commented on GitHub (May 10, 2022):

Thanks for the great explanation I will have a look at it! and come back to you

<!-- gh-comment-id:1122451014 --> @alebeta90 commented on GitHub (May 10, 2022): Thanks for the great explanation I will have a look at it! and come back to you
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/go-proxmox#9
No description provided.