[v9.0.x] Alerting: Adds Mimir to Alertmanager data source implementation (#51109)

Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
This commit is contained in:
Grot (@grafanabot)
2022-06-20 13:14:09 +02:00
committed by GitHub
co-authored by Gilles De Mey
parent e487bfb460
commit 51344afeaf
4 changed files with 18 additions and 3 deletions
+8
View File
@@ -25,6 +25,14 @@ var endpoints = map[string]map[string]string{
"alerts": "/alertmanager/api/v2/alerts", "alerts": "/alertmanager/api/v2/alerts",
"config": "/api/v1/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": { "prometheus": {
"silences": "/api/v2/silences", "silences": "/api/v2/silences",
"silence": "/api/v2/silence/%s", "silence": "/api/v2/silence/%s",
@@ -8,6 +8,12 @@ import { AlertManagerDataSourceJsonData, AlertManagerImplementation } from './ty
export type Props = DataSourcePluginOptionsEditorProps<AlertManagerDataSourceJsonData>; export type Props = DataSourcePluginOptionsEditorProps<AlertManagerDataSourceJsonData>;
const IMPL_OPTIONS: SelectableValue[] = [ 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, value: AlertManagerImplementation.cortex,
label: 'Cortex', label: 'Cortex',
@@ -32,7 +38,7 @@ export const ConfigEditor: React.FC<Props> = ({ options, onOptionsChange }) => {
<Select <Select
width={40} width={40}
options={IMPL_OPTIONS} options={IMPL_OPTIONS}
value={options.jsonData.implementation || AlertManagerImplementation.cortex} value={options.jsonData.implementation || AlertManagerImplementation.mimir}
onChange={(value) => onChange={(value) =>
onOptionsChange({ onOptionsChange({
...options, ...options,
@@ -51,7 +51,7 @@ export class AlertManagerDatasource extends DataSourceApi<AlertManagerQuery, Ale
return { return {
status: 'error', status: 'error',
message: 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) {} } catch (e) {}
@@ -65,7 +65,7 @@ export class AlertManagerDatasource extends DataSourceApi<AlertManagerQuery, Ale
return { return {
status: 'error', status: 'error',
message: 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) {} } catch (e) {}
@@ -280,6 +280,7 @@ export interface ExternalAlertmanagerConfig {
export enum AlertManagerImplementation { export enum AlertManagerImplementation {
cortex = 'cortex', cortex = 'cortex',
mimir = 'mimir',
prometheus = 'prometheus', prometheus = 'prometheus',
} }