コード例 #1
0
ファイル: vertica.py プロジェクト: vinaykns/monasca-agent
    def _detect(self):
        """Run detection, set self.available True if the service is detected.

        """
        if (find_process_name('vertica') is not None and find_process_name(
                'spread') is not None):
            self.available = True
コード例 #2
0
ファイル: influxdb.py プロジェクト: openstack/monasca-agent
    def _detect(self):
        """Run detection, set self.available True if the service is detected.
        """

        proc = utils.find_process_name(self.PROC_NAME)
        process_found = proc is not None

        config_file = self._get_config_file(proc) if process_found else None
        config_file_found = config_file is not None

        dependencies_installed = self.dependencies_installed()

        self.available = (process_found and config_file_found
                          and dependencies_installed)

        if not self.available:
            err_chunks = []
            if not process_found:
                err_chunks.append('\tinfluxdb plugin cannot locate '
                                  '"%s" process.' % self.PROC_NAME)
            elif not config_file_found:
                err_chunks.append('\tinfluxdb plugin cannot locate '
                                  'configuration file.')
            elif not dependencies_installed:
                err_chunks.append('\tinfluxdb plugin requires "toml" '
                                  'to be installed')
            LOG.error('Plugin for InfluxDB will not be configured.\n'
                      'Following issue have to be resolved: %s' %
                      '\n'.join(err_chunks))
        else:
            self._config = self._load_config(config_file)
コード例 #3
0
    def _detect(self):
        """Run detection, set self.available True if the service is detected.
        """

        proc = utils.find_process_name(self.PROC_NAME)
        process_found = proc is not None

        config_file = self._get_config_file(proc) if process_found else None
        config_file_found = config_file is not None

        dependencies_installed = self.dependencies_installed()

        self.available = (process_found and config_file_found
                          and dependencies_installed)

        if not self.available:
            err_chunks = []
            if not process_found:
                err_chunks.append('\tinfluxdb-relay plugin cannot locate '
                                  '"%s" process.' % self.PROC_NAME)
            elif not config_file_found:
                err_chunks.append('\tinfluxdb-relay plugin cannot locate '
                                  'configuration file.')
            elif not dependencies_installed:
                err_chunks.append('\tinfluxdb-relay plugin requires "toml" '
                                  'to be installed')
            LOG.error('Plugin for influxdb-relay will not be configured.\n'
                      'Following issue have to be resolved: %s' %
                      '\n'.join(err_chunks))
        else:
            self._config = self._load_config(config_file)
コード例 #4
0
ファイル: mysql.py プロジェクト: remeq/monasca-agent
    def _detect(self):
        """Run detection, set self.available True if the service is detected.

        """
        process_exist = find_process_name('mysqld') is not None
        has_dependencies = self.dependencies_installed()
        has_args_or_config_file = (self.args is not None
                                   or os.path.isfile(mysql_conf))
        self.available = (process_exist and has_args_or_config_file
                          and has_dependencies)
        if not self.available:
            if not process_exist:
                log.error('MySQL process does not exist.')
            elif not has_args_or_config_file:
                log.error(('MySQL process exists but '
                           'configuration file was not found and '
                           'no arguments were given.'))
            elif not has_dependencies:
                log.error(('MySQL process exists but required dependence '
                           'PyMySQL is not installed.'))
コード例 #5
0
ファイル: mysql.py プロジェクト: openstack/monasca-agent
    def _detect(self):
        """Run detection, set self.available True if the service is detected.

        """
        process_exist = find_process_name('mysqld') is not None
        has_dependencies = self.dependencies_installed()
        has_args_or_config_file = (self.args is not None or
                                   os.path.isfile(mysql_conf))
        self.available = (process_exist and has_args_or_config_file and
                          has_dependencies)
        if not self.available:
            if not process_exist:
                log.info('MySQL process does not exist.')
            elif not has_args_or_config_file:
                log.warning(('MySQL process exists but '
                             'configuration file was not found and '
                             'no arguments were given.'))
            elif not has_dependencies:
                log.error(('MySQL process exists but required dependence '
                           'PyMySQL is not installed.'))
コード例 #6
0
ファイル: vcenter.py プロジェクト: RichardHCL/monasca-agent
 def _detect(self):
     """Method to detect the nova-compute service,
     if found set the nova.conf, the flags under vmware section will be used to
     configure the plugin, else the args are used to configure.
     """
     # Find the nova compute process and locate its conf
     process_exist = find_process_name('nova-compute') is not None
     # for cases where this plugin and nova-compute service runs separately
     # we will configure the plugin with given args.
     # so, we have to set these below variables
     self.nova_conf = self.get_nova_config_file() if process_exist else None
     has_config_file_or_args = (self.nova_conf is not None
                                or self.args is not None)
     self.available = process_exist and has_config_file_or_args
     if not self.available:
         if not process_exist:
             log.error('Nova-compute process does not exist.')
         elif not has_config_file_or_args:
             log.error(('Nova-compute process exists but '
                        'the configuration file was not detected and no '
                        'arguments were given.'))
コード例 #7
0
ファイル: vcenter.py プロジェクト: jobrs/monasca-agent
 def _detect(self):
     """Method to detect the nova-compute service,
     if found set the nova.conf, the flags under vmware section will be used to
     configure the plugin, else the args are used to configure.
     """
     # Find the nova compute process and locate its conf
     process_exist = find_process_name('nova-compute') is not None
     # for cases where this plugin and nova-compute service runs separately
     # we will configure the plugin with given args.
     # so, we have to set these below variables
     self.nova_conf = self.get_nova_config_file() if process_exist else None
     has_config_file_or_args = (self.nova_conf is not None or
                                self.args is not None)
     self.available = process_exist and has_config_file_or_args
     if not self.available:
         if not process_exist:
             log.error('Nova-compute process does not exist.')
         elif not has_config_file_or_args:
             log.error(('Nova-compute process exists but '
                        'the configuration file was not detected and no '
                        'arguments were given.'))
コード例 #8
0
 def _get_ovs_config_file(self):
     neutron_conf = None
     if self.args:
         for arg in self.args:
             if arg == 'conf_file_path':
                 neutron_conf = self.args[arg]
     # Try to detect the location of the Neutron configuration file.
     # Walk through the list of processes, searching for 'neutron'
     # process with 'neutron.conf' inside one of the parameters.
     if not neutron_conf:
         proc = utils.find_process_name(Ovs.PROC_NAME)
         proc_dict = proc.as_dict(attrs=['cmdline'])
         cmd = proc_dict['cmdline']
         neutron_config_params = [param for param in cmd if
                                  'neutron.conf' in param]
         if neutron_config_params:
             if '=' in neutron_config_params[0]:
                 neutron_conf = neutron_config_params[0].split('=')[1]
             else:
                 neutron_conf = neutron_config_params[0]
     return neutron_conf
コード例 #9
0
ファイル: ovs.py プロジェクト: openstack/monasca-agent
 def _get_ovs_config_file(self):
     neutron_conf = None
     if self.args:
         for arg in self.args:
             if arg == 'conf_file_path':
                 neutron_conf = self.args[arg]
     # Try to detect the location of the Neutron configuration file.
     # Walk through the list of processes, searching for 'neutron'
     # process with 'neutron.conf' inside one of the parameters.
     if not neutron_conf:
         proc = utils.find_process_name(Ovs.PROC_NAME)
         proc_dict = proc.as_dict(attrs=['cmdline'])
         cmd = proc_dict['cmdline']
         neutron_config_params = [param for param in cmd if
                                  'neutron.conf' in param]
         if neutron_config_params:
             if '=' in neutron_config_params[0]:
                 neutron_conf = neutron_config_params[0].split('=')[1]
             else:
                 neutron_conf = neutron_config_params[0]
     return neutron_conf
コード例 #10
0
ファイル: libvirt.py プロジェクト: lets00/monasca-agent
    def _detect(self):
        """Set self.available True if the process and config file are detected
        """

        # NOTE(trebskit) bind each check we execute to another one
        # that way if X-one fails following won't be executed
        # and detection phase will end faster
        nova_proc = utils.find_process_name('nova-compute')
        has_deps = self.dependencies_installed() if nova_proc else None
        nova_conf = self._find_nova_conf(nova_proc) if has_deps else None
        has_cache_dir = self._has_cache_dir() if nova_conf else None
        agent_user = utils.get_agent_username() if has_cache_dir else None

        self.available = nova_conf and has_cache_dir
        if not self.available:
            if not nova_proc:
                detailed_message = '\tnova-compute process not found.'
                log.info('%s\n%s' %
                         (detailed_message, self.FAILED_DETECTION_MSG))
            elif not has_deps:
                detailed_message = ('\tRequired dependencies were not found.\n'
                                    'Run pip install monasca-agent[libvirt] '
                                    'to install all dependencies.')
                log.warning('%s\n%s' %
                            (detailed_message, self.FAILED_DETECTION_MSG))
            elif not has_cache_dir:
                detailed_message = '\tCache directory %s not found' % cache_dir
                log.warning('%s\n%s' %
                            (detailed_message, self.FAILED_DETECTION_MSG))
            elif not nova_conf:
                detailed_message = ('\tnova-compute process was found, '
                                    'but it was impossible to '
                                    'read it\'s configuration.')
                log.warning('%s\n%s' %
                            (detailed_message, self.FAILED_DETECTION_MSG))
        else:
            self.nova_conf = nova_conf
            self._agent_user = agent_user
コード例 #11
0
ファイル: mysql.py プロジェクト: heekof/monasca-agent
    def _detect(self):
        """Run detection, set self.available True if the service is detected.

        """
        if find_process_name('mysqld') is not None:
            self.available = True
コード例 #12
0
    def _detect(self):
        """Run detection, set self.available True if the service is detected.

        """
        if find_process_name('mysqld') is not None:
            self.available = True
コード例 #13
0
ファイル: libvirt.py プロジェクト: ddieterly/monasca-agent
 def _detect(self):
     """Run detection, set self.available True if the service is detected.
     """
     if (find_process_name('nova-api') is not None and
        os.path.isfile(nova_conf)):
         self.available = True