Beispiel #1
0
 def execute(self):
     """
     desc: 主程序
     """
     host = Util.get_host()
     port = Util.get_conf()[0]
     self.logger.info("host is: %s" % host)
     return self.get_return({"online": 1, "host": host, "port": port})
Beispiel #2
0
def notify_agent():
    """
    desc: 启动时,告知agent的ip:port
    """
    host = Util.get_host()
    port = Util.get_conf()[0]
    notify_url = Util.get_conf()[1]
    payload = {
        "machine_ip": host,
        "machine_port": port,
    }
    print payload
    requests.post(notify_url, params=payload)