mirror of
				https://github.com/grafana/grafana.git
				synced 2025-02-25 18:55:37 -06:00 
			
		
		
		
	feat(alerting): make it possible to skip ssl verification for alerting https requests
This commit is contained in:
		@@ -141,7 +141,8 @@ var (
 | 
			
		||||
	Quota QuotaSettings
 | 
			
		||||
 | 
			
		||||
	// Alerting
 | 
			
		||||
	AlertingEnabled bool
 | 
			
		||||
	AlertingEnabled           bool
 | 
			
		||||
	AlertingSkipSSLValidation bool
 | 
			
		||||
 | 
			
		||||
	// logger
 | 
			
		||||
	logger log.Logger
 | 
			
		||||
@@ -546,6 +547,7 @@ func NewConfigContext(args *CommandLineArgs) error {
 | 
			
		||||
 | 
			
		||||
	alerting := Cfg.Section("alerting")
 | 
			
		||||
	AlertingEnabled = alerting.Key("enabled").MustBool(false)
 | 
			
		||||
	AlertingSkipSSLValidation = alerting.Key("skip_ssl_validation").MustBool(false)
 | 
			
		||||
 | 
			
		||||
	readSessionConfig()
 | 
			
		||||
	readSmtpSettings()
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
package graphite
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"crypto/tls"
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"io/ioutil"
 | 
			
		||||
@@ -15,10 +16,6 @@ import (
 | 
			
		||||
	"github.com/grafana/grafana/pkg/tsdb"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	HttpClient = http.Client{Timeout: time.Duration(10 * time.Second)}
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type GraphiteExecutor struct {
 | 
			
		||||
	*tsdb.DataSourceInfo
 | 
			
		||||
}
 | 
			
		||||
@@ -27,11 +24,23 @@ func NewGraphiteExecutor(dsInfo *tsdb.DataSourceInfo) tsdb.Executor {
 | 
			
		||||
	return &GraphiteExecutor{dsInfo}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var glog log.Logger
 | 
			
		||||
var (
 | 
			
		||||
	glog       log.Logger
 | 
			
		||||
	HttpClient http.Client
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func init() {
 | 
			
		||||
	glog = log.New("tsdb.graphite")
 | 
			
		||||
	tsdb.RegisterExecutor("graphite", NewGraphiteExecutor)
 | 
			
		||||
 | 
			
		||||
	tr := &http.Transport{
 | 
			
		||||
		TLSClientConfig: &tls.Config{InsecureSkipVerify: setting.AlertingSkipSSLValidation},
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	HttpClient = http.Client{
 | 
			
		||||
		Timeout:   time.Duration(10 * time.Second),
 | 
			
		||||
		Transport: tr,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (e *GraphiteExecutor) Execute(queries tsdb.QuerySlice, context *tsdb.QueryContext) *tsdb.BatchResult {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user