Example #1
0
 def __init__(self, performance_test: int, concurrency_test: int, configuration: Dict, cluster_items: Dict,
              enable_ssl: bool, logger: logging.Logger = None, tag: str = "Abstract Server"):
     """
     Class constructor
     :param performance_test: Message length to use in the performance test
     :param concurrency_test: Number of requests to do in the concurrency test
     :param configuration: ossec.conf cluster configuration
     :param cluster_items: cluster.json cluster internal configuration
     :param enable_ssl: Whether to enable asyncio's SSL support
     :param logger: Logger to use
     :param tag: Log tag
     """
     self.clients = {}
     self.performance = performance_test
     self.concurrency = concurrency_test
     self.configuration = configuration
     self.cluster_items = cluster_items
     self.enable_ssl = enable_ssl
     self.tag = tag
     self.logger = logging.getLogger('wazuh') if not logger else logger
     # logging tag
     context_tag.set(self.tag)
     context_subtag.set("Main")
     self.tasks = [self.check_clients_keepalive]
     self.handler_class = AbstractServerHandler
     self.loop = asyncio.get_running_loop()
Example #2
0
    def __init__(self,
                 configuration: Dict,
                 cluster_items: Dict,
                 enable_ssl: bool,
                 performance_test: int,
                 concurrency_test: int,
                 file: str,
                 string: int,
                 logger: logging.Logger = None,
                 tag: str = "Client Manager"):
        """Class constructor.

        Parameters
        ----------
        configuration : dict
            Client configuration.
        cluster_items : dict
            Cluster.json object containing cluster internal variables.
        enable_ssl : bool
            Whether to use SSL encryption or not.
        performance_test : int
            Value for the performance test function.
        concurrency_test : int
            Value for the concurrency test function.
        file : str
            File path for the send_file test function.
        string : int
            String size for the send_string test function.
        logger : Logger object
            Logger to use.
        tag : str
            Log tag.
        """
        self.name = configuration['node_name']
        self.configuration = configuration
        self.cluster_items = cluster_items
        self.ssl = enable_ssl
        self.performance_test = performance_test
        self.concurrency_test = concurrency_test
        self.file = file
        self.string = string
        self.logger = logging.getLogger('wazuh') if not logger else logger
        self.tag = tag
        # Modify filter tags with context vars.
        context_tag.set(self.tag)
        context_subtag.set("Main")
        self.tasks = []
        self.handler_class = AbstractClient
        self.client = None
        self.extra_args = {}
        self.loop = asyncio.get_running_loop()
Example #3
0
    def __init__(self,
                 configuration: Dict,
                 cluster_items: Dict,
                 enable_ssl: bool,
                 performance_test: int,
                 concurrency_test: int,
                 file: str,
                 string: int,
                 logger: logging.Logger = None,
                 tag: str = "Client Manager"):
        """
        Class constructor

        :param configuration: client configuration
        :param enable_ssl: Whether to use SSL encryption or not
        :param performance_test: Value for the performance test function
        :param concurrency_test: Value for the concurrency test function
        :param file: File path for the send file test function
        :param string: String size for the send string test function
        """
        self.name = configuration['node_name']
        self.configuration = configuration
        self.cluster_items = cluster_items
        self.ssl = enable_ssl
        self.performance_test = performance_test
        self.concurrency_test = concurrency_test
        self.file = file
        self.string = string
        self.logger = logging.getLogger('wazuh') if not logger else logger
        # logging tag
        self.tag = tag
        # modify filter tags with context vars
        context_tag.set(self.tag)
        context_subtag.set("Main")
        self.tasks = []
        self.handler_class = AbstractClient
        self.client = None
        self.extra_args = {}
        self.loop = asyncio.get_running_loop()