feat(hostinger): VPS resource metrics modal — CPU, RAM, disco, tráfico, uptime

This commit is contained in:
Lizandro Guarnizo
2026-05-14 21:00:57 -05:00
parent 1dd1a67459
commit 277ad6bb63
3 changed files with 144 additions and 3 deletions
+4 -2
View File
@@ -382,8 +382,10 @@ func (c *HostingerClient) SetVPSHostname(vmID int, hostname string) error {
}
// GetVPSMetrics obtiene las métricas de uso de una VM.
func (c *HostingerClient) GetVPSMetrics(vmID int) (json.RawMessage, error) {
path := fmt.Sprintf("/vps/v1/virtual-machines/%d/metrics", vmID)
// dateFrom y dateTo deben estar en formato RFC3339, p. ej. "2025-01-01T00:00:00Z".
func (c *HostingerClient) GetVPSMetrics(vmID int, dateFrom, dateTo string) (json.RawMessage, error) {
path := fmt.Sprintf("/vps/v1/virtual-machines/%d/metrics?date_from=%s&date_to=%s",
vmID, dateFrom, dateTo)
body, err := c.getRaw(context.Background(), path)
if err != nil {
return nil, err