+
+ {i18n.translate('xpack.monitoring.healthCheck.tlsAndEncryptionError', {
+ defaultMessage: `You must enable Transport Layer Security between Kibana and Elasticsearch
+ and configure an encryption key in your kibana.yml file to use the Alerting feature.`,
+ })}
+
+
+
+ {i18n.translate('xpack.monitoring.healthCheck.encryptionErrorAction', {
+ defaultMessage: 'Learn how.',
+ })}
+
+
+ ),
+ });
+};
+
+const showEncryptionError = () => {
+ const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = Legacy.shims.docLinks;
+
+ Legacy.shims.toastNotifications.addWarning(
+ {
+ title: toMountPoint(
+
+ {i18n.translate('xpack.monitoring.healthCheck.encryptionErrorBeforeKey', {
+ defaultMessage: 'To create an alert, set a value for ',
+ })}
+
+ {'xpack.encryptedSavedObjects.encryptionKey'}
+
+ {i18n.translate('xpack.monitoring.healthCheck.encryptionErrorAfterKey', {
+ defaultMessage: ' in your kibana.yml file. ',
+ })}
+
+ {i18n.translate('xpack.monitoring.healthCheck.encryptionErrorAction', {
+ defaultMessage: 'Learn how.',
+ })}
+
+
+ ),
+ },
+ {}
+ );
+};
+
+const showTlsError = () => {
+ const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = Legacy.shims.docLinks;
+
+ Legacy.shims.toastNotifications.addWarning({
+ title: toMountPoint(
+
+ {i18n.translate('xpack.monitoring.healthCheck.tlsError', {
+ defaultMessage:
+ 'Alerting relies on API keys, which require TLS between Elasticsearch and Kibana. ',
+ })}
+
+ {i18n.translate('xpack.monitoring.healthCheck.tlsErrorAction', {
+ defaultMessage: 'Learn how to enable TLS.',
+ })}
+
+
+ ),
+ });
+};
+
+export const showSecurityToast = (alertingHealth: AlertingFrameworkHealth) => {
+ const { isSufficientlySecure, hasPermanentEncryptionKey } = alertingHealth;
+ if (
+ Array.isArray(alertingHealth) ||
+ (!alertingHealth.hasOwnProperty('isSufficientlySecure') &&
+ !alertingHealth.hasOwnProperty('hasPermanentEncryptionKey'))
+ ) {
+ return;
+ }
+
+ if (!isSufficientlySecure && !hasPermanentEncryptionKey) {
+ showTlsAndEncryptionError();
+ } else if (!isSufficientlySecure) {
+ showTlsError();
+ } else if (!hasPermanentEncryptionKey) {
+ showEncryptionError();
+ }
+};
diff --git a/x-pack/plugins/monitoring/public/alerts/status.tsx b/x-pack/plugins/monitoring/public/alerts/status.tsx
index d15dcc9974863..9c262884d7257 100644
--- a/x-pack/plugins/monitoring/public/alerts/status.tsx
+++ b/x-pack/plugins/monitoring/public/alerts/status.tsx
@@ -20,6 +20,10 @@ interface Props {
export const AlertsStatus: React.FC