当前位置: 首页>>代码示例>>Python>>正文


Python detection.find_process_cmdline函数代码示例

本文整理汇总了Python中monasca_setup.detection.find_process_cmdline函数的典型用法代码示例。如果您正苦于以下问题:Python find_process_cmdline函数的具体用法?Python find_process_cmdline怎么用?Python find_process_cmdline使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了find_process_cmdline函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _detect

    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)
开发者ID:openstack,项目名称:monasca-agent,代码行数:28,代码来源:mon.py

示例2: build_config

 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')
开发者ID:openstack,项目名称:monasca-agent,代码行数:7,代码来源:mon.py

示例3: _detect

    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)
开发者ID:sapcc,项目名称:monasca-agent,代码行数:29,代码来源:kafka_consumer.py

示例4: _detect

    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)
开发者ID:openstack,项目名称:monasca-agent,代码行数:29,代码来源:kafka_consumer.py

示例5: build_config

 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
开发者ID:angelomendonca,项目名称:monasca-agent,代码行数:8,代码来源:mon.py

示例6: _detect

 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
开发者ID:fhtxl,项目名称:monasca-agent,代码行数:8,代码来源:mon.py

示例7: _detect

    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
开发者ID:angelomendonca,项目名称:monasca-agent,代码行数:11,代码来源:service_plugin.py

示例8: _detect

    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)
开发者ID:jobrs,项目名称:monasca-agent,代码行数:38,代码来源:mon.py

示例9: _detect

 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
开发者ID:angelomendonca,项目名称:monasca-agent,代码行数:4,代码来源:mon.py


注:本文中的monasca_setup.detection.find_process_cmdline函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。