diff --git a/README.md b/README.md index 3a813be4..bdd237d3 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,8 @@ Usage of ./nginx-prometheus-exporter: ### Exported Metrics +* Common metrics: + * `nginxexporter_build_info` -- shows the exporter build information. * For NGINX, the following metrics are exported: * All [stub_status](http://nginx.org/en/docs/http/ngx_http_stub_status_module.html) metrics. * `nginx_up` -- shows the status of the last metric scrape: `1` for a successful scrape and `0` for a failed one. diff --git a/exporter.go b/exporter.go index 6d9c853d..29d01e80 100644 --- a/exporter.go +++ b/exporter.go @@ -70,6 +70,20 @@ func main() { registry := prometheus.NewRegistry() + buildInfoMetric := prometheus.NewGauge( + prometheus.GaugeOpts{ + Name: "nginxexporter_build_info", + Help: "Exporter build information", + ConstLabels: prometheus.Labels{ + "version": version, + "gitCommit": gitCommit, + }, + }, + ) + buildInfoMetric.Set(1) + + registry.MustRegister(buildInfoMetric) + httpClient := &http.Client{ Timeout: *timeout, Transport: &http.Transport{