diogogmt / webvirt

NodeJS application to manage hyper-visors though libvirt
1 stars 2 forks source link

Create API Call: daemonDetails #2

Closed sedge closed 11 years ago

sedge commented 11 years ago

Create an API call that, provided with a daemon-server IP, runs three Virsh commands

virsh version virsh nodecpustats --percent virsh nodememstats

and parses them, returning the following format:

{
   hypervisor: xxx,
   cpuIdle: xxx,
   cpuUsed: xxx,
   ramFree: xxx,
   ramUsed: xxx
}
diogogmt commented 11 years ago

The current state of the API returns the following response:

{
  "version": {
    "stderr": "",
    "stdout": "Compiled against library: libvir 0.9.13\nUsing library: libvir 0.9.13\nUsing API: QEMU 0.9.13\nRunning hypervisor: QEMU 1.0.0",
    "hypervisor": "QEMU 0.9.13",
    "api": "libvir 0.9.13",
    "library": "libvir 0.9.13"
  },
  "cpuStats": {
    "stderr": "",
    "stdout": "usage:            0.7%\nuser:             0.5%\nsystem:           0.2%\nidle:            99.3%\niowait:           0.0%",
    "iowait": "0.0",
    "idle": "99.3",
    "system": "0.2",
    "user": "0.5",
    "usage": "0.7"
  },
  "memStats": {
    "stderr": "",
    "stdout": "total  :             16294560 KiB\nfree   :             12072392 KiB\nbuffers:               185188 KiB\ncached :              1948508 KiB",
    "cached": "1948508",
    "buffers": "185188",
    "free": "12072392",
    "total": "16294560"
  }
}
diogogmt commented 11 years ago

Memory stats are displayed in GB values.