"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[6795],{59264:(x,l,e)=>{e.r(l),e.d(l,{plugin:()=>M});var c=e(9306),h=e(20964),a=e(65237),u=e(84923),d=e(95091),g=e(94795),f=e(1163),v=e(57313),p=e(38210),E=e(18819),i=e(40285);const A=[{value:i.sK.mimir,label:"Mimir",description:"https://grafana.com/oss/mimir/. An open source, horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus."},{value:i.sK.cortex,label:"Cortex",description:"https://cortexmetrics.io/"},{value:i.sK.prometheus,label:"Prometheus",description:"https://prometheus.io/. Does not support editing configuration via API, so contact points and notification policies are read-only."}],S=o=>{const{options:t,onOptionsChange:s}=o;return a.createElement(a.Fragment,null,a.createElement("h3",{className:"page-heading"},"Alertmanager"),a.createElement("div",{className:"gf-form-group"},a.createElement("div",{className:"gf-form-inline"},a.createElement("div",{className:"gf-form"},a.createElement(d.c,{width:13},"Implementation"),a.createElement(g.Ph,{width:40,options:A,value:t.jsonData.implementation||i.sK.mimir,onChange:r=>s({...t,jsonData:{...t.jsonData,implementation:r.value}})}))),a.createElement("div",{className:"gf-form-inline"},a.createElement(f._,{label:"Receive Grafana Alerts",tooltip:"When enabled, Grafana-managed alerts are sent to this Alertmanager.",labelWidth:26},a.createElement(v.x,{value:t.jsonData.handleGrafanaManagedAlerts??!1,onChange:r=>{s((0,h.ZP)(t,n=>{n.jsonData.handleGrafanaManagedAlerts=r.currentTarget.checked}))}})))),a.createElement(p.E,{defaultUrl:"",dataSourceConfig:t,showAccessOptions:!0,onChange:s,sigV4AuthToggleEnabled:E.vc.sigV4AuthEnabled,renderSigV4Editor:a.createElement(u.IW,{...o})}))};var y=e(45383),C=e(78209),m=e(55041),I=e(36203),P=e(84078);class D extends c.MF{constructor(t){super(t),this.instanceSettings=t}query(){return(0,y.of)({data:[]})}_request(t){const s={headers:{},method:"GET",url:this.instanceSettings.url+t};return(this.instanceSettings.basicAuth||this.instanceSettings.withCredentials)&&(this.instanceSettings.withCredentials=!0),this.instanceSettings.basicAuth&&(s.headers.Authorization=this.instanceSettings.basicAuth),(0,C.n)((0,m.i)().fetch(s))}async testDatasource(){let t;const s=this.instanceSettings.url,r=s?await(0,I.SJ)(s):{lazyConfigInit:!1};if(this.instanceSettings.jsonData.implementation===i.sK.prometheus){try{if(t=await this._request("/alertmanager/api/v2/status"),t&&t?.status===200)return{status:"error",message:"It looks like you have chosen Prometheus implementation, but detected a Mimir or Cortex endpoint. Please update implementation selection and try again."}}catch{}try{t=await this._request("/api/v2/status")}catch{}}else{try{if(t=await this._request("/api/v2/status"),t&&t?.status===200)return{status:"error",message:"It looks like you have chosen a Mimir or Cortex implementation, but detected a Prometheus endpoint. Please update implementation selection and try again."}}catch{}try{t=await this._request("/alertmanager/api/v2/status")}catch(n){if((0,m.kW)(n)&&r.lazyConfigInit&&(0,P.kk)(n)?.includes("the Alertmanager is not configured"))return{status:"success",message:"Health check passed.",details:{message:"Mimir Alertmanager without the fallback configuration has been discovered."}}}}return t?.status===200?{status:"success",message:"Health check passed."}:{status:"error",message:"Health check failed."}}}const M=new c.hf(D).setConfigEditor(S)}}]);

//# sourceMappingURL=alertmanagerPlugin.89e6e549647545507ec2.js.map