Alerting: Adds Mimir to Alertmanager data source implementation (#50943)

This commit is contained in:
Gilles De Mey
2022-06-20 12:56:38 +02:00
committed by GitHub
parent ecaa1dcbfd
commit 81a5436c1e
4 changed files with 18 additions and 3 deletions

View File

@@ -25,6 +25,14 @@ var endpoints = map[string]map[string]string{
"alerts": "/alertmanager/api/v2/alerts",
"config": "/api/v1/alerts",
},
"mimir": {
"silences": "/alertmanager/api/v2/silences",
"silence": "/alertmanager/api/v2/silence/%s",
"status": "/alertmanager/api/v2/status",
"groups": "/alertmanager/api/v2/alerts/groups",
"alerts": "/alertmanager/api/v2/alerts",
"config": "/api/v1/alerts",
},
"prometheus": {
"silences": "/api/v2/silences",
"silence": "/api/v2/silence/%s",

View File

@@ -10,6 +10,12 @@ import { AlertManagerDataSourceJsonData, AlertManagerImplementation } from './ty
export type Props = DataSourcePluginOptionsEditorProps<AlertManagerDataSourceJsonData>;
const IMPL_OPTIONS: SelectableValue[] = [
{
value: AlertManagerImplementation.mimir,
icon: 'public/img/alerting/mimir_logo.svg',
label: 'Mimir',
description: `https://grafana.com/oss/mimir/. An open source, horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus.`,
},
{
value: AlertManagerImplementation.cortex,
label: 'Cortex',
@@ -36,7 +42,7 @@ export const ConfigEditor = (props: Props) => {
<Select
width={40}
options={IMPL_OPTIONS}
value={options.jsonData.implementation || AlertManagerImplementation.cortex}
value={options.jsonData.implementation || AlertManagerImplementation.mimir}
onChange={(value) =>
onOptionsChange({
...options,

View File

@@ -51,7 +51,7 @@ export class AlertManagerDatasource extends DataSourceApi<AlertManagerQuery, Ale
return {
status: 'error',
message:
'It looks like you have chosen Prometheus implementation, but detected a Cortex endpoint. Please update implementation selection and try again.',
'It looks like you have chosen Prometheus implementation, but detected a Mimir or Cortex endpoint. Please update implementation selection and try again.',
};
}
} catch (e) {}
@@ -65,7 +65,7 @@ export class AlertManagerDatasource extends DataSourceApi<AlertManagerQuery, Ale
return {
status: 'error',
message:
'It looks like you have chosen Cortex implementation, but detected a Prometheus endpoint. Please update implementation selection and try again.',
'It looks like you have chosen a Mimir or Cortex implementation, but detected a Prometheus endpoint. Please update implementation selection and try again.',
};
}
} catch (e) {}

View File

@@ -280,6 +280,7 @@ export interface ExternalAlertmanagerConfig {
export enum AlertManagerImplementation {
cortex = 'cortex',
mimir = 'mimir',
prometheus = 'prometheus',
}