diff --git a/main.go b/main.go index 9acfe47d..f7c14f27 100644 --- a/main.go +++ b/main.go @@ -29,6 +29,7 @@ import ( tmpltext "text/template" "time" + "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/log" "github.com/prometheus/common/route" @@ -50,6 +51,24 @@ var ( listenAddress = flag.String("web.listen-address", ":9093", "Address to listen on for the web interface and API.") ) +var ( + configSuccess = prometheus.NewGauge(prometheus.GaugeOpts{ + Namespace: "alertmanager", + Name: "config_last_reload_successful", + Help: "Whether the last configuration reload attempt was successful.", + }) + configSuccessTime = prometheus.NewGauge(prometheus.GaugeOpts{ + Namespace: "alertmanager", + Name: "config_last_reload_success_timestamp_seconds", + Help: "Timestamp of the last successful configuration reload.", + }) +) + +func init() { + prometheus.MustRegister(configSuccess) + prometheus.MustRegister(configSuccessTime) +} + func main() { flag.Parse() @@ -126,6 +145,10 @@ func main() { defer func() { if err != nil { log.With("file", *configFile).Errorf("Loading configuration file failed: %s", err) + configSuccess.Set(0) + } else { + configSuccess.Set(1) + configSuccessTime.Set(float64(time.Now().Unix())) } }() diff --git a/template/internal/deftmpl/bindata.go b/template/internal/deftmpl/bindata.go index c5427e03..0130b31b 100644 --- a/template/internal/deftmpl/bindata.go +++ b/template/internal/deftmpl/bindata.go @@ -182,6 +182,7 @@ type bintree struct { Func func() (*asset, error) Children map[string]*bintree } + var _bintree = &bintree{nil, map[string]*bintree{ "template": &bintree{nil, map[string]*bintree{ "default.tmpl": &bintree{templateDefaultTmpl, map[string]*bintree{}}, @@ -234,4 +235,3 @@ func _filePath(dir, name string) string { cannonicalName := strings.Replace(name, "\\", "/", -1) return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) } - diff --git a/ui/bindata.go b/ui/bindata.go index 47ed7e67..b2751d5b 100644 --- a/ui/bindata.go +++ b/ui/bindata.go @@ -518,25 +518,25 @@ func AssetNames() []string { // _bindata is a table, holding each asset generator, mapped to its name. var _bindata = map[string]func() (*asset, error){ - "ui/app/css/main.css": uiAppCssMainCss, - "ui/app/index.html": uiAppIndexHtml, - "ui/app/js/app.js": uiAppJsAppJs, - "ui/app/partials/alert.html": uiAppPartialsAlertHtml, - "ui/app/partials/alerts.html": uiAppPartialsAlertsHtml, - "ui/app/partials/route.html": uiAppPartialsRouteHtml, + "ui/app/css/main.css": uiAppCssMainCss, + "ui/app/index.html": uiAppIndexHtml, + "ui/app/js/app.js": uiAppJsAppJs, + "ui/app/partials/alert.html": uiAppPartialsAlertHtml, + "ui/app/partials/alerts.html": uiAppPartialsAlertsHtml, + "ui/app/partials/route.html": uiAppPartialsRouteHtml, "ui/app/partials/silence-form.html": uiAppPartialsSilenceFormHtml, - "ui/app/partials/silence.html": uiAppPartialsSilenceHtml, - "ui/app/partials/silences.html": uiAppPartialsSilencesHtml, - "ui/app/partials/status.html": uiAppPartialsStatusHtml, - "ui/bindata.go": uiBindataGo, - "ui/lib/angular-moment.min.js": uiLibAngularMomentMinJs, - "ui/lib/angular-resource.min.js": uiLibAngularResourceMinJs, - "ui/lib/angular-route.min.js": uiLibAngularRouteMinJs, - "ui/lib/angular-sanitize.min.js": uiLibAngularSanitizeMinJs, - "ui/lib/angular.min.js": uiLibAngularMinJs, - "ui/lib/jquery.min.js": uiLibJqueryMinJs, - "ui/lib/kube.min.css": uiLibKubeMinCss, - "ui/lib/moment.min.js": uiLibMomentMinJs, + "ui/app/partials/silence.html": uiAppPartialsSilenceHtml, + "ui/app/partials/silences.html": uiAppPartialsSilencesHtml, + "ui/app/partials/status.html": uiAppPartialsStatusHtml, + "ui/bindata.go": uiBindataGo, + "ui/lib/angular-moment.min.js": uiLibAngularMomentMinJs, + "ui/lib/angular-resource.min.js": uiLibAngularResourceMinJs, + "ui/lib/angular-route.min.js": uiLibAngularRouteMinJs, + "ui/lib/angular-sanitize.min.js": uiLibAngularSanitizeMinJs, + "ui/lib/angular.min.js": uiLibAngularMinJs, + "ui/lib/jquery.min.js": uiLibJqueryMinJs, + "ui/lib/kube.min.css": uiLibKubeMinCss, + "ui/lib/moment.min.js": uiLibMomentMinJs, } // AssetDir returns the file names below a certain @@ -578,6 +578,7 @@ type bintree struct { Func func() (*asset, error) Children map[string]*bintree } + var _bintree = &bintree{nil, map[string]*bintree{ "ui": &bintree{nil, map[string]*bintree{ "app": &bintree{nil, map[string]*bintree{ @@ -589,25 +590,25 @@ var _bintree = &bintree{nil, map[string]*bintree{ "app.js": &bintree{uiAppJsAppJs, map[string]*bintree{}}, }}, "partials": &bintree{nil, map[string]*bintree{ - "alert.html": &bintree{uiAppPartialsAlertHtml, map[string]*bintree{}}, - "alerts.html": &bintree{uiAppPartialsAlertsHtml, map[string]*bintree{}}, - "route.html": &bintree{uiAppPartialsRouteHtml, map[string]*bintree{}}, + "alert.html": &bintree{uiAppPartialsAlertHtml, map[string]*bintree{}}, + "alerts.html": &bintree{uiAppPartialsAlertsHtml, map[string]*bintree{}}, + "route.html": &bintree{uiAppPartialsRouteHtml, map[string]*bintree{}}, "silence-form.html": &bintree{uiAppPartialsSilenceFormHtml, map[string]*bintree{}}, - "silence.html": &bintree{uiAppPartialsSilenceHtml, map[string]*bintree{}}, - "silences.html": &bintree{uiAppPartialsSilencesHtml, map[string]*bintree{}}, - "status.html": &bintree{uiAppPartialsStatusHtml, map[string]*bintree{}}, + "silence.html": &bintree{uiAppPartialsSilenceHtml, map[string]*bintree{}}, + "silences.html": &bintree{uiAppPartialsSilencesHtml, map[string]*bintree{}}, + "status.html": &bintree{uiAppPartialsStatusHtml, map[string]*bintree{}}, }}, }}, "bindata.go": &bintree{uiBindataGo, map[string]*bintree{}}, "lib": &bintree{nil, map[string]*bintree{ - "angular-moment.min.js": &bintree{uiLibAngularMomentMinJs, map[string]*bintree{}}, + "angular-moment.min.js": &bintree{uiLibAngularMomentMinJs, map[string]*bintree{}}, "angular-resource.min.js": &bintree{uiLibAngularResourceMinJs, map[string]*bintree{}}, - "angular-route.min.js": &bintree{uiLibAngularRouteMinJs, map[string]*bintree{}}, + "angular-route.min.js": &bintree{uiLibAngularRouteMinJs, map[string]*bintree{}}, "angular-sanitize.min.js": &bintree{uiLibAngularSanitizeMinJs, map[string]*bintree{}}, - "angular.min.js": &bintree{uiLibAngularMinJs, map[string]*bintree{}}, - "jquery.min.js": &bintree{uiLibJqueryMinJs, map[string]*bintree{}}, - "kube.min.css": &bintree{uiLibKubeMinCss, map[string]*bintree{}}, - "moment.min.js": &bintree{uiLibMomentMinJs, map[string]*bintree{}}, + "angular.min.js": &bintree{uiLibAngularMinJs, map[string]*bintree{}}, + "jquery.min.js": &bintree{uiLibJqueryMinJs, map[string]*bintree{}}, + "kube.min.css": &bintree{uiLibKubeMinCss, map[string]*bintree{}}, + "moment.min.js": &bintree{uiLibMomentMinJs, map[string]*bintree{}}, }}, }}, }} @@ -658,4 +659,3 @@ func _filePath(dir, name string) string { cannonicalName := strings.Replace(name, "\\", "/", -1) return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) } -