Beispiel #1
0
    def run_operation(self, operation):
        """Executes an operation given to it by the agent core.

        Returns:

            - Nothing

        """

        logger.debug("agent-id: {0}, agent-version: {1}".format(
            settings.AgentId, settings.AgentVersion))

        if not isinstance(operation, MonitOperation):
            operation = MonitOperation(operation.raw_operation)

        if operation.type == MonitOperationValue.MonitorData:
            monit_data = self.get_monit_data()

            operation.raw_result = json.dumps(monit_data)
            operation.urn_response = MonitUrn.get_monit_data_urn()
            operation.request_method = RequestMethod.POST

        else:
            logger.warning("Unknown operation %s. Ignoring." % operation.type)

        self._send_results(operation, retry=False)
Beispiel #2
0
    def run_operation(self, operation):
        """Executes an operation given to it by the agent core.

        Returns:

            - Nothing

        """

        logger.debug("agent-id: {0}, agent-version: {1}"
                     .format(settings.AgentId, settings.AgentVersion))

        if not isinstance(operation, MonitOperation):
            operation = MonitOperation(operation.raw_operation)

        if operation.type == MonitOperationValue.MonitorData:
            monit_data = self.get_monit_data()

            operation.raw_result = json.dumps(monit_data)
            operation.urn_response = MonitUrn.get_monit_data_urn()
            operation.request_method = RequestMethod.POST

        else:
            logger.warning("Unknown operation %s. Ignoring." % operation.type)

        self._send_results(operation, retry=False)
Beispiel #3
0
    def _create_monit_operation(self):
        """A wrapper method to create a monit operation and register
        it with the core.

        Returns:

            - Nothing

        """

        if settings.AgentId:
            operation = MonitOperation()
            operation.type = MonitOperationValue.MonitorData
            self._register_operation(operation.to_json())
Beispiel #4
0
    def _create_monit_operation(self):
        """A wrapper method to create a monit operation and register
        it with the core.

        Returns:

            - Nothing

        """

        if settings.AgentId:
            operation = MonitOperation()
            operation.type = MonitOperationValue.MonitorData
            self._register_operation(operation.to_json())