Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add nginxexporter_build_info metric #32

Merged
merged 1 commit into from
Jan 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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