MrKampf / proxmoxVE

The is a PHP 8 ProxmoxVe API client. With it you can easily and quickly retrieve information from your Proxmox server or cluster.
GNU General Public License v3.0
51 stars 26 forks source link

Rrddata #47

Closed Ballard-dev closed 6 months ago

Ballard-dev commented 6 months ago

https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/rrddata

    class Rrddata extends PVEPathClassBase

    ...

    public function get(): ?array
    {
        return $this->getPve()->getApi()->get($this->getPathAdditional());
    }

Rrddata requires timeframe.

Timeframe is a required parameter for rrddata hour | day | week | month | year enum

Without timeframe null will always be returned here.

I tried to open a PR, but cannot commit to a branch, here's my changes in Proxmox/Api/Nodes/Node/Rrddata.php

    /**
     * Read node RRD statistics
     * @link https://pve.proxmox.com/pve-docs/api-viewer/#/nodes/{node}/rrddata
     * @param array $params An array specifying the time intervals for which statistics should be retrieved.
     * Supported keys:
     * ['timeframe' =>
     * - 'hour': Retrieve statistics for the last hour.
     * - 'day': Retrieve statistics for the last day.
     * - 'week': Retrieve statistics for the last week.
     * - 'month': Retrieve statistics for the last month.
     * - 'year': Retrieve statistics for the last year.
     * ]
     * @return array|null
     */
    public function get(array $params = []): ?array
    {
        return $this->getPve()->getApi()->get($this->getPathAdditional(), $params);
    }
Ballard-dev commented 6 months ago

also 'cf' is an optional

MrKampf commented 6 months ago

Thanks for information, this week i release a new version with fix!

Ballard-dev commented 6 months ago

Thanks!