Commit 54dadb4e by Gregory Nagy

Client vm report path vm. domain added

parent d4be0ad2
......@@ -12,6 +12,7 @@ logging.basicConfig()
class Client:
def __init__(self, config):
"""
Constructor of the client class that is responsible for handling the
......@@ -69,7 +70,6 @@ class Client:
self.beat = 1
self.valid = True
def __connect(self):
"""
This method creates the connection to the queue of the graphite
......@@ -179,14 +179,14 @@ class Client:
for vm in running_vms:
vm_proc = psutil.Process(vm[1])
if ((self.beat % self.kvmCPU) is 0) and vm_proc.is_running():
metrics.append((self.name + "." + "kvm." +
metrics.append(("vm." +
vm[0] + "." + "memory.usage" +
" %d" % (
vm_proc.get_memory_percent() / 100 * vm[2])
+ " %d" % (time.time())
))
if ((self.beat % self.kvmMem) is 0) and vm_proc.is_running():
metrics.append((self.name + "." + "kvm." +
metrics.append(("vm." +
vm[0] + "." + "cpu.usage" +
" %d" % (vm_proc.get_cpu_times().system +
vm_proc.get_cpu_times().user)
......@@ -199,31 +199,32 @@ class Client:
for vm in running_vms:
for iname_index, iname in interfaces_list_enum:
if vm[0] in iname:
metrics.append((self.name + "." + "kvm." +
vm[
0] + "." + "network.packages_sent" +
metrics.append(("vm." +
vm[0] +
"." + "network.packages_sent" +
" %d" % interfaces_list[
iname].packets_sent
+ " %d" % (time.time())
))
metrics.append((self.name + "." + "kvm." +
vm[
0] + "." + "network.packages_recv" +
metrics.append(("vm." +
vm[0] +
"." + "network.packages_recv" +
" %d" % interfaces_list[
iname].packets_recv
+ " %d" % (time.time())
))
metrics.append((self.name + "." + "kvm." +
metrics.append(("vm." +
vm[0] + "." + "network"
".bytes_sent" +
" %d" % interfaces_list[
iname].bytes_sent
+ " %d" % (time.time())
))
metrics.append((self.name + "." + "kvm." +
vm[0] + "." + "network.bytes_recv" +
" %d" % interfaces_list[
iname].bytes_recv
metrics.append(("vm." +
vm[0] +
+ "network.bytes_recv" +
" %d" %
interfaces_list[iname].bytes_recv
+ " %d" % (time.time())
))
return metrics
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment