Commit 54dadb4e by Gregory Nagy

Client vm report path vm. domain added

parent d4be0ad2
...@@ -12,6 +12,7 @@ logging.basicConfig() ...@@ -12,6 +12,7 @@ logging.basicConfig()
class Client: class Client:
def __init__(self, config): def __init__(self, config):
""" """
Constructor of the client class that is responsible for handling the Constructor of the client class that is responsible for handling the
...@@ -69,7 +70,6 @@ class Client: ...@@ -69,7 +70,6 @@ class Client:
self.beat = 1 self.beat = 1
self.valid = True self.valid = True
def __connect(self): def __connect(self):
""" """
This method creates the connection to the queue of the graphite This method creates the connection to the queue of the graphite
...@@ -179,14 +179,14 @@ class Client: ...@@ -179,14 +179,14 @@ class Client:
for vm in running_vms: for vm in running_vms:
vm_proc = psutil.Process(vm[1]) vm_proc = psutil.Process(vm[1])
if ((self.beat % self.kvmCPU) is 0) and vm_proc.is_running(): if ((self.beat % self.kvmCPU) is 0) and vm_proc.is_running():
metrics.append((self.name + "." + "kvm." + metrics.append(("vm." +
vm[0] + "." + "memory.usage" + vm[0] + "." + "memory.usage" +
" %d" % ( " %d" % (
vm_proc.get_memory_percent() / 100 * vm[2]) vm_proc.get_memory_percent() / 100 * vm[2])
+ " %d" % (time.time()) + " %d" % (time.time())
)) ))
if ((self.beat % self.kvmMem) is 0) and vm_proc.is_running(): if ((self.beat % self.kvmMem) is 0) and vm_proc.is_running():
metrics.append((self.name + "." + "kvm." + metrics.append(("vm." +
vm[0] + "." + "cpu.usage" + vm[0] + "." + "cpu.usage" +
" %d" % (vm_proc.get_cpu_times().system + " %d" % (vm_proc.get_cpu_times().system +
vm_proc.get_cpu_times().user) vm_proc.get_cpu_times().user)
...@@ -199,31 +199,32 @@ class Client: ...@@ -199,31 +199,32 @@ class Client:
for vm in running_vms: for vm in running_vms:
for iname_index, iname in interfaces_list_enum: for iname_index, iname in interfaces_list_enum:
if vm[0] in iname: if vm[0] in iname:
metrics.append((self.name + "." + "kvm." + metrics.append(("vm." +
vm[ vm[0] +
0] + "." + "network.packages_sent" + "." + "network.packages_sent" +
" %d" % interfaces_list[ " %d" % interfaces_list[
iname].packets_sent iname].packets_sent
+ " %d" % (time.time()) + " %d" % (time.time())
)) ))
metrics.append((self.name + "." + "kvm." + metrics.append(("vm." +
vm[ vm[0] +
0] + "." + "network.packages_recv" + "." + "network.packages_recv" +
" %d" % interfaces_list[ " %d" % interfaces_list[
iname].packets_recv iname].packets_recv
+ " %d" % (time.time()) + " %d" % (time.time())
)) ))
metrics.append((self.name + "." + "kvm." + metrics.append(("vm." +
vm[0] + "." + "network" vm[0] + "." + "network"
".bytes_sent" + ".bytes_sent" +
" %d" % interfaces_list[ " %d" % interfaces_list[
iname].bytes_sent iname].bytes_sent
+ " %d" % (time.time()) + " %d" % (time.time())
)) ))
metrics.append((self.name + "." + "kvm." + metrics.append(("vm." +
vm[0] + "." + "network.bytes_recv" + vm[0] +
" %d" % interfaces_list[ + "network.bytes_recv" +
iname].bytes_recv " %d" %
interfaces_list[iname].bytes_recv
+ " %d" % (time.time()) + " %d" % (time.time())
)) ))
return metrics 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