# Monte Carlo

> Work with Monte Carlo's data observability: triage alerts and incidents, look up tables, lineage and tags, and create, run and snooze monitors.

App · 24 actions. Web page: https://docs.lodol.com/docs/integrations/monte-carlo

## Actions

### Add alert comment

Leave a comment on an alert, which shows in its timeline.

**Inputs**

- Alert ID (`alert_id`, text, required): The alert's ID, as List alerts or an alert trigger returns it (id).
- Comment (`comment`, text, required): What to say.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "createdTime": "example",
    "data": "example",
    "eventType": "example",
    "uuid": "example"
  }
}
```

### Create SQL monitor

Create a custom SQL monitor that runs a query on a warehouse and raises an alert when its result crosses a threshold.

**Inputs**

- Name (`name`, text, required): The monitor's name, as Monte Carlo shows it.
- Warehouse (`warehouse`, text, required): The warehouse to run the query on.
- SQL (`sql`, text, required): The query to run, in your warehouse's SQL.
- Compare (`result_type`, text): What the query's result is compared with the threshold as. One of: `ROW_COUNT` (Number of rows the query returns), `SINGLE_NUMERIC` (The single number the query returns). Default: `ROW_COUNT`.
- Alert when the result is (`operator`, text, required): Raise an alert when the result is this compared with the threshold. One of: `GT` (Greater than), `GTE` (Greater than or equal to), `LT` (Less than), `LTE` (Less than or equal to), `EQ` (Equal to), `NEQ` (Not equal to).
- Threshold (`threshold`, number, required): The value to compare the result with, such as 0.
- Runs (`schedule`, text): When the monitor runs. One of: `FIXED` (On a schedule), `MANUAL` (Only when run by hand or by a step). Default: `FIXED`.
- Every (minutes) (`interval_minutes`, number): On a schedule: how many minutes between runs. 60 if left empty. At least 1.
- First run (`start_time`, date and time): On a schedule: when the first run is. Leave empty to start now.
- Priority (`priority`, text): The priority its alerts get. One of: `P1` (P1 (highest)), `P2`, `P3`, `P4`, `P5` (P5 (lowest)).
- Domain (`domain`, text): The domain the monitor belongs to, if your account asks for one.
- Notes (`notes`, text): Notes for whoever looks at its alerts.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "createdTime": "example",
    "customSql": "example",
    "description": "example",
    "isDraft": true,
    "isPaused": true,
    "isSnoozed": true,
    "labels": [
      "example"
    ],
    "nextExecutionTime": "example",
    "notes": "example",
    "priority": "example",
    "ruleType": "example",
    "scheduleConfig": {
      "intervalMinutes": 1,
      "scheduleType": "example",
      "startTime": "example",
      "timezone": "example"
    },
    "snoozeUntilTime": "example",
    "updatedTime": "example",
    "uuid": "example",
    "warehouseUuid": "example"
  }
}
```

### Delete alert comment

Delete a comment from an alert.

**Inputs**

- Comment ID (`comment_id`, text, required): The comment's ID, as Add alert comment or List alert comments returns it (uuid).

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "success": true
  }
}
```

### Delete monitor

Delete a monitor. Its past alerts stay.

**Inputs**

- Monitor (`monitor`, text, required): The monitor to use.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "success": true
  }
}
```

### Get alert

Get an alert's details: its title, type, status, severity, owner, tables and link. An alert merged into another names that one in mergedIntoAlertId.

**Inputs**

- Alert ID (`alert_id`, text, required): The alert's ID, as List alerts or an alert trigger returns it (id).

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "commentCount": 1,
    "createdTime": "example",
    "domains": [
      {
        "name": "example",
        "uuid": "example"
      }
    ],
    "id": "example",
    "lastCommentText": "example",
    "mergedIntoAlertId": "example",
    "monitorTags": [
      {
        "name": "example",
        "value": "example"
      }
    ],
    "monitorUuids": [
      "example"
    ],
    "owner": {
      "email": "example",
      "fullName": "example"
    },
    "priority": "example",
    "severity": "example",
    "sloStatus": "example",
    "status": "example",
    "tables": [
      {
        "isKeyAsset": true,
        "mcon": "example",
        "tableId": "example"
      }
    ],
    "title": "example",
    "type": "example",
    "updatedTime": "example",
    "url": "example"
  }
}
```

### Get current user

Get the Monte Carlo user the API key belongs to, with their role and account.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "account": {
      "name": "example",
      "uuid": "example"
    },
    "displayName": "example",
    "email": "example",
    "firstName": "example",
    "id": "example",
    "lastName": "example",
    "role": "example"
  }
}
```

### Get table

Get a table's details: its warehouse, type, description, whether it is monitored and when it was last read and written.

**Inputs**

- Table MCON (`table`, text, required): The table's MCON, Monte Carlo's name for it, as List tables returns it (mcon).

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "dataset": "example",
    "description": "example",
    "discoveredTime": "example",
    "friendlyName": "example",
    "fullTableId": "example",
    "importanceScore": 1,
    "isImportant": true,
    "isMonitored": true,
    "isMuted": true,
    "lastActivity": "example",
    "lastObserved": "example",
    "lastRead": "example",
    "lastWrite": "example",
    "mcon": "example",
    "path": "example",
    "projectName": "example",
    "tableId": "example",
    "tableType": "example",
    "warehouse": {
      "name": "example",
      "uuid": "example"
    }
  }
}
```

### Get table lineage

Get the tables, views, reports and jobs that read from a table or that it reads from.

**Inputs**

- Table MCON (`table`, text, required): The table's MCON, Monte Carlo's name for it, as List tables returns it (mcon).
- Direction (`direction`, text, required): Which way to follow the lineage. One of: `downstream` (Downstream (what reads from it)), `upstream` (Upstream (what it reads from)).
- Hops (`hops`, number): How many steps away to follow it, 1 for direct connections only. From 1 to 10.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "baseNode": {
      "displayName": "example",
      "isMonitored": true,
      "lastActivity": "example",
      "mcon": "example",
      "objectType": "example"
    },
    "connectedNodes": [
      {
        "displayName": "example",
        "isMonitored": true,
        "lastActivity": "example",
        "mcon": "example",
        "objectType": "example"
      }
    ],
    "flattenedEdges": [
      {
        "directlyConnectedMcons": [
          "example"
        ],
        "mcon": "example"
      }
    ]
  }
}
```

### List alert comments

List the comments people have left on an alert.

**Inputs**

- Alert ID (`alert_id`, text, required): The alert's ID, as List alerts or an alert trigger returns it (id).
- Limit (`limit`, number): How many comments to return, up to 100. From 1 to 100.
- Cursor (`cursor`, text): To read the next page, the next_cursor value a previous list step returned.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "count": 1,
    "items": [
      {
        "createdTime": "example",
        "data": "example",
        "eventType": "example",
        "uuid": "example"
      }
    ],
    "next_cursor": "example",
    "total_count": 1
  }
}
```

### List alerts

List the alerts raised in a period (the last 7 days unless you choose), with their status, severity, priority, owner and tables.

**Inputs**

- From (`after`, date and time): The start of the period. Monte Carlo searches at most two months at a time.
- Until (`before`, date and time): The end of the period. Leave empty for now.
- Period covers (`time_field`, text): Whether the period is when alerts were created or when they last changed. One of: `created` (When it was created), `updated` (When it was last updated). Default: `created`.
- Statuses (`statuses`, list): Only alerts with these statuses. One or more of: `ACKNOWLEDGED`, `WORK_IN_PROGRESS` (Work in progress), `FIXED`, `EXPECTED`, `NO_ACTION_NEEDED` (No action needed), `FALSE_POSITIVE` (False positive).
- Severities (`severities`, list): Only incidents with these severities. One or more of: `SEV_1` (SEV-1 (most severe)), `SEV_2` (SEV-2), `SEV_3` (SEV-3), `SEV_4` (SEV-4 (least severe)).
- Priorities (`priorities`, list): Only alerts with these priorities. One or more of: `P1` (P1 (highest)), `P2`, `P3`, `P4`, `P5` (P5 (lowest)).
- Alert types (`types`, list): Only alerts of these kinds. One or more of: `ANOMALIES` (Freshness and volume), `METRIC_ANOMALIES` (Metric), `CUSTOM_RULE_ANOMALIES` (Custom SQL and validation), `SCHEMA_CHANGES` (Schema change), `JSON_SCHEMA_CHANGES` (JSON schema change), `DELETED_TABLES` (Deleted table), `METRIC_COMPARISON_ANOMALIES` (Comparison), `PERFORMANCE_ANOMALIES` (Query performance), `DBT_ERRORS` (dbt error), `ETL_ERRORS` (ETL job error), and 5 more.
- Owners (`owners`, list): Only alerts these people own.
- Domains (`domains`, list): Only alerts in these domains.
- Table MCONs (`tables`, list): Only alerts on these tables, by MCON.
- Resolved (`resolved`, true/false): On: only alerts whose events are all back to normal. Off: only alerts still active. Leave empty for both.
- Limit (`limit`, number): How many alerts to return, up to 100. From 1 to 100.
- Cursor (`cursor`, text): To read the next page, the next_cursor value a previous list step returned.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "count": 1,
    "items": [
      {
        "commentCount": 1,
        "createdTime": "example",
        "domains": [
          {
            "name": "example",
            "uuid": "example"
          }
        ],
        "id": "example",
        "lastCommentText": "example",
        "monitorTags": [
          {
            "name": "example",
            "value": "example"
          }
        ],
        "monitorUuids": [
          "example"
        ],
        "owner": {
          "email": "example",
          "fullName": "example"
        },
        "priority": "example",
        "severity": "example",
        "sloStatus": "example",
        "status": "example",
        "tables": [
          {
            "isKeyAsset": true,
            "mcon": "example",
            "tableId": "example"
          }
        ],
        "title": "example",
        "type": "example",
        "updatedTime": "example",
        "url": "example"
      }
    ],
    "next_cursor": "example",
    "total_count": 1
  }
}
```

### List domains

List your account's domains, the groups of tables that teams own.

**Inputs**: None.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "count": 1,
    "items": [
      {
        "assignments": [
          "example"
        ],
        "createdByEmail": "example",
        "description": "example",
        "name": "example",
        "tags": [
          {
            "name": "example",
            "value": "example"
          }
        ],
        "uuid": "example"
      }
    ]
  }
}
```

### List monitors

List the monitors in your account, with their kind, schedule, tables and how many incidents they raised in the last week.

**Inputs**

- Search (`search`, text): Only monitors whose name, description or tables match this.
- Monitor types (`monitor_types`, list): Only monitors of these kinds. One or more of: `TABLE`, `STATS` (Metric), `CUSTOM_SQL` (Custom SQL), `VALIDATION`, `FRESHNESS`, `VOLUME`, `SCHEMA`, `JSON_SCHEMA` (JSON schema), `METRIC_COMPARISON` (Comparison), `QUERY_PERF` (Query performance), and 7 more.
- Statuses (`statuses`, list): Only monitors in these states. One or more of: `ENABLED`, `DISABLED` (Disabled (paused)), `SNOOZED`, `ERROR`, `TRAINING`, `INSUFFICIENT_DATA` (Insufficient data), `DRAFT`.
- Domains (`domains`, list): Only monitors in these domains.
- Created after (`created_after`, date and time): Only monitors created at or after this time.
- Limit (`limit`, number): How many monitors to return, up to 500. From 1 to 500.
- Offset (`offset`, number): How many monitors to skip, to read the next page. At least 0.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "count": 1,
    "items": [
      {
        "createdTime": "example",
        "creatorId": "example",
        "description": "example",
        "domainUuids": [
          "example"
        ],
        "entityMcons": [
          "example"
        ],
        "isDraft": true,
        "isPaused": true,
        "isSnoozeable": true,
        "labels": [
          "example"
        ],
        "lastUpdateTime": "example",
        "monitorType": "example",
        "name": "example",
        "nextExecutionTime": "example",
        "prevExecutionTime": "example",
        "priority": "example",
        "sevenDaysIncidentCount": 1,
        "tags": [
          {
            "name": "example",
            "value": "example"
          }
        ],
        "uuid": "example"
      }
    ]
  }
}
```

### List table tags

List the tags (key and value pairs) on a table.

**Inputs**

- Table MCON (`table`, text, required): The table's MCON, Monte Carlo's name for it, as List tables returns it (mcon).

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "count": 1,
    "items": [
      {
        "id": "example",
        "mconId": "example",
        "propertyName": "example",
        "propertySourceType": "example",
        "propertyValue": "example"
      }
    ]
  }
}
```

### List tables

List the tables and views Monte Carlo knows about, with their MCON, warehouse and when they were last read and written.

**Inputs**

- Search (`search`, text): Only tables whose name, schema or database contain this.
- Warehouse (`warehouse`, text): Only tables in this warehouse.
- Domain (`domain`, text): Only tables in this domain.
- Monitored only (`monitored_only`, true/false): Only tables Monte Carlo monitors.
- Limit (`limit`, number): How many tables to return, up to 100. From 1 to 100.
- Cursor (`cursor`, text): To read the next page, the next_cursor value a previous list step returned.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "count": 1,
    "items": [
      {
        "dataset": "example",
        "description": "example",
        "discoveredTime": "example",
        "friendlyName": "example",
        "fullTableId": "example",
        "importanceScore": 1,
        "isImportant": true,
        "isMonitored": true,
        "isMuted": true,
        "lastActivity": "example",
        "lastObserved": "example",
        "lastRead": "example",
        "lastWrite": "example",
        "mcon": "example",
        "path": "example",
        "projectName": "example",
        "tableId": "example",
        "tableType": "example",
        "warehouse": {
          "name": "example",
          "uuid": "example"
        }
      }
    ],
    "next_cursor": "example",
    "total_count": 1
  }
}
```

### List users

List the people in your Monte Carlo account with their names and email addresses.

**Inputs**

- Search (`search`, text): Only people whose first name, last name or email address match this.
- Limit (`limit`, number): How many people to return, up to 100. From 1 to 100.
- Cursor (`cursor`, text): To read the next page, the next_cursor value a previous list step returned.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "count": 1,
    "items": [
      {
        "email": "example",
        "firstName": "example",
        "id": "example",
        "lastName": "example"
      }
    ],
    "next_cursor": "example",
    "total_count": 1
  }
}
```

### List warehouses

List the warehouses, lakes and databases Monte Carlo monitors that you can see.

**Inputs**

- Domains (`domains`, list): Only warehouses in these domains.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "count": 1,
    "items": [
      {
        "connectionType": "example",
        "createdOn": "example",
        "customMonitorCount": 1,
        "name": "example",
        "supportsCustomSqlRules": true,
        "totalMonitorCount": 1,
        "uuid": "example"
      }
    ]
  }
}
```

### Remove table tag

Take a tag off a table.

**Inputs**

- Table MCON (`table`, text, required): The table's MCON, Monte Carlo's name for it, as List tables returns it (mcon).
- Tag key (`tag_key`, text, required): The tag's key, such as owner.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "success": true
  }
}
```

### Run monitor

Run a monitor now, outside its schedule.

**Inputs**

- Monitor (`monitor`, text, required): The monitor to use.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "manualMonitorExecutionUuid": "example",
    "success": true
  }
}
```

### Set alert owner

Make someone in your Monte Carlo account the owner of an alert.

**Inputs**

- Alert ID (`alert_id`, text, required): The alert's ID, as List alerts or an alert trigger returns it (id).
- Owner (`owner`, text, required): The person to own the alert, by their email address.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "commentCount": 1,
    "createdTime": "example",
    "domains": [
      {
        "name": "example",
        "uuid": "example"
      }
    ],
    "id": "example",
    "lastCommentText": "example",
    "monitorTags": [
      {
        "name": "example",
        "value": "example"
      }
    ],
    "monitorUuids": [
      "example"
    ],
    "owner": {
      "email": "example",
      "fullName": "example"
    },
    "priority": "example",
    "severity": "example",
    "sloStatus": "example",
    "status": "example",
    "tables": [
      {
        "isKeyAsset": true,
        "mcon": "example",
        "tableId": "example"
      }
    ],
    "title": "example",
    "type": "example",
    "updatedTime": "example",
    "url": "example"
  }
}
```

### Set alert severity

Mark an alert as an incident with a severity, change its severity, or turn it back into an ordinary alert.

**Inputs**

- Alert ID (`alert_id`, text, required): The alert's ID, as List alerts or an alert trigger returns it (id).
- Severity (`severity`, text, required): The incident's severity, or Not an incident to clear it. One of: `SEV_1` (SEV-1 (most severe)), `SEV_2` (SEV-2), `SEV_3` (SEV-3), `SEV_4` (SEV-4 (least severe)), `NO_SEVERITY` (Not an incident (clear the severity)).

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "commentCount": 1,
    "createdTime": "example",
    "domains": [
      {
        "name": "example",
        "uuid": "example"
      }
    ],
    "id": "example",
    "lastCommentText": "example",
    "monitorTags": [
      {
        "name": "example",
        "value": "example"
      }
    ],
    "monitorUuids": [
      "example"
    ],
    "owner": {
      "email": "example",
      "fullName": "example"
    },
    "priority": "example",
    "severity": "example",
    "sloStatus": "example",
    "status": "example",
    "tables": [
      {
        "isKeyAsset": true,
        "mcon": "example",
        "tableId": "example"
      }
    ],
    "title": "example",
    "type": "example",
    "updatedTime": "example",
    "url": "example"
  }
}
```

### Set table tag

Tag a table with a key and value, or change the value of a tag it has.

**Inputs**

- Table MCON (`table`, text, required): The table's MCON, Monte Carlo's name for it, as List tables returns it (mcon).
- Tag key (`tag_key`, text, required): The tag's key, such as owner.
- Tag value (`tag_value`, text): The tag's value, such as data-platform. Leave empty for a tag with no value.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "id": "example",
    "mconId": "example",
    "propertyName": "example",
    "propertySourceType": "example",
    "propertyValue": "example"
  }
}
```

### Snooze SQL monitor

Stop a custom SQL monitor raising alerts for a while, or until its result changes. It keeps running meanwhile.

**Inputs**

- Monitor (`monitor`, text, required): The custom SQL monitor to use.
- Minutes (`minutes`, number): How many minutes to snooze it for. At least 1.
- Until the result changes (`until_changed`, true/false): Snooze it until the result it breached on changes or recovers, instead of for a number of minutes.
- Reason (`reason`, text): Why, recorded as a comment on the monitor.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "createdTime": "example",
    "customSql": "example",
    "description": "example",
    "isDraft": true,
    "isPaused": true,
    "isSnoozed": true,
    "labels": [
      "example"
    ],
    "nextExecutionTime": "example",
    "notes": "example",
    "priority": "example",
    "ruleType": "example",
    "scheduleConfig": {
      "intervalMinutes": 1,
      "scheduleType": "example",
      "startTime": "example",
      "timezone": "example"
    },
    "snoozeUntilTime": "example",
    "updatedTime": "example",
    "uuid": "example",
    "warehouseUuid": "example"
  }
}
```

### Unsnooze SQL monitor

Let a snoozed custom SQL monitor raise alerts again.

**Inputs**

- Monitor (`monitor`, text, required): The custom SQL monitor to use.
- Reason (`reason`, text): Why, recorded as a comment on the monitor.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "createdTime": "example",
    "customSql": "example",
    "description": "example",
    "isDraft": true,
    "isPaused": true,
    "isSnoozed": true,
    "labels": [
      "example"
    ],
    "nextExecutionTime": "example",
    "notes": "example",
    "priority": "example",
    "ruleType": "example",
    "scheduleConfig": {
      "intervalMinutes": 1,
      "scheduleType": "example",
      "startTime": "example",
      "timezone": "example"
    },
    "snoozeUntilTime": "example",
    "updatedTime": "example",
    "uuid": "example",
    "warehouseUuid": "example"
  }
}
```

### Update alert

Set an alert's status, such as acknowledged or fixed, or rename it. Anything left empty stays as it is.

**Inputs**

- Alert ID (`alert_id`, text, required): The alert's ID, as List alerts or an alert trigger returns it (id).
- Status (`status`, text): The alert's new status. One of: `NO_STATUS` (No status), `ACKNOWLEDGED`, `WORK_IN_PROGRESS` (Work in progress), `FIXED`, `EXPECTED`, `NO_ACTION_NEEDED` (No action needed), `FALSE_POSITIVE` (False positive).
- Title (`name`, text): A new title for the alert.

**Outputs**

- `data` (object): The response from Monte Carlo.

**Example output**

```json
{
  "data": {
    "commentCount": 1,
    "createdTime": "example",
    "domains": [
      {
        "name": "example",
        "uuid": "example"
      }
    ],
    "id": "example",
    "lastCommentText": "example",
    "monitorTags": [
      {
        "name": "example",
        "value": "example"
      }
    ],
    "monitorUuids": [
      "example"
    ],
    "owner": {
      "email": "example",
      "fullName": "example"
    },
    "priority": "example",
    "severity": "example",
    "sloStatus": "example",
    "status": "example",
    "tables": [
      {
        "isKeyAsset": true,
        "mcon": "example",
        "tableId": "example"
      }
    ],
    "title": "example",
    "type": "example",
    "updatedTime": "example",
    "url": "example"
  }
}
```
