1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-07 17:17:41 +03:00

M #: Add new monitoring parameter to GOCA

This commit is contained in:
Christian González 2020-05-28 17:40:26 +02:00
parent 924d5d9018
commit 4e1e3e54dd
No known key found for this signature in database
GPG Key ID: BC941A50DF6A42EA
2 changed files with 13 additions and 2 deletions

View File

@ -110,6 +110,16 @@ func (hc *HostsController) Create(name, im, vm string, clusterID int) (int, erro
return response.BodyInt(), nil
}
// Monitoring Returns the Hosts monitoring records
// * num: The number of records to be retrieved. If it is -1, all the records will be retrieved.
func (hc *HostsController) Monitoring(num int) (string, error) {
monitorData, err := hc.c.Client.Call("one.hostpool.monitoring", num)
if err != nil {
return "", err
}
return monitorData.Body(), nil
}
// Delete deletes the given host from the pool
func (hc *HostController) Delete() error {
_, err := hc.c.Client.Call("one.host.delete", hc.ID)

View File

@ -180,8 +180,9 @@ func (vc *VMController) Info(decrypt bool) (*vm.VM, error) {
// -2: All resources
// -1: Resources belonging to the user and any of his groups
// >= 0: UID User's Resources
func (vc *VMsController) Monitoring(filter int) (string, error) {
monitorData, err := vc.c.Client.Call("one.vmpool.monitoring", filter)
// num: the number of records to be retrieved. If -1 every record is retrieved
func (vc *VMsController) Monitoring(filter, num int) (string, error) {
monitorData, err := vc.c.Client.Call("one.vmpool.monitoring", filter, num)
if err != nil {
return "", err
}