def main(): config = load_config(SERVER_CONFIG_PATH) local_host = config.get("server_ip") #local_host = get_ip_address(config.get("local_interface")) rpc_port = config.get("rpc_port") rpc_server = ThreadingXMLRPCServer((local_host, rpc_port), logRequests=False) #rpc_server.register_function(sign_in) #rpc_server.register_function(howru) rpc_server.register_instance(MonServer()) threadinglize(rpc_server.serve_forever, "rpc_server")() logger.info("start RPC server on %s:%d" % (local_host, rpc_port)) rrd_root = config.get("RRD_root", "/dev/shm") rrd_handler = RRDHandler.getInstance(rrd_root) ds_port = config.get("ds_port") data_server = DataReciever((local_host, ds_port), rrd_handler) threadinglize(data_server.serve_forever, "data_server")() logger.info("start data server on %s:%d" % (local_host, ds_port)) #model_int = Interface() agent_timeout = config.get("agent_timeout") check_alive_interval = config.get("check_alive_interval") scheduled_task(check_alive, "check_alive", True, 0, -1, check_alive_interval)(agent_timeout) logger.info("check_alive started...") while True: myprint(threading.enumerate()) sleep(60)
from utils4test import * from ThreadingXMLRPCServer import ThreadingXMLRPCServer from test_xmlrpcfuncs import * pub_addr = '211.69.198.162' pri_addr = '192.168.226.62' localhost = '127.0.0.1' port = 20060 server = ThreadingXMLRPCServer((localhost, 20060)) server.register_function(echo) ins = MyCal() server.register_instance(ins) server.serve_forever()