mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
check if alertmanager being configured is cortex or vanilla (#34726)
This commit is contained in:
parent
871e476e41
commit
5660bb585f
@ -1,5 +1,5 @@
|
||||
import { DataSourcePluginOptionsEditorProps } from '@grafana/data';
|
||||
import { DataSourceHttpSettings } from '@grafana/ui';
|
||||
import { Alert, DataSourceHttpSettings } from '@grafana/ui';
|
||||
import React from 'react';
|
||||
|
||||
export type Props = DataSourcePluginOptionsEditorProps;
|
||||
@ -7,6 +7,9 @@ export type Props = DataSourcePluginOptionsEditorProps;
|
||||
export const ConfigEditor: React.FC<Props> = ({ options, onOptionsChange }) => {
|
||||
return (
|
||||
<>
|
||||
<Alert severity="info" title="Only Cortex alertmanager is supported">
|
||||
Note that only Cortex implementation of alert manager is supported at this time.
|
||||
</Alert>
|
||||
<DataSourceHttpSettings
|
||||
defaultUrl={''}
|
||||
dataSourceConfig={options}
|
||||
|
@ -44,12 +44,19 @@ export class AlertManagerDatasource extends DataSourceApi<AlertManagerQuery> {
|
||||
|
||||
try {
|
||||
alertmanagerResponse = await this._request('/api/v2/status');
|
||||
if (alertmanagerResponse && alertmanagerResponse?.status === 200) {
|
||||
return {
|
||||
status: 'error',
|
||||
message:
|
||||
'Only Cortex alert manager implementation is supported. A URL to cortex instance should be provided.',
|
||||
};
|
||||
}
|
||||
} catch (e) {}
|
||||
try {
|
||||
cortexAlertmanagerResponse = await this._request('/alertmanager/api/v2/status');
|
||||
} catch (e) {}
|
||||
|
||||
return alertmanagerResponse?.status === 200 || cortexAlertmanagerResponse?.status === 200
|
||||
return cortexAlertmanagerResponse?.status === 200
|
||||
? {
|
||||
status: 'success',
|
||||
message: 'Health check passed.',
|
||||
|
Loading…
Reference in New Issue
Block a user