def _initialize(self):
        """Performs monitor-specific initialization.
        """
        global httpSourceAddress

        # Useful instance variables:
        #   _sample_interval_secs:  The number of seconds between calls to gather_sample.
        #   _config:  The dict containing the configuration for this monitor instance as retrieved from configuration
        #             file.
        #   _logger:  The logger instance to report errors/warnings/etc.
        
        # determine how we are going to connect
        self._monitor_url = None
        self._monitor_user = None
        self._monitor_password = None
        if "monitor_url" in self._config:
            self._monitor_url = self._config["monitor_url"]
        if "monitor_user" in self._config:
            self._monitor_user = self._config["monitor_user"]
        if "monitor_password" in self._config:
            self._monitor_password = self._config["monitor_password"]
        self._sourceaddress = self._config.get('source_addresss',
                                               default=httpSourceAddress)
        httpSourceAddress = self._sourceaddress            
        
        if "monitor_url" not in self._config:
            raise Exception("monitor_url must be specified in the configuration.")
        credentials_needed = False
        if "monitor_password" in self._config and "monitor_user" not in self._config:
            credentials_needed = True
        elif "monitor_password" not in self._config and "monitor_user" in self._config:
            credentials_needed = True
        if credentials_needed:                             
            raise Exception("if monitor_user or monitor_password specified, both must be specified")
dataset/ETHPy150Open scalyr/scalyr-agent-2/scalyr_agent/builtin_monitors/tomcat_monitor.py/TomcatMonitor._initialize/original