"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[6795],{8654:(b,l,e)=>{e.r(l),e.d(l,{plugin:()=>j});var c=e(68246),h=e(11109),a=e(27702),u=e(85014),d=e(84923),g=e(60644),f=e(28580),v=e(48024),p=e(42074),E=e(49257),y=e(21323),S=e(12308),i=e(62862);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."}],C=o=>{const{options:t,onOptionsChange:n}=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(g.c,{width:13},"Implementation"),a.createElement(f.Ph,{width:40,options:A,value:t.jsonData.implementation||i.sK.mimir,onChange:r=>n({...t,jsonData:{...t.jsonData,implementation:r.value}})}))),a.createElement("div",{className:"gf-form-inline"},a.createElement(v._,{label:"Receive Grafana Alerts",tooltip:"When enabled, Grafana-managed alerts are sent to this Alertmanager.",labelWidth:26},a.createElement(p.x,{value:t.jsonData.handleGrafanaManagedAlerts??!1,onChange:r=>{n((0,h.Uy)(t,s=>{s.jsonData.handleGrafanaManagedAlerts=r.currentTarget.checked}))}}))),t.jsonData.handleGrafanaManagedAlerts&&a.createElement(y.x,{variant:"bodySmall",color:"secondary"},"Make sure to enable the alert forwarding on the ",a.createElement(u.Link,{to:"/alerting/admin"},"admin page"),".")),a.createElement(E.E,{defaultUrl:"",dataSourceConfig:t,showAccessOptions:!0,onChange:n,sigV4AuthToggleEnabled:S.config.sigV4AuthEnabled,renderSigV4Editor:a.createElement(d.IW,{...o}),secureSocksDSProxyEnabled:!1}))};var D=e(45383),I=e(78209),m=e(73289),M=e(55394),P=e(84369);class x extends c.MF{constructor(t){super(t),this.instanceSettings=t}query(){return(0,D.of)({data:[]})}_request(t){const n={headers:{},method:"GET",url:this.instanceSettings.url+t};return(this.instanceSettings.basicAuth||this.instanceSettings.withCredentials)&&(this.instanceSettings.withCredentials=!0),this.instanceSettings.basicAuth&&(n.headers.Authorization=this.instanceSettings.basicAuth),(0,I.n)((0,m.i)().fetch(n))}async testDatasource(){let t;const n=this.instanceSettings.url,r=n?await(0,M.SJ)(n):{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(s){if((0,m.kW)(s)&&r.lazyConfigInit&&(0,P.kk)(s)?.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 j=new c.hf(x).setConfigEditor(C)}}]);

//# sourceMappingURL=alertmanagerPlugin.95b766c95e15780faeb2.js.map