Skip to content

Instantly share code, notes, and snippets.

@apahim
Created February 25, 2014 13:10
Show Gist options
  • Save apahim/9208444 to your computer and use it in GitHub Desktop.
Save apahim/9208444 to your computer and use it in GitHub Desktop.
>>> for stat in api.hosts.get(name="rhevh").statistics.list():
... print stat.name, stat.values.value[0].datum
...
memory.total 1949302784.0
memory.used 0.0
memory.free 1949302784.0
memory.shared 0.0
memory.buffers 0.0
memory.cached 0.0
swap.total 3123707904.0
swap.free 2986344448.0
swap.used 137363456.0
swap.cached 0.0
ksm.cpu.current 0.0
cpu.current.user 0.0
cpu.current.system 0.0
cpu.current.idle 0.0
cpu.load.avg.5m 0.0
>>> print api.hosts.get(name="rhevh").statistics.get(name="memory.total").values.value[0].datum
1949302784.0
>>> for nic in api.hosts.get(name="rhevh").nics.list():
... print nic.name
...
eth0
>>> for stat in api.hosts.get(name="rhevh").nics.get(name="eth0").statistics.list():
... print stat.name, stat.values.value[0].datum
...
data.current.rx 0.0
data.current.tx 0.0
errors.total.rx 0.0
errors.total.tx 0.0
>>> print api.hosts.get(name="rhevh").nics.get(name="eth0").statistics.get("errors.total.rx").values.value[0].datum
0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment