本文整理汇总了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)
示例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')
示例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)
示例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)
示例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
示例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
示例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
示例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)
示例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