"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[4737,9546],{59858:(u,r,a)=>{a.r(r),a.d(r,{plugin:()=>E});var h=a(29997),e=a(74848),c=a(1932),g=a(96540),f=a(35557),v=a(65074),p=a(90231),d=a(60484),j=a(44826),x=a(29010),A=a(45565),y=a(98378),S=a(88023),o=a(80187);const C=[{value:o.Oz.mimir,label:"Mimir",description:"https://grafana.com/oss/mimir/. An open source, horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus."},{value:o.Oz.cortex,label:"Cortex",description:"https://cortexmetrics.io/"},{value:o.Oz.prometheus,label:"Prometheus",description:"https://prometheus.io/. Does not support editing configuration via API, so contact points and notification policies are read-only."}],D=l=>{const{options:t,onOptionsChange:s}=l;return(0,g.useEffect)(()=>{t.jsonData.implementation||s((0,c.jM)(t,n=>{n.jsonData.implementation=o.Oz.mimir}))},[t,s]),(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("h3",{className:"page-heading",children:"Alertmanager"}),(0,e.jsxs)(p.a,{marginBottom:5,children:[(0,e.jsx)(d.I,{label:"Implementation",labelWidth:26,children:(0,e.jsx)(j.l6,{width:40,options:C,value:t.jsonData.implementation||o.Oz.mimir,onChange:n=>s({...t,jsonData:{...t.jsonData,implementation:n.value}})})}),(0,e.jsx)(d.I,{label:"Receive Grafana Alerts",tooltip:"When enabled, Grafana-managed alerts are sent to this Alertmanager.",labelWidth:26,children:(0,e.jsx)(x.K,{value:t.jsonData.handleGrafanaManagedAlerts??!1,onChange:n=>{s((0,c.jM)(t,i=>{i.jsonData.handleGrafanaManagedAlerts=n.currentTarget.checked}))}})}),t.jsonData.handleGrafanaManagedAlerts&&(0,e.jsxs)(A.E,{variant:"bodySmall",color:"secondary",children:["Make sure to enable the alert forwarding on the ",(0,e.jsx)(f.Link,{to:"/alerting/admin",children:"settings page"}),"."]})]}),(0,e.jsx)(y.t,{defaultUrl:"",dataSourceConfig:t,showAccessOptions:!0,onChange:s,sigV4AuthToggleEnabled:S.$W.sigV4AuthEnabled,renderSigV4Editor:(0,e.jsx)(v._r,{...l}),secureSocksDSProxyEnabled:!1})]})};var I=a(62467),M=a(75505),m=a(28082),O=a(8562),z=a(4013);class P extends h.mA{constructor(t){super(t),this.instanceSettings=t}query(){return(0,I.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,M.s)((0,m.AI)().fetch(s))}async testDatasource(){let t;const s=this.instanceSettings.url,n=s?await(0,O.O5)(s):{lazyConfigInit:!1};if(this.instanceSettings.jsonData.implementation===o.Oz.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(i){if((0,m.NF)(i)&&n.lazyConfigInit&&(0,z.CZ)(i)?.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 E=new h.tD(P).setConfigEditor(D)},48191:(u,r,a)=>{a.r(r)}}]);

//# sourceMappingURL=alertmanagerPlugin.d618a3d06f0d39ba04d1.js.map