@cryptotaxi247 / netdata-1 / commits / 88d191cf3

add heartbeat (#5503)

Ilya Mashchenko committed Feb 26, 2019 at 10:54 UTC 88d191cf32f8bdcbb40e370325b3e6f3d9971c31
1 file changed +8 -2
collectors/python.d.plugin/python.d.plugin.in
+8 -2
@@ -14,7 +14,7 @@ import sys
14 import threading
15
16 from re import sub
17 -from sys import version_info, argv
17 +from sys import version_info, argv, stdout
18 from time import sleep
19
20 GC_RUN = True
@@ -40,13 +40,15 @@ sys.path.append(PYTHON_MODULES_DIR)
40
41 from bases.loaders import ModuleAndConfigLoader # noqa: E402
42 from bases.loggers import PythonDLogger # noqa: E402
43 -from bases.collection import setdefault_values, run_and_exit # noqa: E402
43 +from bases.collection import setdefault_values, run_and_exit, safe_print # noqa: E402
44
45 try:
46 from collections import OrderedDict
47 except ImportError:
48 from third_party.ordereddict import OrderedDict
49
50 +IS_ATTY = stdout.isatty()
51 +
52 BASE_CONFIG = {'update_every': os.getenv('NETDATA_UPDATE_EVERY', 1),
53 'priority': 60000,
54 'autodetection_retry': 0,
@@ -394,6 +396,10 @@ class Plugin(object):
396 v = gc.collect()
397 Logger.debug("GC full collection run result: {0}".format(v))
398
399 + # for exiting on SIGPIPE
400 + if not IS_ATTY:
401 + safe_print('\n')
402 +
403 def cleanup(self):
404 for job in self.dead_jobs:
405 self.delete_job(job)