fix stats
This commit is contained in:
parent
4a5770cff6
commit
f7c2d6e911
3 changed files with 13 additions and 13 deletions
|
@ -49,11 +49,14 @@ class QemuStats(object):
|
|||
# dom = conn.lookupByID(5)
|
||||
dom = self.conn.lookupByName(dom_name)
|
||||
if not dom:
|
||||
print('Failed to find the domain '+dom_name, file=sys.stderr)
|
||||
print('Failed to find the domain ' + dom_name, file=sys.stderr)
|
||||
return results
|
||||
|
||||
try:
|
||||
stats = dom.getCPUStats(True)
|
||||
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
results['cpu_time'] = str(stats[0]['cpu_time'] / 100000)
|
||||
results['system_time'] = str(stats[0]['system_time'] / 100000)
|
||||
results['user_time'] = str(stats[0]['user_time'] / 10000)
|
||||
|
@ -70,7 +73,7 @@ class QemuStats(object):
|
|||
# dom = conn.lookupByID(5)
|
||||
dom = self.conn.lookupByName(dom_name)
|
||||
if not dom:
|
||||
print('Failed to find the domain '+dom_name, file=sys.stderr)
|
||||
print('Failed to find the domain ' + dom_name, file=sys.stderr)
|
||||
return results
|
||||
|
||||
stats = dom.memoryStats()
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/usr/bin/env python
|
||||
# coding: utf-8
|
||||
|
||||
import requests
|
||||
from SWSCloudNode import Node, StatisticsReporter
|
||||
from SWSCloudNode import LXC
|
||||
from SWSCloudNode import Qemu
|
||||
|
@ -15,7 +14,7 @@ for container in cls_lxc.list_containers():
|
|||
# print container
|
||||
info = cls_lxc.info(container)
|
||||
info['container_id'] = info['name']
|
||||
print cls_node.report_container_stats(info['container_id'], info)
|
||||
print (cls_node.report_container_stats(info['container_id'], info))
|
||||
# print info
|
||||
|
||||
|
||||
|
@ -26,10 +25,8 @@ curl localhost:8089/node_stats/v1/compute/vms/04ea5600-89c6-11e6-b1e1-fb8145d56e
|
|||
vms = cls_qemu.list().get('online')
|
||||
for vm in vms:
|
||||
dom = vms.get(vm).get('hostname')
|
||||
|
||||
data = dict(
|
||||
nework=QemuStats().network(dom),
|
||||
cpu=QemuStats().cpu(dom),
|
||||
memory=QemuStats().memory(dom))
|
||||
|
||||
print StatisticsReporter().send_vm_statistics(dom, data)
|
||||
print (StatisticsReporter().send_vm_statistics(dom, data))
|
||||
|
|
2
setup.py
2
setup.py
|
@ -4,7 +4,7 @@ from setuptools import setup
|
|||
|
||||
setup(
|
||||
name='SWSCloudNode',
|
||||
version='3.3.0',
|
||||
version='3.3.1',
|
||||
author='Vyacheslav Anzhiganov',
|
||||
author_email='vanzhiganov@ya.ru',
|
||||
packages=[
|
||||
|
|
Loading…
Add table
Reference in a new issue