Skip to main content

sendToCloud

A Workflow Engine function that builds a payload from a CEvent object and exports it (via REST) to a configured Moogsoft Cloud endpoint. Both the Moogsoft endpoint and payload are defined in the Moogsoft Hybrid integration (see Moogsoft Hybrid Integration Installation).

In addition, you can configure this function with a retry queue (see Retry Queues Integration)—a failed export to Moogsoft is retried based on the Retry Queue configuration. If the Retry Queue argument is omitted, no retry is attempted, and the failed export results in a lost event.

Note

If Events are being exported (in the Event Workflow Engine) then retries will not be enabled. The retry mechanism is only supported for alerts and Situations.

This function is available as a feature of the Add-ons v2.4 download and later.

This function is available for event, alert, and Situation workflows.

Back to Workflow Engine Functions Reference.

Arguments

Workflow Engine function sendToCloud takes the following arguments:

Name

Required

Type

Description

endpointName

yes

string

The name of the Moogsoft endpoint configured in the Moogsoft Hybrid integration

mapName

yes

string

The name of the payload map configured in the Moogsoft Hybrid integration

retryQueue

no

string

The name of the retry queue configured in the Retry Queues integration. If this is omitted, failed exports are not retried.

Example

The following example demonstrates typical use of Workflow Engine function sendToCloud.

Given a Moogsoft Hybrid configuration containing a Moogsoft endpoint named “Prod," a payload map named “AlertExport”, and a RetryQueue configuration with a retry queue named “AlertRetry”:

  • endpointName : Prod

  • mapName : AlertExport

  • retryQueue : AlertRetry

The UI translates your settings to the following JSON:

{"endpointName":"Prod","mapName":"AlertExport","retryQueue":"AlertRetry"}

This function returns true if the export to the Moogsoft endpoint was successful (a 20x return code), or false if the export failed for any reason (a non-20x code).

The retry mechanism (if enabled) does not take account of the error status; for example, an export that fails due to an invalid apiKey will still be retried to the retry limit configured for the specified retry queue.

Selecting the "send heartbeat" checkbox in the Moogsoft Hybrid Endpoint configuration allows heartbeat events to be generated from Moogsoft Onprem/Hosted to Moogsoft in the integration. A synthetic event is generated every 60 seconds.

Using the generic workflow functions

The Moogsoft Hybrid integration and sendToCloud function perform the same actions as a set of generic WFE functions but as a convenient, single integration and function. If the functionality of these does not meet a requirement (for example, if complex payload manipulation is required before dispatch), then the same behavior can be achieved using the following steps:

  1. Define your target Moogsoft system in the REST Endpoints integration.

    Ensure the apiKey is added as an additional header.

  2. Define you event payload in the Payloads integration.

    Ensure that the core fields are mapped appropriately and any additional fields are of the correct type (specifically tags and location).

  3. Define Retry Queue for retries to be attempted (recommended)

  4. Create an Export workflow:

    1. Use a getPayload function referencing the Payload configuration

    2. Use the convertCustomInfoToTags function if required.

    3. Use the copyToPayload function to copy the flattened tags from the workflowContext to the outbound payload.

    4. Use the exportViaRestWithRetry function referencing the REST endpoint configuration and Retry Queue configuration.