Example #1
0
    def __init__(self, config_parser):
        self.logger = create_logger(__name__)
        self.state = 'INIT'

        service_type = config_parser.get('agent', 'TYPE')
        user_id = config_parser.get('agent', 'USER_ID')
        service_id = config_parser.get('agent', 'SERVICE_ID')

        self.logger.info("'%s' agent started (uid=%s, sid=%s)" %
                         (service_type, user_id, service_id))

        # IPOP setup
        ipop.configure_conpaas_node(config_parser)

        # Ganglia setup
        self.ganglia = AgentGanglia(config_parser)

        try:
            self.ganglia.configure()
        except Exception, err:
            self.logger.exception('Error configuring Ganglia: %s' % err)
            # Something went wrong while configuring Ganglia. We do not want
            # our agent to think it can be used
            self.ganglia = None
            return
Example #2
0
    def __init__(self, config_parser):
        ConpaasRequestHandlerComponent.__init__(self)
        self.logger = create_logger(__name__)

        service_type = config_parser.get("agent", "TYPE")
        user_id = config_parser.get("agent", "USER_ID")
        service_id = config_parser.get("agent", "SERVICE_ID")

        self.LOG_FILE = config_parser.get("agent", "LOG_FILE")
        self.ROOT_DIR = "/root"

        self.logger.info("'%s' agent started (uid=%s, sid=%s)" % (service_type, user_id, service_id))

        # IPOP setup
        ipop.configure_conpaas_node(config_parser)

        # Ganglia setup
        self.ganglia = AgentGanglia(config_parser)

        try:
            self.ganglia.configure()
        except Exception, err:
            self.logger.exception("Error configuring Ganglia: %s" % err)
            # Something went wrong while configuring Ganglia. We do not want
            # our agent to think it can be used
            self.ganglia = None
            return
Example #3
0
    def __init__(self, config_parser):
        self.logger = create_logger(__name__)    
        self.state = 'INIT'

        service_type = config_parser.get('agent', 'TYPE')
        user_id      = config_parser.get('agent', 'USER_ID')
        service_id   = config_parser.get('agent', 'SERVICE_ID')

        self.logger.info("'%s' agent started (uid=%s, sid=%s)" % (
            service_type, user_id, service_id))

        # IPOP setup
        ipop.configure_conpaas_node(config_parser)
    
        # Ganglia setup
        self.ganglia = AgentGanglia(config_parser)

        try:
            self.ganglia.configure()
        except Exception, err:
            self.logger.exception('Error configuring Ganglia: %s' % err)
            # Something went wrong while configuring Ganglia. We do not want
            # our agent to think it can be used
            self.ganglia = None
            return
Example #4
0
class BaseAgent(object):
    """Agent class with the following exposed methods:

    check_agent_process() -- GET
    """

    def __init__(self, config_parser):
        self.logger = create_logger(__name__)    
        self.state = 'INIT'

        service_type = config_parser.get('agent', 'TYPE')
        user_id      = config_parser.get('agent', 'USER_ID')
        service_id   = config_parser.get('agent', 'SERVICE_ID')

        self.logger.info("'%s' agent started (uid=%s, sid=%s)" % (
            service_type, user_id, service_id))

        # IPOP setup
        ipop.configure_conpaas_node(config_parser)
    
        # Ganglia setup
        self.ganglia = AgentGanglia(config_parser)

        try:
            self.ganglia.configure()
        except Exception, err:
            self.logger.exception('Error configuring Ganglia: %s' % err)
            # Something went wrong while configuring Ganglia. We do not want
            # our agent to think it can be used
            self.ganglia = None
            return

        err = self.ganglia.start()
        if err:
            self.logger.exception(err)
            # Same as above, our agent can not use Ganglia
            self.ganglia = None
        else:
            self.logger.info('Ganglia started successfully')
Example #5
0
class BaseAgent(object):
    """Agent class with the following exposed methods:

    check_agent_process() -- GET
    """
    def __init__(self, config_parser):
        self.logger = create_logger(__name__)
        self.state = 'INIT'

        service_type = config_parser.get('agent', 'TYPE')
        user_id = config_parser.get('agent', 'USER_ID')
        service_id = config_parser.get('agent', 'SERVICE_ID')

        self.logger.info("'%s' agent started (uid=%s, sid=%s)" %
                         (service_type, user_id, service_id))

        # IPOP setup
        ipop.configure_conpaas_node(config_parser)

        # Ganglia setup
        self.ganglia = AgentGanglia(config_parser)

        try:
            self.ganglia.configure()
        except Exception, err:
            self.logger.exception('Error configuring Ganglia: %s' % err)
            # Something went wrong while configuring Ganglia. We do not want
            # our agent to think it can be used
            self.ganglia = None
            return

        err = self.ganglia.start()
        if err:
            self.logger.exception(err)
            # Same as above, our agent can not use Ganglia
            self.ganglia = None
        else:
            self.logger.info('Ganglia started successfully')