Exemple #1
0
        fp.write(str(pid))
        fp.close()
    except Exception, e:
        msg = "Unable to write pidfile: %s" % pidfile
        log.exception(msg)
        sys.stderr.write(msg + "\n")
        sys.exit(1)


if __name__ == '__main__':
    if Platform.is_windows():
        # Let's kill any other running instance of our GUI/SystemTray before starting a new one.
        kill_old_process()

    app = QApplication([])
    if Platform.is_mac():
        add_image_path(osp.join(os.getcwd(), 'images'))
        # add datadog-agent in PATH
        os.environ['PATH'] = "{0}:{1}".format(
            '/opt/datadog-agent/bin/',
            os.environ['PATH']
        )
        win = SystemTray() if len(sys.argv) < 2 else MainWindow()
    else:
        win = MainWindow()
    # Let's start the agent if he's not already started
    if agent_status() not in [AGENT_RUNNING, AGENT_START_PENDING]:
        agent_manager('start')
    win.show()
    app.exec_()
Exemple #2
0
    except Exception as e:
        msg = "Unable to write pidfile: %s %s" % (pidfile, str(e))
        log.exception(msg)
        sys.stderr.write(msg + "\n")
        sys.exit(1)


if __name__ == '__main__':
    if Platform.is_windows():
        # Let's kill any other running instance of our GUI/SystemTray before starting a new one.
        kill_old_process()
        if len(sys.argv) > 1 and "-stop" in sys.argv:
            # just return.  The kill_old_process() should have terminated the process,
            # and now we're done.
            sys.exit(0)

    app = QApplication([])
    if Platform.is_mac():
        add_image_path(osp.join(os.getcwd(), 'images'))
        # add datadog-agent in PATH
        os.environ['PATH'] = "{0}:{1}".format('/opt/datadog-agent/bin/',
                                              os.environ['PATH'])
        win = SystemTray() if len(sys.argv) < 2 else MainWindow()
    else:
        win = MainWindow()
    # Let's start the agent if he's not already started
    if agent_status() not in [AGENT_RUNNING, AGENT_START_PENDING]:
        agent_manager('start')
    win.show()
    app.exec_()
Exemple #3
0
    # agent-manager.exe, let's save its pid
    pid = str(os.getpid())
    try:
        with open(pidfile, "w+") as fp:
            fp.write(str(pid))
    except Exception, e:
        msg = "Unable to write pidfile: %s %s" % (pidfile, str(e))
        log.exception(msg)
        sys.stderr.write(msg + "\n")
        sys.exit(1)


if __name__ == "__main__":
    if Platform.is_windows():
        # Let's kill any other running instance of our GUI/SystemTray before starting a new one.
        kill_old_process()

    app = QApplication([])
    if Platform.is_mac():
        add_image_path(osp.join(os.getcwd(), "images"))
        # add datadog-agent in PATH
        os.environ["PATH"] = "{0}:{1}".format("/opt/datadog-agent/bin/", os.environ["PATH"])
        win = SystemTray() if len(sys.argv) < 2 else MainWindow()
    else:
        win = MainWindow()
    # Let's start the agent if he's not already started
    if agent_status() not in [AGENT_RUNNING, AGENT_START_PENDING]:
        agent_manager("start")
    win.show()
    app.exec_()