def build_config(self): """Build the config as a Plugins object and return.""" log.info("\tEnabling the Monasca Notification healthcheck") notification_process = find_process_cmdline('monasca-notification') notification_user = notification_process.as_dict(['username'])['username'] return watch_process_by_username(notification_user, 'monasca-notification', 'monitoring', 'monasca-notification')
def _detect(self): """Detects if monasca-persister runs in the system Method distinguishes between Java and Python implementation hence provides different agent's configuration. """ p_process = find_process_cmdline('monasca-persister') process_found = p_process is not None if process_found: impl_lang = _get_impl_lang(p_process) impl_helper = self._init_impl_helper( p_process.as_dict(['cmdline'])['cmdline'], impl_lang ) if impl_helper is not None: impl_helper.load_configuration() self._impl_helper = impl_helper self.available = True log.info('\tmonasca-persister implementation is %s', impl_lang) else: log.info('monasca-persister process has not been found. %s' % self.PARTIAL_ERR_MSG)
def _detect(self): """Run detection, set self.available True if the service is detected.""" process_exists = find_process_cmdline('kafka') is not None has_dependencies = self.dependencies_installed() self._consumer_group_shell_exists = os.path.isfile( _KAFKA_CONSUMER_GROUP_COMMAND) self._zookeeper_shell_exists = os.path.isfile( _KAFKA_ZOOKEEPER_SHELL_COMMAND) kafka_has_scripts = (self._consumer_group_shell_exists or self._zookeeper_shell_exists) self.available = (process_exists and has_dependencies and kafka_has_scripts) if not self.available: if not process_exists: log.error('Kafka process does not exist.') elif not has_dependencies: log.error(('Kafka process exists but required ' 'dependency kafka-python is ' 'not installed.')) elif not kafka_has_scripts: log.error(('Kafka process exists, dependencies are installed ' 'but neither %s nor %s ' 'executable was found.'), _KAFKA_CONSUMER_GROUP_COMMAND, _KAFKA_CONSUMER_GROUP_COMMAND)
def _detect(self): """Run detection, set self.available True if the service is detected.""" process_exists = find_process_cmdline('kafka') is not None has_dependencies = self.dependencies_installed() (self._kafka_consumer_bin, self._zookeeper_consumer_bin) = self._find_topic_listing_binaries() kafka_has_scripts = (self._kafka_consumer_bin or self._zookeeper_consumer_bin) self.available = (process_exists and has_dependencies and kafka_has_scripts) if not self.available: if not process_exists: log.error('Kafka process does not exist.') elif not has_dependencies: log.error(('Kafka process exists but required ' 'dependency monasca-common is ' 'not installed.\n\t' 'Please install with: ' 'pip install monasca-agent[kafka_plugin]')) elif not kafka_has_scripts: log.error(('Kafka process exists, dependencies are installed ' 'but neither %s nor %s ' 'executable was found.'), _KAFKA_CONSUMER_GROUP_BIN, _KAFKA_ZOOKEEPER_SHELL_BIN)
def _detect(self): """Detects if monasca-persister runs in the system Method distinguishes between Java and Python implementation hence provides different agent's configuration. """ p_process = find_process_cmdline('monasca-persister') process_found = p_process is not None if process_found: impl_lang = _get_impl_lang(p_process) impl_helper = self._init_impl_helper(impl_lang) if impl_helper is not None: impl_helper.load_configuration() self._impl_helper = impl_helper self.available = True log.info('\tmonasca-persister implementation is %s', impl_lang) else: log.error('monasca-persister process has not been found. %s' % self.PARTIAL_ERR_MSG)
def _detect(self): """Run detection, set self.available True if the service is detected.""" process_exists = find_process_cmdline('kafka') is not None has_dependencies = self.dependencies_installed() (self._kafka_consumer_bin, self._zookeeper_consumer_bin) = self._find_topic_listing_binaries() kafka_has_scripts = (self._kafka_consumer_bin or self._zookeeper_consumer_bin) self.available = (process_exists and has_dependencies and kafka_has_scripts) if not self.available: if not process_exists: log.error('Kafka process does not exist.') elif not has_dependencies: log.error(('Kafka process exists but required ' 'dependency kafka-python is ' 'not installed.')) elif not kafka_has_scripts: log.error(('Kafka process exists, dependencies are installed ' 'but neither %s nor %s ' 'executable was found.'), _KAFKA_CONSUMER_GROUP_BIN, _KAFKA_ZOOKEEPER_SHELL_BIN)
def build_config(self): """Build the config as a Plugins object and return.""" log.info("\tWatching the mon-thresh process.") config = monasca_setup.agent_config.Plugins() for process in ['backtype.storm.daemon.nimbus', 'backtype.storm.daemon.supervisor', 'backtype.storm.daemon.worker']: if find_process_cmdline(process) is not None: config.merge(watch_process([process], 'monitoring', 'apache-storm', exact_match=False)) return config
def _detect(self): """Run detection, set self.available True if the service is detected.""" self.available = True agent_process_list = ['monasca-collector', 'monasca-forwarder', 'monasca-statsd'] for process in agent_process_list: if find_process_cmdline(process) is None: self.available = False return
def build_config(self): """Build the config as a Plugins object and return.""" log.info("\tWatching the mon-thresh process.") config = monasca_setup.agent_config.Plugins() for process in ['backtype.storm.daemon.nimbus', 'backtype.storm.daemon.supervisor', 'backtype.storm.daemon.worker']: if find_process_cmdline(process) is not None: config.merge(watch_process([process], 'monitoring', 'storm', exact_match=False)) return config
def _detect(self): """Run detection. """ self.found_processes = [] for process in self.process_names: if find_process_cmdline(process) is not None: self.found_processes.append(process) if len(self.found_processes) > 0: self.available = True
def _detect(self): """Detects if monasca-api runs in the system Method distinguishes between Java and Python implementation hence provides different agent's configuration. """ def check_port(): for conn in api_process.connections('inet'): if conn.laddr[1] == api_port: return True return False api_process = find_process_cmdline('monasca-api') process_found = api_process is not None if process_found: impl_lang = _get_impl_lang(api_process) impl_helper = self._init_impl_helper(impl_lang) impl_helper.load_configuration() api_port = impl_helper.get_bound_port() port_taken = check_port() if not port_taken: log.error('monasca-api is not listening on port %d. %s' % (api_port, self.PARTIAL_ERR_MSG)) return log.info('\tmonasca-api implementation is %s', impl_lang) self.available = port_taken self._impl_helper = impl_helper else: log.error('monasca-api process has not been found. %s' % self.PARTIAL_ERR_MSG)
def _detect(self): """Run detection, set self.available True if the service is detected.""" if find_process_cmdline("kafka") is not None: self.available = True
def _detect(self): """Run detection, set self.available True if the service is detected.""" if find_process_cmdline('backtype.storm.daemon') is not None: self.available = True
def _detect(self): """Run detection, set self.available True if the service is detected.""" if find_process_cmdline('monasca-persister') is not None: self.available = True
def _detect(self): """Detects if monasca-api runs in the system Method distinguishes between Java and Python implementation hence provides different agent's configuration. """ def check_port(): for conn in api_process.connections('inet'): if conn.laddr[1] == api_port: return True return False def correct_apache_listener(process): """Sets api_process to the parent httpd process. Method evaluates if process executable is correlated with apache-mod_wsgi. If so, retrieves parent process. Otherwise returns None :param process: current process :type process: psutil.Process :returns: parent process or None :rtype: (psutil.Process, None) """ p_exe = process.as_dict()['exe'] for m in _APACHE_MARKERS: if m in p_exe: return process.parent() return None api_process = find_process_cmdline('monasca-api') process_found = api_process is not None if process_found: impl_lang = _get_impl_lang(api_process) if impl_lang == 'python': apache_process = correct_apache_listener(api_process) if apache_process: log.info('\tmonasca-api runs under Apache WSGI') api_process = apache_process impl_helper = self._init_impl_helper(impl_lang) impl_helper.load_configuration() api_port = impl_helper.get_bound_port() port_taken = check_port() if not port_taken: log.error('monasca-api is not listening on port %d. %s' % (api_port, self.PARTIAL_ERR_MSG)) return log.info('\tmonasca-api implementation is %s', impl_lang) self.available = port_taken self._impl_helper = impl_helper else: log.error('monasca-api process has not been found. %s' % self.PARTIAL_ERR_MSG)
def _detect(self): """Run detection, set self.available True if the service is detected.""" # The node will be running either nimbus or supervisor or both self.available = ( find_process_cmdline('storm.daemon.nimbus') is not None or find_process_cmdline('storm.daemon.supervisor') is not None)
def _detect(self): """Run detection, set self.available True if the service is detected.""" if find_process_cmdline('monasca-notification') is not None: self.available = True
def _detect(self): """Run detection, set self.available True if the service is detected.""" # The node will be running either nimbus or supervisor or both self.available = (find_process_cmdline('storm.daemon.nimbus') is not None or find_process_cmdline('storm.daemon.supervisor') is not None)
def _detect(self): """Detects if monasca-api runs in the system Method distinguishes between Java and Python implementation hence provides different agent's configuration. """ def check_port(): for conn in api_process.connections('inet'): if conn.laddr[1] == api_port: return True return False def correct_apache_listener(process): """Sets api_process to the parent httpd process. Method evaluates if process executable is correlated with apache-mod_wsgi. If so, retrieves parent process. Otherwise returns None :param process: current process :type process: psutil.Process :returns: parent process or None :rtype: (psutil.Process, None) """ p_exe = process.as_dict(['exe'])['exe'] for m in _APACHE_MARKERS: if m in p_exe: return process.parent() return None api_process = find_process_cmdline('monasca-api') process_found = api_process is not None if process_found: impl_lang = _get_impl_lang(api_process) if impl_lang == 'python': apache_process = correct_apache_listener(api_process) if apache_process: log.info('\tmonasca-api runs under Apache WSGI') api_process = apache_process impl_helper = self._init_impl_helper(api_process.as_dict(['cmdline'])['cmdline'], impl_lang) impl_helper.load_configuration() api_port = impl_helper.get_bound_port() port_taken = check_port() if not port_taken: log.error('monasca-api is not listening on port %d. %s' % (api_port, self.PARTIAL_ERR_MSG)) return log.info('\tmonasca-api implementation is %s', impl_lang) self.available = port_taken self._impl_helper = impl_helper else: log.warning('monasca-api process has not been found. %s' % self.PARTIAL_ERR_MSG)