pcp
[Top] [All Lists]

pmrep: finalize zabbix transfers in all cases

To: pcp developers <pcp@xxxxxxxxxxx>
Subject: pmrep: finalize zabbix transfers in all cases
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Wed, 17 Feb 2016 14:32:01 +0200
Delivered-to: pcp@xxxxxxxxxxx
Organization: Red Hat
Reply-to: Marko Myllynen <myllynen@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0
This is needed / useful if the user hits Ctrl+C, completely
harmless / no-op otherwise (and if the Zabbix transfer interval
is more than sampling interval, without this they'd be notable
loss of collected data after Ctrl+C).

---
 src/pmrep/pmrep.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/pmrep/pmrep.py b/src/pmrep/pmrep.py
index 73c4a61..ea41296 100755
--- a/src/pmrep/pmrep.py
+++ b/src/pmrep/pmrep.py
@@ -1355,6 +1355,9 @@ class PMReporter(object):
         if self.pmi:
             self.pmi.pmiEnd()
             self.pmi = None
+        if self.zabbix_metrics:
+            send_to_zabbix(self.zabbix_metrics, self.zabbix_server, 
self.zabbix_port)
+            self.zabbix_metrics = []
 
 if __name__ == '__main__':
     try:

Thanks,

-- 
Marko Myllynen

<Prev in Thread] Current Thread [Next in Thread>
  • pmrep: finalize zabbix transfers in all cases, Marko Myllynen <=