<a id="config-alert-props"></a>

# Configure Control Center Alerts for Confluent Platform

You can configure alert properties for the type of alert notifications you want to use.
By default, webhook notifications to PagerDuty and Slack are enabled and email
notifications are not enabled.

Create an alert trigger and action pair to send notification when the Control Center cluster goes down. For
more information, see [Control Center cluster down status](#c3-cluster-offline).

<a id="enable-disable-alerts-props"></a>

## Enable email alerts

The Alerts email action is not enabled by default. After enabling the
feature, the email action is available in the
[Actions](actions.md#new-edit-action-form)
form of the Control Center Alerts UI.

1. In the appropriate `control.center.properties` file for your environment,
   uncomment (remove the hash `#` from) the
   `#confluent.controlcenter.mail.enabled=true` configuration property.
   ```bash
   ...
   confluent.controlcenter.mail.enabled=true
   ...
   ```

   #### NOTE
   Make the change in the appropriate Control Center properties file(s)
   configured for your environments, which could include `control-center.properties`,
   `control-center-dev.properties`, `control-center-production.properties`,
   and `control-center-minimal.properties`. The properties files
   are located in `/path-to-control-center/etc/confluent-control-center/`.
2. Restart Control Center and pass in the properties file for the configuration to take effect:
   ```bash
   ./bin/control-center-stop
   ./bin/control-center-start ../etc/confluent-control-center/control-center.properties
   ```

You also must configure [SMTP email settings](#config-smtp-email)
as appropriate for your environment.

To disable the email action again, set the option to `false` (or comment it
out in the properties file) and restart Control Center with the updated properties
file.

<a id="config-smtp-email"></a>

## Configure SMTP email

Before you can send email alert notification actions, you must
enable [Email settings](../installation/configuration.md#email-settings) and properly
configure Control Center to communicate with your SMTP server.

At a minimum, you must set the following in the appropriate properties files:

```bash
# host name of your mail server
confluent.controlcenter.mail.host.name=mymail.server

# port your mail server is running on
confluent.controlcenter.mail.port=587

# email from address
confluent.controlcenter.mail.from=kafka-monitor@example.com

# Confluent also recommends setting advertised.url and rest.listeners
# explicitly because
# they will control the Control Center alerts history link that is embedded
# in the body of alerts
confluent.controlcenter.rest.advertised.url=myExternalHost
confluent.controlcenter.rest.listeners=control-center.server
```

Additional recommended email settings, including security:

```bash
# Username and password for username/password authentication
confluent.controlcenter.mail.username=myusername
confluent.controlcenter.mail.password=xxxxxxxx

# Forces using STARTTLS
confluent.controlcenter.mail.starttls.required=true

# Forces validation of server's certificate when using STARTTLS or SSL
confluent.controlcenter.mail.ssl.checkserveridentity=true

# Overrides confluent.controlcenter.mail.from when email bounced
confluent.controlcenter.mail.bounce.address=mybackupbounceemail@example.com
```

<a id="enable-disable-webhooks"></a>

## Enable or disable webhook alerts feature

The Alerts webhook action is enabled by default. The webhook
notification action is available in the [Actions](actions.md#new-edit-action-form) form.

Supported webhooks:
: - Slack
  - PagerDuty
  - Generic webhook notifications

**To enable webhook alerts:**

1. Add the following lines to the appropriate Control Center properties files
   for the environment.
   ```bash
   ...
   confluent.controlcenter.webhook.enabled=true
   ...
   ```
2. (Optional) In order to restrict webhook URLs while creating alerts with
   generic webhook action, add the following configuration to the appropriate Control Center properties files
   for the environment.
   ```bash
   ...
   confluent.controlcenter.webhook.whitelist.urls=www.example-0.com,www.example-1.com
   ...
   ```

   URLs not included in the whitelist fail to create generic webhook option alerts.

   If the whitelist is added *after* the alert has been created, the whitelist does
   not work. In this case, delete the alert, whitelist the URLs, and then re-create
   the alert.

   For more information, see [confluent.controlcenter.webhook.whitelist.urls](../installation/configuration.md#c3-webhook-whitelist).
3. Restart Control Center and pass in the properties file for the configuration to take effect:
   ```bash
   ./bin/control-center-stop
   ./bin/control-center-start ../etc/confluent-control-center/control-center.properties
   ```

**To disable webhook alerts:**

- To disable the webhook action, set the option to `false` and restart
  Control Center with the updated properties file.

#### NOTE
Make the change in the appropriate Control Center properties file(s)
configured for your environments, which could include `control-center.properties`,
`control-center-dev.properties`, `control-center-production.properties`,
and `control-center-minimal.properties`. The properties files
are located in `/path-to-control-center/etc/confluent-control-center/`.

<a id="c3-cluster-offline"></a>

## Control Center cluster down status

You may have noticed that when the Kafka cluster running Control Center is offline or unreachable, a red banner appears at the top of every
Control Center page. Similarly, you can configure alert notifications to be sent automatically to users when the cluster that Control Center
is running on goes down.

#### NOTE
If you are running a single cluster, Control Center will not send cluster down alerts.

To send an alert to recipients when the cluster goes offline, create a trigger and action using Control Center. For more information, see the following topics:

- [Create a trigger for Control Center cluster down](examples.md#alert-trigger-cluster-offline)
- [Create an email action for cluster down](examples.md#alert-email-action)
- [Create a Slack notification action for cluster down](examples.md#alert-slack-webhook-action)
- [Create a PagerDuty notification action for cluster down](examples.md#alert-pagerduty-webhook-action)
