Alertmanager Datasource Go SDK

Constructor#

import "github.com/perses/plugins/alertmanager/sdk/go/datasource"

var options []datasource.Option
datasource.AlertManager(options...)

Need a list of options. At least direct URL or proxy URL, in order to work.

Default options#

  • None

Available options#

Direct URL#

import "github.com/perses/plugins/alertmanager/sdk/go/datasource"

datasource.DirectURL("http://alertmanager.example.com:9093")

Set Alertmanager plugin for the datasource with a direct URL.

Proxy#

import "github.com/perses/plugins/alertmanager/sdk/go/datasource"

datasource.HTTPProxy("https://current-domain-name.io", httpProxyOptions...)

Set Alertmanager plugin for the datasource with a proxy URL. More info at HTTP Proxy.

Example#

package main

import (
	"github.com/perses/perses/go-sdk/dashboard"

	amDs "github.com/perses/plugins/alertmanager/sdk/go/datasource"
)

func main() {
	dashboard.New("alertmanager-dashboard",
		dashboard.AddDatasource("alertmanagerMain", amDs.AlertManager(amDs.DirectURL("http://alertmanager.example.com:9093"))),
	)
}