diff --git a/conf/defaults.ini b/conf/defaults.ini index 7ae0c5ebfd9..358847724ab 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -402,9 +402,10 @@ global_session = -1 #################################### Alerting ############################ [alerting] -# Makes it possible to turn off alert rule execution. +# Disable alerting engine & UI features +enabled = true +# Makes it possible to turn off alert rule execution but alerting UI is visible execute_alerts = true -show_alerting_ui = true #################################### Internal Grafana Metrics ############ # Metrics available at HTTP API Url /api/metrics diff --git a/pkg/api/frontendsettings.go b/pkg/api/frontendsettings.go index c4b15ac54b6..3690784375d 100644 --- a/pkg/api/frontendsettings.go +++ b/pkg/api/frontendsettings.go @@ -140,7 +140,7 @@ func getFrontendSettingsMap(c *middleware.Context) (map[string]interface{}, erro "allowOrgCreate": (setting.AllowUserOrgCreate && c.IsSignedIn) || c.IsGrafanaAdmin, "authProxyEnabled": setting.AuthProxyEnabled, "ldapEnabled": setting.LdapEnabled, - "showAlertingUI": setting.ShowAlertingUI, + "alertingEnabled": setting.AlertingEnabled, "buildInfo": map[string]interface{}{ "version": setting.BuildVersion, "commit": setting.BuildCommit, diff --git a/pkg/api/index.go b/pkg/api/index.go index 172f98d4fb2..bf7a9fc1759 100644 --- a/pkg/api/index.go +++ b/pkg/api/index.go @@ -103,7 +103,7 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) { Children: dashboardChildNavs, }) - if setting.ShowAlertingUI && (c.OrgRole == m.ROLE_ADMIN || c.OrgRole == m.ROLE_EDITOR) { + if setting.AlertingEnabled && (c.OrgRole == m.ROLE_ADMIN || c.OrgRole == m.ROLE_EDITOR) { alertChildNavs := []*dtos.NavLink{ {Text: "Alert List", Url: setting.AppSubUrl + "/alerting/list"}, {Text: "Notification channels", Url: setting.AppSubUrl + "/alerting/notifications"}, diff --git a/pkg/cmd/grafana-server/server.go b/pkg/cmd/grafana-server/server.go index 2a4682cbb4b..ccf6f39a1b4 100644 --- a/pkg/cmd/grafana-server/server.go +++ b/pkg/cmd/grafana-server/server.go @@ -59,7 +59,7 @@ func (g *GrafanaServerImpl) Start() { plugins.Init() // init alerting - if setting.ExecuteAlerts { + if setting.AlertingEnabled && setting.ExecuteAlerts { engine := alerting.NewEngine() g.childRoutines.Go(func() error { return engine.Run(g.context) }) } diff --git a/pkg/setting/setting.go b/pkg/setting/setting.go index f84bdd88f48..9c2ba6ee13c 100644 --- a/pkg/setting/setting.go +++ b/pkg/setting/setting.go @@ -150,8 +150,8 @@ var ( Quota QuotaSettings // Alerting + AlertingEnabled bool ExecuteAlerts bool - ShowAlertingUI bool // logger logger log.Logger @@ -579,8 +579,8 @@ func NewConfigContext(args *CommandLineArgs) error { LdapAllowSignup = ldapSec.Key("allow_sign_up").MustBool(true) alerting := Cfg.Section("alerting") + AlertingEnabled = alerting.Key("enabled").MustBool(true) ExecuteAlerts = alerting.Key("execute_alerts").MustBool(true) - ShowAlertingUI = alerting.Key("show_alerting_ui").MustBool(true) readSessionConfig() readSmtpSettings() diff --git a/public/app/plugins/panel/graph/module.ts b/public/app/plugins/panel/graph/module.ts index 99476598bf4..1a8fb3c0481 100644 --- a/public/app/plugins/panel/graph/module.ts +++ b/public/app/plugins/panel/graph/module.ts @@ -132,7 +132,8 @@ class GraphCtrl extends MetricsPanelCtrl { this.addEditorTab('Axes', axesEditorComponent, 2); this.addEditorTab('Legend', 'public/app/plugins/panel/graph/tab_legend.html', 3); this.addEditorTab('Display', 'public/app/plugins/panel/graph/tab_display.html', 4); - if (config.showAlertingUI) { + + if (config.alertingEnabled) { this.addEditorTab('Alert', alertTab, 5); }