Ejemplo n.º 1
0
    def create_agents(self):
        """
        Prepares the vSphere Agents used by the vPoller Worker

        Raises:
            VPollerException

        """
        logger.debug('Creating vSphere Agents')

        db = VConnectorDatabase(self.config.get('db'))
        agents = db.get_agents(only_enabled=True)

        if not agents:
            logger.warning('No registered or enabled vSphere Agents found')
            raise VPollerException(
                'No registered or enabled vSphere Agents found')

        for agent in agents:
            a = VConnector(
                user=agent['user'],
                pwd=agent['pwd'],
                host=agent['host'],
                cache_enabled=self.config.get('cache_enabled'),
                cache_maxsize=self.config.get('cache_maxsize'),
                cache_ttl=self.config.get('cache_ttl'),
                cache_housekeeping=self.config.get('cache_housekeeping'))
            self.agents[a.host] = a
            logger.info('Created vSphere Agent for %s', agent['host'])
Ejemplo n.º 2
0
    def create_agents(self):
        """
        Prepares the vSphere Agents used by the vPoller Worker

        Raises:
            VPollerException

        """
        logger.debug('Creating vSphere Agents')

        db = VConnectorDatabase(self.config.get('db'))
        agents = db.get_agents(only_enabled=True)

        if not agents:
            logger.warning('No registered or enabled vSphere Agents found')
            raise VPollerException(
                'No registered or enabled vSphere Agents found'
            )

        for agent in agents:
            a = VConnector(
                user=agent['user'],
                pwd=agent['pwd'],
                host=agent['host'],
                cache_enabled=self.config.get('cache_enabled'),
                cache_maxsize=self.config.get('cache_maxsize'),
                cache_ttl=self.config.get('cache_ttl'),
                cache_housekeeping=self.config.get('cache_housekeeping')
            )
            self.agents[a.host] = a
            logger.info('Created vSphere Agent for %s', agent['host'])
Ejemplo n.º 3
0
    def create_agents(self):
        """
        Prepares the vSphere Agents used by the vPoller Worker

        Raises:
            VPollerException

        """
        logging.debug('Creating vSphere Agents')

        db = VConnectorDatabase(self.config.get('db'))
        agents = db.get_agents(only_enabled=True)

        if not agents:
            logging.warning('No registered or enabled vSphere Agents found')
            raise VPollerException(
                'No registered or enabled vSphere Agents found'
            )

        for agent in agents:
            a = VSphereAgent(
                user=agent['user'],
                pwd=agent['pwd'],
                host=agent['host']
            )
            self.agents[a.host] = a
Ejemplo n.º 4
0
    def spawn_vsphere_agents(self):
        """
        Prepares the vSphere Agents used by the vPoller Worker

        """
        logging.debug("Spawning vSphere Agents")

        self.agents = dict()

        db = VConnectorDatabase(self.connector_db)
        db_agents = db.get_agents(only_enabled=True)

        if not db_agents:
            logging.warning("No registered or enabled vSphere Agents found")
            raise VPollerException, "No registered or enabled vSphere Agents found"

        for each_agent in db_agents:
            agent = VSphereAgent(user=each_agent["user"], pwd=each_agent["pwd"], host=each_agent["host"])
            agent.last_keep_alive_heartbeat = time()
            self.agents[agent.host] = agent