예제 #1
0
파일: mon.py 프로젝트: fhtxl/monasca-agent
 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 ['storm.daemon.nimbus', 'storm.daemon.supervisor', 'storm.daemon.worker']:
         if find_process_cmdline(process) is not None:
             config.merge(watch_process([process], 'monitoring', 'apache-storm', exact_match=False, detailed=False))
     config.merge(watch_process_by_username('storm', 'monasca-thresh', 'monitoring', 'apache-storm'))
     return config
예제 #2
0
    def build_config(self):
        kibana_config = self._get_config_file()

        try:
            (kibana_host, kibana_port,
             kibana_protocol) = self._read_config(kibana_config)
        except Exception as ex:
            LOG.error('Failed to read configuration at %s' % kibana_config)
            LOG.exception(ex)
            return

        if kibana_protocol == 'https':
            LOG.error('"https" protocol is currently not supported')
            return None

        config = agent_config.Plugins()

        # retrieve user name and set in config
        # if passed in args (note args are optional)
        if (self.args and 'kibana-user' in self.args
                and self.args['kibana-user']):
            process = detection.watch_process_by_username(
                username=self.args['kibana-user'],
                process_name='kibana',
                service='monitoring',
                component='kibana')
        else:
            process = detection.watch_process(['kibana'],
                                              service='monitoring',
                                              component='kibana',
                                              process_name='kibana')

        config.merge(process)

        kibana_url = '%s://%s:%d' % (kibana_protocol, kibana_host, kibana_port)

        if not self._has_metrics_support(kibana_url):
            LOG.warning('Running kibana does not support metrics, skipping...')
            return None
        else:
            metrics = self._get_all_metrics(kibana_url)
            config['kibana'] = {
                'init_config': {
                    'url': '%s/%s' % (kibana_url, _API_STATUS),
                },
                'instances': [{
                    "name": kibana_url,
                    'metrics': metrics
                }]
            }

        LOG.info('\tWatching the kibana process.')

        return config
예제 #3
0
 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 [
             'storm.daemon.nimbus', 'storm.daemon.supervisor',
             'storm.daemon.worker'
     ]:
         if find_process_cmdline(process) is not None:
             config.merge(
                 watch_process([process],
                               'monitoring',
                               'apache-storm',
                               exact_match=False,
                               detailed=False))
     config.merge(
         watch_process_by_username('storm', 'monasca-thresh', 'monitoring',
                                   'apache-storm'))
     return config
예제 #4
0
파일: mon.py 프로젝트: fhtxl/monasca-agent
 def build_config(self):
     """Build the config as a Plugins object and return."""
     log.info("\tEnabling the Monasca Agent process check")
     return watch_process_by_username('mon-agent', 'monasca-agent', 'monitoring',
                                      'monasca-agent')
예제 #5
0
파일: mon.py 프로젝트: fhtxl/monasca-agent
 def build_config(self):
     """Build the config as a Plugins object and return."""
     log.info("\tEnabling the Monasca Notification healthcheck")
     return watch_process_by_username('mon-notification', 'monasca-notification', 'monitoring',
                                      'monasca-notification')
예제 #6
0
    def build_config(self):
        kibana_config = self._get_config_file()

        try:
            (kibana_host,
             kibana_port,
             kibana_protocol) = self._read_config(kibana_config)
        except Exception as ex:
            LOG.error('Failed to read configuration at %s' % kibana_config)
            LOG.exception(ex)
            return

        if kibana_protocol == 'https':
            LOG.error('"https" protocol is currently not supported')
            return None

        config = agent_config.Plugins()

        # retrieve user name and set in config
        # if passed in args (note args are optional)
        if (self.args and 'kibana-user' in self.args and
                self.args['kibana-user']):
            process = detection.watch_process_by_username(
                username=self.args['kibana-user'],
                process_name='kibana',
                service='monitoring',
                component='kibana'
            )
        else:
            process = detection.watch_process(['kibana'],
                                              service='monitoring',
                                              component='kibana',
                                              process_name='kibana')

        config.merge(process)

        kibana_url = '%s://%s:%d' % (
            kibana_protocol,
            kibana_host,
            kibana_port
        )

        if not self._has_metrics_support(kibana_url):
            LOG.warning('Running kibana does not support metrics, skipping...')
            return None
        else:
            metrics = self._get_all_metrics(kibana_url)
            config['kibana'] = {
                'init_config': {
                    'url': '%s/%s' % (kibana_url, _API_STATUS),
                },
                'instances': [
                    {
                        "name": kibana_url,
                        'metrics': metrics
                    }
                ]
            }

        LOG.info('\tWatching the kibana process.')

        return config
예제 #7
0
 def build_config(self):
     """Build the config as a Plugins object and return."""
     log.info("\tEnabling the Monasca Agent process check")
     return watch_process_by_username('mon-agent', 'monasca-agent',
                                      'monitoring', 'monasca-agent')
예제 #8
0
 def build_config(self):
     """Build the config as a Plugins object and return."""
     log.info("\tEnabling the Monasca Notification healthcheck")
     return watch_process_by_username('mon-notification',
                                      'monasca-notification', 'monitoring',
                                      'monasca-notification')