def setup_monitoring(config): try: name = "observant-dashboard-%s" % str(config.get("dashboard", "port")) client = StatsCore.attchToStatsDaemon() client.postWatchPid(name, os.getpid()) client.close() except: logging.error("Unable to setup monitoring: [%s]" % str(sys.exc_info()))
def isDaemonRunning(config): try: lock = str(config.get('daemon', 'lock')) sock = str(config.get('daemon', 'sock')) client = StatsCore.attchToStatsDaemon(pid=lock, sock=sock) print(client.postDaemonStatusMessage()) client.close() return True except: return str(sys.exc_info()[1])
def killDaemon(config): lock = str(config.get('daemon', 'lock')) sock = str(config.get('daemon', 'sock')) client = StatsCore.attchToStatsDaemon(pid=lock, sock=sock) client.postStopDaemon() client.close()