From 1c870de0f6bca7617ba9c2b896cb17b5137715bd Mon Sep 17 00:00:00 2001 From: Marc Aymerich Date: Mon, 14 Nov 2016 09:24:41 +0000 Subject: [PATCH] Rename openvztraffic monitor to proxmoxopenvztraffic --- orchestra/contrib/systemusers/backends.py | 4 ++-- orchestra/contrib/vps/backends.py | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/orchestra/contrib/systemusers/backends.py b/orchestra/contrib/systemusers/backends.py index 033bd1ee..f8b9f875 100644 --- a/orchestra/contrib/systemusers/backends.py +++ b/orchestra/contrib/systemusers/backends.py @@ -340,7 +340,7 @@ class Exim4Traffic(ServiceMonitor): if sender[0] < int(date) < end_date: sender[2] += int(size[2:]) except IOError as e: - sys.stderr.write(e) + sys.stderr.write(str(e)) for username, opts in users.iteritems(): __, object_id, size = opts @@ -429,7 +429,7 @@ class VsFTPdTraffic(ServiceMonitor): bytes = bytes_regex.search(line).groups()[0] user[2] += int(bytes) except IOError as e: - sys.stderr.write(e) + sys.stderr.write(str(e)) for username, opts in users.items(): __, object_id, size = opts diff --git a/orchestra/contrib/vps/backends.py b/orchestra/contrib/vps/backends.py index 3d4948e6..2ead22c3 100644 --- a/orchestra/contrib/vps/backends.py +++ b/orchestra/contrib/vps/backends.py @@ -90,15 +90,15 @@ class ProxmoxOVZ(ServiceController): return context -# TODO rename to proxmox -class OpenVZTraffic(ServiceMonitor): +class ProxmoxOpenVZTraffic(ServiceMonitor): model = 'vps.VPS' resource = ServiceMonitor.TRAFFIC monthly_sum_old_values = True - + GET_PROXMOX_INFO = ProxmoxOVZ.GET_PROXMOX_INFO + def prepare(self): - super(OpenVZTraffic, self).prepare() - self.append(ProxmoxOVZ.GET_PROXMOX_INFO) + super(ProxmoxOpenVZTraffic, self).prepare() + self.append(self.GET_PROXMOX_INFO) self.append(textwrap.dedent(""" function monitor () { object_id=$1 @@ -116,7 +116,7 @@ class OpenVZTraffic(ServiceMonitor): def process(self, line): """ diff with last stored state """ - object_id, value, state = super(OpenVZTraffic, self).process(line) + object_id, value, state = super(ProxmoxOpenVZTraffic, self).process(line) value = decimal.Decimal(value) last = self.get_last_data(object_id) if not last or last.state > value: