Skip to content

Commit

Permalink
Add nginxexporter_build_info metric
Browse files Browse the repository at this point in the history
  • Loading branch information
pleshakov committed Jan 17, 2019
1 parent 4641a69 commit 2f7fe97
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 14 additions & 0 deletions exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 2f7fe97

Please sign in to comment.