<a id="install-c3-migration"></a>

<a id="alert-migration-c3"></a>

# Migrate from Control Center (Legacy)

You can migrate alerts, including triggers and actions, from Control Center (Legacy) to
Control Center. Metric migration is not supported.

For more information about metrics, see [Confluent Control Center Release Notes](../release-notes.md#release-notes). To migrate alerts,
see [Alert migration API](#alert-migration-api).

#### WARNING
Do not install Control Center on the same node as Confluent Platform or any Confluent Platform data plane
services, such as Schema Registry or REST Proxy. Install Control Center on a dedicated node.
For more information, see [Multi-Node Installation for Production](multi-node.md#install-c3-multi-node-manual).

**Considerations**:

- For clusters where historical metrics are of no value, you can shut down Control Center (Legacy) as soon as Control Center is up and running.
- For clusters where historical metrics are needed (say, for a period of N days), consider the following recommendations:
  - Run both Control Center (Legacy) and Control Center simultaneously for N days.
  - Control Center (Legacy) users should continue using Control Center (Legacy) until the N days of history is populated in Control Center.
  - Once historical metrics are available in Control Center, you can shut down Control Center (Legacy) and move users to Control Center.

<a id="alert-migration-api"></a>

## Alert migration API

Control Center includes APIs to migrate alerts (triggers and actions) from from Control Center (Legacy) to Control Center.
Use these APIs to migrate your existing Control Center (Legacy) triggers and actions onto Control Center.

### Migrate alerts

Use `curl` on Control Center to migrate alerts. Alerts include triggers and actions.
Triggers come from the command topic on Control Center (Legacy) and are added to Alertmanager on
Control Center.

**Considerations**:

- Alert migration API returns 401 Unauthorized if you lack the required permissions. For more information,
  see [Authenticate to migrate alerts](#alert-migration-auth).
- Alerts that are not supported by Control Center are not migrated from Control Center (Legacy). For more information,
  see [Control Center Alerts for Confluent Platform](../alerts/concepts.md#concepts-alerts).
  - Alerts for ZooKeeper disconnected are not migrated.
  - Triggers with average latency (ms) metric for consumer groups
  - Triggers with consumer lead metric for consumer groups
  - Triggers with consumption difference metric for consumer groups
  - Triggers with maximum latency (ms) metric for consumer groups

<a id="alert-migration-auth"></a>

### Authenticate to migrate alerts

If you use role-based access control (RBAC) you must have `superuser` access to migrate alerts. For more
information, see [Use Predefined RBAC Roles in Confluent Platform](/platform/current/security/authorization/rbac/rbac-predefined-roles.html).

To use `curl` as `superuser`, navigate to Control Center as `superuser`, then use developer tools from your browser to
access the authorization header. Use the authorization header to authenticate `curl`.

**To use an authorization header to authenticate**

1. Login to Control Center.
2. From your browser, access the developer tools (In Chrome, for example, press F12).
3. Navigate to **Network**, select any Fetch/XHR request, then from **Request Headers**, copy the authorization header to your clipboard.
4. Use the authorization header to make the `curl` request.
   ```none
   curl --location --request POST 'https://ec2-52-11-17-175.us-west-2.compute.amazonaws.com:9021/3.0/alerts/triggers/migrate-triggers' \
        --header 'authorization: Bearer {authorization_header}'
   ```

**To migrate triggers**

1. Use Verification API to check for differences.
   ```none
   curl --location 'http://localhost:9021/3.0/alerts/triggers/migration/status'
   ```

   - If you don’t see any differences, the previous install of Control Center (Legacy) did not have any triggers or Control Center may already contain the necessary triggers.
   - If triggers are pending migration, you get a failure response, and that means that triggers are available to migrate. Use the Migrate triggers API.
     ```none
     {"missingTriggersGuids":["0000a000-b000-0000-a0ae-fbdd00e00000"],"status":"failure"}
     ```
   - If triggers are already migrated, you get a success message.
     ```none
     {"status":"success"}
     ```
2. Migrate triggers using the Migrate triggers API.
   ```none
   curl --location --request POST 'http://localhost:9021/3.0/alerts/triggers/migrate-triggers'
   ```
3. Use Verification API to check for differences.
   ```none
   curl --location 'http://localhost:9021/3.0/alerts/triggers/migration/status'
   ```

   If the status returns success, the trigger migration is complete.

**To migrate actions:**

1. Use Verification API to check for differences.
   ```none
   curl --location 'http://localhost:9021/3.0/alerts/actions/migration/status'
   ```

   - If you don’t see any differences, the previous install of Control Center (Legacy) did not have any actions or Control Center may already contain the necessary actions.
   - If actions are pending migration, you get a failure response, and that means that actions are available to migrate. Use the Migrate actions API.
     ```none
     {"missingTriggersGuids":["0000a000-b000-0000-a0ae-fbdd00e00000"],"status":"failure"}
     ```
   - If actions are already migrated, you get a success message.
     ```none
     {"status":"success"}
     ```
2. Migrate actions using the Migrate actions API.
   ```none
   curl --location --request POST 'http://localhost:9021/3.0/alerts/actions/migrate-actions'
   ```
3. Use Verification API to check for differences.
   ```none
   curl --location 'http://localhost:9021/3.0/alerts/actions/migration/status'
   ```

   If the status returns success, the actions migration is complete.

## API reference

This is the reference for the Alert Migration API.

### Migrate triggers

Migrates triggers from the command topic to Prometheus.

Endpoint:

```none
POST /3.0/alerts/triggers/migrate-triggers
```

Sample curl:

```none
curl --location --request POST 'http://localhost:9021/3.0/alerts/triggers/migrate-triggers'
```

Response codes:

|   Response code | Description                                                         |
|-----------------|---------------------------------------------------------------------|
|             200 | Successful migration                                                |
|             401 | Unauthorized (requires `superuser` privileges when RBAC is enabled) |
|             500 | Internal server error during migration                              |

Example Response (Success):

- No response body.

```none
200 OK
```

### Verify trigger migration

Verifies the status of trigger migration by comparing triggers in the command store with those in Prometheus.

Endpoint:

```none
GET /3.0/alerts/triggers/migration/status
```

Sample curl:

```none
curl --location 'http://localhost:9021/3.0/alerts/triggers/migration/status'
```

Response codes:

|   Response code | Description           |
|-----------------|-----------------------|
|             200 | Verification complete |
|             500 | Verification failed   |

Example Responses:

Success:

```none
{
"status": "success"
}
```

Failure (Missing Triggers):

```none
{
"status": "success",
"missingTriggersGuids": ["trigger-guid-1", "trigger-guid-2"]
}
```

### Migrate actions

Migrates all actions from the command topic to Alertmanager.

Endpoint:

```none
POST /3.0/alerts/actions/migrate-actions
```

Sample curl:

```none
curl --location --request POST 'http://localhost:9021/3.0/alerts/actions/migrate-actions'
```

Response Codes:

|   Response code | Description                                                |
|-----------------|------------------------------------------------------------|
|             200 | Successful migration                                       |
|             401 | Unauthorized (RBAC is enabled and you are not a superuser) |
|             500 | Internal server error during migration                     |

Example Response (Success):

- No response body

```none
200 OK
```

### Verify action migration

Verifies the status of action migration by comparing actions in the command store with those in Alertmanager.

Endpoint:

```none
GET /3.0/alerts/actions/migration/status
```

Sample curl:

```none
curl --location 'http://localhost:9021/3.0/alerts/actions/migration/status'
```

Response codes:

|   Response code | Description           |
|-----------------|-----------------------|
|             200 | Verification complete |
|             500 | Verification failed   |

Example Responses:

Success:

```none
{
"status": "success"
}
```

Failure (Missing Actions):

```none
{
"status": "success",
"missing_actions from receivers: ": ["action-guid-1"]
}
```

## Related content

- [Multi-Node Installation for Production](multi-node.md#install-c3-multi-node-manual)
- [Control Center Alerts for Confluent Platform](../alerts/concepts.md#concepts-alerts)
- [Configure RBAC for Control Center on Confluent Platform](../security/c3-rbac.md#controlcenter-security-rbac)
