def _dispatch(self, method, params): """Dispatches the XML-RPC method. """ start = time.time() if defs.LOG_SERVER_REQUESTS: try: format = "%s %s %s" args = [params[0]["auth_type"], params[0]["auth_name"], method] except (KeyError, IndexError, TypeError): format = "N/A N/A %s %s" args = [method, str(params)] apply(self.log_message, [format] + args) #handle request params = self.__convToUTF8(params) ret_val = handlers_manager.getManager().dispatch( method, params, self.client_address) #update statistics duration = time.time() - start stat_main.getStatKeeper().avg("server_avg_response_time", "server_total_requests", duration) stat_main.getStatKeeper().max("server_max_response_time", duration) if defs.LOG_SERVER_REQUESTS: apply(self.log_message, [format + " duration: %s"] + args + [duration]) return ret_val
def __init__(self): self.__pool_by_id = { } #this is reference pool. All users should be here self.__pool_len = 0 self.__black_list = [] #user_ids that we should not load self.loading_users = LoadingUser() self.rel_candidates = ReleaseCandidates() self.lock = threading.RLock() #dictionary lock stat_main.getStatKeeper().registerStat("user_pool_hits", "int") stat_main.getStatKeeper().registerStat("user_pool_misses", "int")
def getStatistics(self, request): request.needAuthType(request.ADMIN) request.getAuthNameObj().canDo("GOD") stat_dic = stat_main.getStatKeeper().getStats() sorted_dic = SortedDic(stat_dic) sorted_dic.sortByKey(False) return sorted_dic.getList()
def startServer(): stat_main.getStatKeeper().registerStat("server_avg_response_time", "seconds") stat_main.getStatKeeper().registerStat("server_max_response_time", "seconds") stat_main.getStatKeeper().registerStat("server_total_requests", "int") global server_started server_started = True thread_main.runThread(server.serve_forever, [], "server")
def __incMisses(self): stat_main.getStatKeeper().inc("user_pool_misses")
def __incHits(self): stat_main.getStatKeeper().inc("user_pool_hits")
def init(): global radius_server_started if defs.RADIUS_SERVER_ENABLED==0: return toLog("Initializing IBS Radius Server", LOG_DEBUG) stat_main.getStatKeeper().registerStat("auth_packets", "int") stat_main.getStatKeeper().registerStat("acct_packets", "int") stat_main.getStatKeeper().registerStat("auth_duplicate_packets", "int") stat_main.getStatKeeper().registerStat("acct_duplicate_packets", "int") stat_main.getStatKeeper().registerStat("auth_avg_response_time", "seconds") stat_main.getStatKeeper().registerStat("acct_avg_response_time", "seconds") stat_main.getStatKeeper().registerStat("auth_max_response_time", "seconds") stat_main.getStatKeeper().registerStat("acct_max_response_time", "seconds") global ibs_dic ibs_dic=dictionary.Dictionary("%s/radius_server/dictionary"%defs.IBS_ROOT, "%s/radius_server/dictionary.usr"%defs.IBS_ROOT, "%s/radius_server/dictionary.ser"%defs.IBS_ROOT, "%s/radius_server/dictionary.sip"%defs.IBS_ROOT) from radius_server.request_list import RequestList, CleanRequestListPeriodicEvent global request_list request_list = RequestList() periodic_events.getManager().register(CleanRequestListPeriodicEvent()) startRadiusServer() radius_server_started=True