Example scenario for CYOI
This example illustrates how to create a custom API using Create your own integration (CYOI) that ingests raw events from a third-party service and automatically converts the data to Moogsoft-compatible events.
You're a DevOps engineer responsible for setting up Moogsoft Cloud. Your team uses an open-source tool called MooMon to monitor your infrastructure and applications. You have MooMon set up to post API notifications whenever an event of operational significance occurs.
Compare schemas
Moogsoft Cloud uses two different schemas, one for events and one for metrics, to store and process incoming data. To ingest your data, you need to map the MooMon data fields to their equivalents in the Moogsoft Cloud events schema.
Moogsoft Cloud example event payload |
---|
{ "description": "CPU spike to 75%", "severity": 4, "source": "www.your-source.com", "check": "cpu", "service": [ "retail", "support" ], "tags": { "key": "value" } } |
You review the Moogsoft Cloud Events API.
The
description
,severity
,source
, andcheck
fields are required.The
service
field is optional but recommended.Additional fields, for example
manager
,class
, andtype
, are optional.The optional
location
field accepts a set of specified subfields as key-value pairs.You can use subfields of the optional
tags
field to map fields without equivalents in Moogsoft as key-value pairs.
You need to identify which Moogsoft Cloud fields have MooMon equivalents and which fields do not. Comparing the two schemas, you notice the following:
The
source
andservice
fields do not have MooMon equivalents. This is not a problem: you can use default values for now. Later, you can create an automated workflow to enrich the MooMon events after they get ingested.The MooMon schema includes a
metadata
field with a lot of useful information. This field doesn't have a Moogsoft Cloud equivalent. You can map this to a tag when you set up your custom integration.
Here is the mapping you develop after examining the two schemas:
Moogsoft | MooMon |
---|---|
|
|
|
|
| No equivalent. The event source is embedded in the MooMon
|
|
|
| No equivalent. The MooMon schema does not include the service associated with the event. |
|
|
|
|
|
|
Create and configure a new endpoint
You know how you want to map your MooMon fields to the Moogsoft Cloud events schema. You're now ready to create your custom integration. You log in to Moogsoft Cloud and do the following:
Choose Integrations > Ingestion Services > Create your own Integration, then click Add New Integration .
In Configuration Information, specify the following:
Moogsoft Endpoint
moomon
API Description
MooMon Events API
Data Type
Events
Click Save. The setup window for your custom integration appears.
Send your MooMon events to the new endpoint
Now you have an endpoint for your custom integration. You update your MooMon service to send data to the custom endpoint. At this point the custom endpoint can ingest any POST notification that has a valid JSON payload and the correct API key.
Map your MooMon data fields to Moogsoft Cloud
Now that you have events coming into your new endpoint, return to Moogsoft Cloud. In the Map your Data section, do the following:
Select a payload in the Payload View table. The selected payload appears in the pane to the right.
NOTE: If your payloads include multiple events in a list under a top-level object, see Use batch processing with custom integrations for data field mapping instructions.
In the Field Mapping table, map your fields as follows:
Map the MooMon fields to their Moogsoft equivalents as shown in the table above.
Keep the default value "Missing source" for the required field
source
.Enter "Missing service" as a default value for
service
.Add a new mapping row to map
trigger-location
tolocation.data_center
.Add a new mapping row, click Add Tag, and enter "metadata" to map
metadata
totags.metadata
.
Map the MooMon event severities to their Moogsoft Cloud equivalents. Click Map Values and add the severities:
You can also customize how your integration deduplicates events into alerts, but this is an advanced feature. Keep the default settings.
Click Save. The integration changes from provisioned to active status when the next event arrives.
Go to the Alerts page and verify that your MooMon events are now getting converted to alerts.
There is still one issue: the alerts all have missing source and service fields. This is not a problem, because you can configure an event workflow to do the following:
Extract the hostnames from
tags.metadata
Populate the
service
field using a data catalog
See Event workflow configuration example for more information.