pax_global_header00006660000000000000000000000064135575776350014541gustar00rootroot0000000000000052 comment=ca2bb38d121dbff38f62f10f3470b2bb260d2a78 prometheus-apache-exporter-0.7.0+ds/000077500000000000000000000000001355757763500174275ustar00rootroot00000000000000prometheus-apache-exporter-0.7.0+ds/.circleci/000077500000000000000000000000001355757763500212625ustar00rootroot00000000000000prometheus-apache-exporter-0.7.0+ds/.circleci/config.yml000066400000000000000000000065121355757763500232560ustar00rootroot00000000000000--- version: 2.1 jobs: test: docker: - image: circleci/golang:1.10 working_directory: /go/src/github.com/Lusitaniae/apache_exporter steps: - checkout - setup_remote_docker - run: make promu - run: make - run: rm -f apache_exporter build: machine: true working_directory: /home/circleci/.go_workspace/src/github.com/Lusitaniae/apache_exporter steps: - checkout - run: make promu - run: promu crossbuild -v - persist_to_workspace: root: . paths: - .build docker_hub_master: docker: - image: circleci/golang:1.10 working_directory: /go/src/github.com/Lusitaniae/apache_exporter environment: DOCKER_IMAGE_NAME: lusotycoon/apache-exporter QUAY_IMAGE_NAME: quay.io/lusitaniae/apache-exporter steps: - checkout - setup_remote_docker - attach_workspace: at: . - run: ln -s .build/linux-amd64/apache_exporter apache_exporter - run: make docker DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME - run: make docker DOCKER_IMAGE_NAME=$QUAY_IMAGE_NAME - run: docker images - run: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD - run: docker login -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io - run: docker push $DOCKER_IMAGE_NAME - run: docker push $QUAY_IMAGE_NAME docker_hub_release_tags: docker: - image: circleci/golang:1.10 working_directory: /go/src/github.com/Lusitaniae/apache_exporter environment: DOCKER_IMAGE_NAME: lusotycoon/apache-exporter QUAY_IMAGE_NAME: quay.io/lusitaniae/apache-exporter steps: - checkout - setup_remote_docker - run: mkdir -v -p ${HOME}/bin - run: curl -L 'https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2' | tar xvjf - --strip-components 3 -C ${HOME}/bin - run: echo 'export PATH=${HOME}/bin:${PATH}' >> ${BASH_ENV} - attach_workspace: at: . - run: make promu - run: promu crossbuild tarballs - run: promu checksum .tarballs - run: promu release .tarballs - store_artifacts: path: .tarballs destination: releases - run: ln -s .build/linux-amd64/apache_exporter apache_exporter - run: make docker DOCKER_IMAGE_NAME=$DOCKER_IMAGE_NAME DOCKER_IMAGE_TAG=$CIRCLE_TAG - run: make docker DOCKER_IMAGE_NAME=$QUAY_IMAGE_NAME DOCKER_IMAGE_TAG=$CIRCLE_TAG - run: docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD - run: docker login -u $QUAY_LOGIN -p $QUAY_PASSWORD quay.io - run: | if [[ "$CIRCLE_TAG" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then docker tag "$DOCKER_IMAGE_NAME:$CIRCLE_TAG" "$DOCKER_IMAGE_NAME:latest" docker tag "$QUAY_IMAGE_NAME:$CIRCLE_TAG" "$QUAY_IMAGE_NAME:latest" fi - run: docker push $DOCKER_IMAGE_NAME - run: docker push $QUAY_IMAGE_NAME workflows: version: 2 apache_exporter: jobs: - test: filters: tags: only: /.*/ - build: filters: tags: only: /.*/ - docker_hub_master: requires: - test - build filters: branches: only: master - docker_hub_release_tags: requires: - test - build filters: tags: only: /^v[0-9]+(\.[0-9]+){2}(-.+|[^-.]*)$/ branches: ignore: /.*/ prometheus-apache-exporter-0.7.0+ds/.promu.yml000066400000000000000000000011501355757763500213670ustar00rootroot00000000000000repository: path: github.com/Lusitaniae/apache_exporter build: flags: -a -tags netgo ldflags: | -X {{repoPath}}/vendor/github.com/prometheus/common/version.Version={{.Version}} -X {{repoPath}}/vendor/github.com/prometheus/common/version.Revision={{.Revision}} -X {{repoPath}}/vendor/github.com/prometheus/common/version.Branch={{.Branch}} -X {{repoPath}}/vendor/github.com/prometheus/common/version.BuildUser={{user}}@{{host}} -X {{repoPath}}/vendor/github.com/prometheus/common/version.BuildDate={{date "20060102-15:04:05"}} tarball: files: - LICENSE prometheus-apache-exporter-0.7.0+ds/Dockerfile000066400000000000000000000002071355757763500214200ustar00rootroot00000000000000FROM quay.io/prometheus/busybox:latest COPY apache_exporter /bin/apache_exporter ENTRYPOINT ["/bin/apache_exporter"] EXPOSE 9117 prometheus-apache-exporter-0.7.0+ds/LICENSE000066400000000000000000000020631355757763500204350ustar00rootroot00000000000000The MIT License (MIT) Copyright (c) 2015 neezgee Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. prometheus-apache-exporter-0.7.0+ds/Makefile000066400000000000000000000033071355757763500210720ustar00rootroot00000000000000# Copyright 2015 The Prometheus Authors # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. GO := GO15VENDOREXPERIMENT=1 go PROMU := $(GOPATH)/bin/promu pkgs = $(shell $(GO) list ./... | grep -v /vendor/) PREFIX ?= $(shell pwd) BIN_DIR ?= $(shell pwd) DOCKER_IMAGE_NAME ?= apache-exporter DOCKER_IMAGE_TAG ?= $(subst /,-,$(shell git rev-parse --abbrev-ref HEAD)) all: format build test test: @echo ">> running tests" @$(GO) test -short $(pkgs) style: @echo ">> checking code style" @! gofmt -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^' format: @echo ">> formatting code" @$(GO) fmt $(pkgs) vet: @echo ">> vetting code" @$(GO) vet $(pkgs) build: promu @echo ">> building binaries" @$(PROMU) build --prefix $(PREFIX) tarball: promu @echo ">> building release tarball" @$(PROMU) tarball --prefix $(PREFIX) $(BIN_DIR) docker: @echo ">> building docker image" @docker build -t "$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)" . promu: @GOOS=$(shell uname -s | tr A-Z a-z) \ GOARCH=$(subst x86_64,amd64,$(patsubst i%86,386,$(shell uname -m))) \ $(GO) get -u github.com/prometheus/promu .PHONY: all style format build test vet tarball docker promu prometheus-apache-exporter-0.7.0+ds/README.md000066400000000000000000000140201355757763500207030ustar00rootroot00000000000000 # Apache Exporter for Prometheus [![Build Status][buildstatus]][circleci] [![GitHub release](https://img.shields.io/github/release/Lusitaniae/apache_exporter.svg)][release] ![GitHub Downloads](https://img.shields.io/github/downloads/Lusitaniae/apache_exporter/total.svg) [![Docker Repository on Quay](https://quay.io/repository/Lusitaniae/apache-exporter/status)][quay] [![Docker Pulls](https://img.shields.io/docker/pulls/lusotycoon/apache-exporter.svg?maxAge=604800)][hub] Exports apache mod_status statistics via HTTP for Prometheus consumption. With working golang environment it can be built with `go get`. There is a [good article](https://machineperson.github.io/monitoring/2016/01/04/exporting-apache-metrics-to-prometheus.html) with build HOWTO and usage example. Help on flags: ``` -insecure Ignore server certificate if using https. (default false) -scrape_uri string URI to apache stub status page. (default "http://localhost/server-status/?auto") -telemetry.address string Address on which to expose metrics. (default ":9117") -telemetry.endpoint string Path under which to expose metrics. (default "/metrics") -version Version of the Apache exporter. ``` Tested on Apache 2.2 and Apache 2.4. If your server-status page is secured by http auth, add the credentials to the scrape URL following this example: ``` http://user:password@localhost/server-status?auto ``` Override host name by runnning ``` ./apache_exporter -host_override=example.com ``` # Using Docker ## Build the compatible binary To make sure that exporter binary created by build job is suitable to run on busybox environment, generate the binary using Makefile definition. Inside project directory run: ``` make ``` *Please be aware that binary generated using `go get` or `go build` with defaults may not work in busybox/alpine base images.* ## Build image Run the following commands from the project root directory. ``` docker build -t apache_exporter . ``` ## Run ``` docker run -d -p 9117:9117 apache_exporter \ -scrape_uri "https://your.server.com/server-status/?auto" ``` ## Collectors Apache metrics: ``` # HELP apache_accesses_total Current total apache accesses (*) # TYPE apache_accesses_total counter # HELP apache_scoreboard Apache scoreboard statuses # TYPE apache_scoreboard gauge # HELP apache_sent_kilobytes_total Current total kbytes sent (*) # TYPE apache_sent_kilobytes_total counter # HELP apache_cpu_load CPU Load (*) # TYPE apache_cpu_load gauge # HELP apache_up Could the apache server be reached # TYPE apache_up gauge # HELP apache_uptime_seconds_total Current uptime in seconds (*) # TYPE apache_uptime_seconds_total counter # HELP apache_workers Apache worker statuses # TYPE apache_workers gauge ``` Exporter process metrics: ``` # HELP http_request_duration_microseconds The HTTP request latencies in microseconds. # TYPE http_request_duration_microseconds summary # HELP http_request_size_bytes The HTTP request sizes in bytes. # TYPE http_request_size_bytes summary # HELP http_response_size_bytes The HTTP response sizes in bytes. # TYPE http_response_size_bytes summary # HELP process_cpu_seconds_total Total user and system CPU time spent in seconds. # TYPE process_cpu_seconds_total counter # HELP process_max_fds Maximum number of open file descriptors. # TYPE process_max_fds gauge # HELP process_open_fds Number of open file descriptors. # TYPE process_open_fds gauge # HELP process_resident_memory_bytes Resident memory size in bytes. # TYPE process_resident_memory_bytes gauge # HELP process_start_time_seconds Start time of the process since unix epoch in seconds. # TYPE process_start_time_seconds gauge # HELP process_virtual_memory_bytes Virtual memory size in bytes. # TYPE process_virtual_memory_bytes gauge ``` Metrics marked '(*)' are only available if ExtendedStatus is On in apache webserver configuration. In version 2.3.6, loading mod_status will toggle ExtendedStatus On by default. ## FAQ Q. Is there a Grafana dashboard for this exporter? A. There's a 3rd party dashboard [here](https://grafana.com/dashboards/3894) which seems to work. Q. Can you add additional metrics such as reqpersec, bytespersec and bytesperreq? A. In line with the [best practices](https://prometheus.io/docs/instrumenting/writing_exporters/#drop-less-useful-statistics), the exporter only provides the totals and you should derive rates using [PromQL](https://prometheus.io/docs/prometheus/latest/querying/basics/). > Like that: > - `ReqPerSec` : `rate(apache_accesses_total[5m])` > - `BytesPerSec`: `rate(apache_sent_kilobytes_total[5m])` > - `BytesPerReq`: BytesPerSec / ReqPerSec Q. Can I monitor multiple Apache instances? A. In line with the [best practices](https://prometheus.io/docs/instrumenting/writing_exporters/#deployment), the answer is no. *Each process being monitored should be accompanied by **one** exporter*. We suggest automating configuration and deployment using your favorite tools, e.g. Ansible/Chef/Kubernetes. Q. Its not working! Apache_up shows as 0 A. When apache_up reports 0 it means the exporter is running however it is not able to connect to Apache. Do you have this (or similar) configuration uncommented in your Apache instance? ``` SetHandler server-status Require host example.com ``` As documented at https://httpd.apache.org/docs/2.4/mod/mod_status.html Are you able to see the stats, if you run this from the Apache instance? `curl localhost/server-status?auto` If you run the exporter manually, do you see any errors? `./apache_exporter` Please include all this information if you still have issues when creating an issue. ## Author The exporter was originally created by [neezgee](https://github.com/neezgee). [buildstatus]: https://circleci.com/gh/Lusitaniae/apache_exporter/tree/master.svg?style=shield [quay]: https://quay.io/repository/Lusitaniae/apache-exporter [circleci]: https://circleci.com/gh/Lusitaniae/apache_exporter [hub]: https://hub.docker.com/r/lusotycoon/apache-exporter/ [release]: https://github.com/Lusitaniae/apache_exporter/releases/latest prometheus-apache-exporter-0.7.0+ds/VERSION000066400000000000000000000000061355757763500204730ustar00rootroot000000000000000.7.0 prometheus-apache-exporter-0.7.0+ds/apache_exporter.go000066400000000000000000000212611355757763500231310ustar00rootroot00000000000000package main import ( "crypto/tls" "flag" "fmt" "io/ioutil" "net/http" "os" "strconv" "strings" "sync" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/prometheus/common/log" "github.com/prometheus/common/version" "os/signal" "syscall" "time" ) const ( namespace = "apache" // For Prometheus metrics. ) var ( listeningAddress = flag.String("telemetry.address", ":9117", "Address on which to expose metrics.") metricsEndpoint = flag.String("telemetry.endpoint", "/metrics", "Path under which to expose metrics.") scrapeURI = flag.String("scrape_uri", "http://localhost/server-status/?auto", "URI to apache stub status page.") hostOverride = flag.String("host_override", "", "Override for HTTP Host header; empty string for no override.") insecure = flag.Bool("insecure", false, "Ignore server certificate if using https.") showVersion = flag.Bool("version", false, "Print version information.") gracefulStop = make(chan os.Signal) ) type Exporter struct { URI string mutex sync.Mutex client *http.Client up *prometheus.Desc scrapeFailures prometheus.Counter accessesTotal *prometheus.Desc kBytesTotal *prometheus.Desc cpuload prometheus.Gauge uptime *prometheus.Desc workers *prometheus.GaugeVec scoreboard *prometheus.GaugeVec connections *prometheus.GaugeVec } func NewExporter(uri string) *Exporter { return &Exporter{ URI: uri, up: prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "up"), "Could the apache server be reached", nil, nil), scrapeFailures: prometheus.NewCounter(prometheus.CounterOpts{ Namespace: namespace, Name: "exporter_scrape_failures_total", Help: "Number of errors while scraping apache.", }), accessesTotal: prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "accesses_total"), "Current total apache accesses (*)", nil, nil), kBytesTotal: prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "sent_kilobytes_total"), "Current total kbytes sent (*)", nil, nil), cpuload: prometheus.NewGauge(prometheus.GaugeOpts{ Namespace: namespace, Name: "cpuload", Help: "The current percentage CPU used by each worker and in total by all workers combined (*)", }), uptime: prometheus.NewDesc( prometheus.BuildFQName(namespace, "", "uptime_seconds_total"), "Current uptime in seconds (*)", nil, nil), workers: prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: namespace, Name: "workers", Help: "Apache worker statuses", }, []string{"state"}, ), scoreboard: prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: namespace, Name: "scoreboard", Help: "Apache scoreboard statuses", }, []string{"state"}, ), connections: prometheus.NewGaugeVec(prometheus.GaugeOpts{ Namespace: namespace, Name: "connections", Help: "Apache connection statuses", }, []string{"state"}, ), client: &http.Client{ Transport: &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: *insecure}, }, }, } } func (e *Exporter) Describe(ch chan<- *prometheus.Desc) { ch <- e.up ch <- e.accessesTotal ch <- e.kBytesTotal ch <- e.uptime e.cpuload.Describe(ch) e.scrapeFailures.Describe(ch) e.workers.Describe(ch) e.scoreboard.Describe(ch) e.connections.Describe(ch) } // Split colon separated string into two fields func splitkv(s string) (string, string) { if len(s) == 0 { return s, s } slice := strings.SplitN(s, ":", 2) if len(slice) == 1 { return slice[0], "" } return strings.TrimSpace(slice[0]), strings.TrimSpace(slice[1]) } var scoreboardLabelMap = map[string]string{ "_": "idle", "S": "startup", "R": "read", "W": "reply", "K": "keepalive", "D": "dns", "C": "closing", "L": "logging", "G": "graceful_stop", "I": "idle_cleanup", ".": "open_slot", } func (e *Exporter) updateScoreboard(scoreboard string) { e.scoreboard.Reset() for _, v := range scoreboardLabelMap { e.scoreboard.WithLabelValues(v) } for _, worker_status := range scoreboard { s := string(worker_status) label, ok := scoreboardLabelMap[s] if !ok { label = s } e.scoreboard.WithLabelValues(label).Inc() } } func (e *Exporter) collect(ch chan<- prometheus.Metric) error { req, err := http.NewRequest("GET", e.URI, nil) if *hostOverride != "" { req.Host = *hostOverride } if err != nil { return fmt.Errorf("Error building scraping request: %v", err) } resp, err := e.client.Do(req) if err != nil { ch <- prometheus.MustNewConstMetric(e.up, prometheus.GaugeValue, 0) return fmt.Errorf("Error scraping apache: %v", err) } ch <- prometheus.MustNewConstMetric(e.up, prometheus.GaugeValue, 1) data, err := ioutil.ReadAll(resp.Body) resp.Body.Close() if resp.StatusCode != 200 { if err != nil { data = []byte(err.Error()) } return fmt.Errorf("Status %s (%d): %s", resp.Status, resp.StatusCode, data) } lines := strings.Split(string(data), "\n") connectionInfo := false for _, l := range lines { key, v := splitkv(l) if err != nil { continue } switch { case key == "Total Accesses": val, err := strconv.ParseFloat(v, 64) if err != nil { return err } ch <- prometheus.MustNewConstMetric(e.accessesTotal, prometheus.CounterValue, val) case key == "Total kBytes": val, err := strconv.ParseFloat(v, 64) if err != nil { return err } ch <- prometheus.MustNewConstMetric(e.kBytesTotal, prometheus.CounterValue, val) case key == "CPULoad": val, err := strconv.ParseFloat(v, 64) if err != nil { return err } e.cpuload.Set(val) case key == "Uptime": val, err := strconv.ParseFloat(v, 64) if err != nil { return err } ch <- prometheus.MustNewConstMetric(e.uptime, prometheus.CounterValue, val) case key == "BusyWorkers": val, err := strconv.ParseFloat(v, 64) if err != nil { return err } e.workers.WithLabelValues("busy").Set(val) case key == "IdleWorkers": val, err := strconv.ParseFloat(v, 64) if err != nil { return err } e.workers.WithLabelValues("idle").Set(val) case key == "Scoreboard": e.updateScoreboard(v) e.scoreboard.Collect(ch) case key == "ConnsTotal": val, err := strconv.ParseFloat(v, 64) if err != nil { return err } e.connections.WithLabelValues("total").Set(val) connectionInfo = true case key == "ConnsAsyncWriting": val, err := strconv.ParseFloat(v, 64) if err != nil { return err } e.connections.WithLabelValues("writing").Set(val) connectionInfo = true case key == "ConnsAsyncKeepAlive": val, err := strconv.ParseFloat(v, 64) if err != nil { return err } e.connections.WithLabelValues("keepalive").Set(val) connectionInfo = true case key == "ConnsAsyncClosing": val, err := strconv.ParseFloat(v, 64) if err != nil { return err } e.connections.WithLabelValues("closing").Set(val) connectionInfo = true } } e.cpuload.Collect(ch) e.workers.Collect(ch) if connectionInfo { e.connections.Collect(ch) } return nil } func (e *Exporter) Collect(ch chan<- prometheus.Metric) { e.mutex.Lock() // To protect metrics from concurrent collects. defer e.mutex.Unlock() if err := e.collect(ch); err != nil { log.Errorf("Error scraping apache: %s", err) e.scrapeFailures.Inc() e.scrapeFailures.Collect(ch) } return } func main() { flag.Parse() // listen to termination signals from the OS signal.Notify(gracefulStop, syscall.SIGTERM) signal.Notify(gracefulStop, syscall.SIGINT) signal.Notify(gracefulStop, syscall.SIGHUP) signal.Notify(gracefulStop, syscall.SIGQUIT) if *showVersion { fmt.Fprintln(os.Stdout, version.Print("apache_exporter")) os.Exit(0) } exporter := NewExporter(*scrapeURI) prometheus.MustRegister(exporter) prometheus.MustRegister(version.NewCollector("apache_exporter")) log.Infoln("Starting apache_exporter", version.Info()) log.Infoln("Build context", version.BuildContext()) log.Infof("Starting Server: %s", *listeningAddress) // listener for the termination signals from the OS go func() { log.Infof("listening and wait for graceful stop") sig := <-gracefulStop log.Infof("caught sig: %+v. Wait 2 seconds...", sig) time.Sleep(2 * time.Second) log.Infof("Terminate apache-exporter on port: %s", *listeningAddress) os.Exit(0) }() http.Handle(*metricsEndpoint, promhttp.Handler()) http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(` Apache Exporter

Apache Exporter

Metrics

`)) }) log.Fatal(http.ListenAndServe(*listeningAddress, nil)) } prometheus-apache-exporter-0.7.0+ds/apache_exporter_test.go000066400000000000000000000065671355757763500242040ustar00rootroot00000000000000package main import ( "net/http" "net/http/httptest" "testing" "github.com/prometheus/client_golang/prometheus" ) const ( apache24Status = `localhost ServerVersion: Apache/2.4.23 (Unix) ServerMPM: event Server Built: Jul 29 2016 04:26:14 CurrentTime: Friday, 29-Jul-2016 14:06:15 UTC RestartTime: Friday, 29-Jul-2016 13:58:49 UTC ParentServerConfigGeneration: 1 ParentServerMPMGeneration: 0 ServerUptimeSeconds: 445 ServerUptime: 7 minutes 25 seconds Load1: 0.02 Load5: 0.02 Load15: 0.00 Total Accesses: 131 Total kBytes: 138 CPUUser: .25 CPUSystem: .15 CPUChildrenUser: 0 CPUChildrenSystem: 0 CPULoad: .0898876 Uptime: 445 ReqPerSec: .294382 BytesPerSec: 317.555 BytesPerReq: 1078.72 BusyWorkers: 1 IdleWorkers: 74 ConnsTotal: 0 ConnsAsyncWriting: 0 ConnsAsyncKeepAlive: 0 ConnsAsyncClosing: 0 Scoreboard: _W___ ` apache24WorkerStatus = `localhost ServerVersion: Apache/2.4.23 (Unix) OpenSSL/1.0.2h ServerMPM: worker Server Built: Aug 31 2016 10:54:08 CurrentTime: Thursday, 08-Sep-2016 15:09:32 CEST RestartTime: Thursday, 08-Sep-2016 15:08:07 CEST ParentServerConfigGeneration: 1 ParentServerMPMGeneration: 0 ServerUptimeSeconds: 85 ServerUptime: 1 minute 25 seconds Load1: 0.00 Load5: 0.01 Load15: 0.05 Total Accesses: 10 Total kBytes: 38 CPUUser: .05 CPUSystem: 0 CPUChildrenUser: 0 CPUChildrenSystem: 0 CPULoad: .0588235 Uptime: 85 ReqPerSec: .117647 BytesPerSec: 457.788 BytesPerReq: 3891.2 BusyWorkers: 2 IdleWorkers: 48 Scoreboard: _____R_______________________K____________________.................................................................................................... TLSSessionCacheStatus CacheType: SHMCB CacheSharedMemory: 512000 CacheCurrentEntries: 0 CacheSubcaches: 32 CacheIndexesPerSubcaches: 88 CacheIndexUsage: 0% CacheUsage: 0% CacheStoreCount: 0 CacheReplaceCount: 0 CacheExpireCount: 0 CacheDiscardCount: 0 CacheRetrieveHitCount: 0 CacheRetrieveMissCount: 1 CacheRemoveHitCount: 0 CacheRemoveMissCount: 0 ` apache22Status = `Total Accesses: 302311 Total kBytes: 1677830 CPULoad: 27.4052 Uptime: 45683 ReqPerSec: 6.61758 BytesPerSec: 37609.1 BytesPerReq: 5683.21 BusyWorkers: 2 IdleWorkers: 8 Scoreboard: _W_______K...................................................................................................................................................................................................................................................... ` metricCountApache22 = 18 metricCountApache24 = 22 metricCountApache24Worker = 18 ) func checkApacheStatus(t *testing.T, status string, metricCount int) { handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(status)) }) server := httptest.NewServer(handler) e := NewExporter(server.URL) ch := make(chan prometheus.Metric) go func() { defer close(ch) e.Collect(ch) }() for i := 1; i <= metricCount; i++ { m := <-ch if m == nil { t.Error("expected metric but got nil") } } extraMetrics := 0 for <-ch != nil { extraMetrics++ } if extraMetrics > 0 { t.Errorf("expected closed channel, got %d extra metrics", extraMetrics) } } func TestApache22Status(t *testing.T) { checkApacheStatus(t, apache22Status, metricCountApache22) } func TestApache24Status(t *testing.T) { checkApacheStatus(t, apache24Status, metricCountApache24) } func TestApache24WorkerStatus(t *testing.T) { checkApacheStatus(t, apache24WorkerStatus, metricCountApache24Worker) } prometheus-apache-exporter-0.7.0+ds/vendor/000077500000000000000000000000001355757763500207245ustar00rootroot00000000000000prometheus-apache-exporter-0.7.0+ds/vendor/vendor.json000066400000000000000000000115531355757763500231210ustar00rootroot00000000000000{ "comment": "", "ignore": "test", "package": [ { "checksumSHA1": "KmjnydoAbofMieIWm+it5OWERaM=", "path": "github.com/alecthomas/template", "revision": "a0175ee3bccc567396460bf5acd36800cb10c49c", "revisionTime": "2016-04-05T07:15:01Z" }, { "checksumSHA1": "3wt0pTXXeS+S93unwhGoLIyGX/Q=", "path": "github.com/alecthomas/template/parse", "revision": "a0175ee3bccc567396460bf5acd36800cb10c49c", "revisionTime": "2016-04-05T07:15:01Z" }, { "checksumSHA1": "fCc3grA7vIxfBru7R3SqjcW+oLI=", "path": "github.com/alecthomas/units", "revision": "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a", "revisionTime": "2015-10-22T06:55:26Z" }, { "checksumSHA1": "spyv5/YFBjYyZLZa1U2LBfDR8PM=", "path": "github.com/beorn7/perks/quantile", "revision": "4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9", "revisionTime": "2016-08-04T10:47:26Z" }, { "checksumSHA1": "yqF125xVSkmfLpIVGrLlfE05IUk=", "path": "github.com/golang/protobuf/proto", "revision": "130e6b02ab059e7b717a096f397c5b60111cae74", "revisionTime": "2017-09-20T22:06:47Z" }, { "checksumSHA1": "bKMZjd2wPw13VwoE7mBeSv5djFA=", "path": "github.com/matttproud/golang_protobuf_extensions/pbutil", "revision": "c12348ce28de40eed0136aa2b644d0ee0650e56c", "revisionTime": "2016-04-24T11:30:07Z" }, { "checksumSHA1": "ty3Y0hPtRphsqcykY9ihV6F02Fk=", "path": "github.com/prometheus/client_golang/prometheus", "revision": "353b8c3f3776541879f9abfd8fa8b1ae162ab394", "revisionTime": "2017-09-21T10:55:43Z" }, { "checksumSHA1": "wsAkYlRRUNx+OAuUOIqdjO7dICM=", "path": "github.com/prometheus/client_golang/prometheus/promhttp", "revision": "353b8c3f3776541879f9abfd8fa8b1ae162ab394", "revisionTime": "2017-09-21T10:55:43Z" }, { "checksumSHA1": "DvwvOlPNAgRntBzt3b3OSRMS2N4=", "path": "github.com/prometheus/client_model/go", "revision": "6f3806018612930941127f2a7c6c453ba2c527d2", "revisionTime": "2017-02-16T18:52:47Z" }, { "checksumSHA1": "xfnn0THnqNwjwimeTClsxahYrIo=", "path": "github.com/prometheus/common/expfmt", "revision": "2f17f4a9d485bf34b4bfaccc273805040e4f86c8", "revisionTime": "2017-09-08T16:18:22Z" }, { "checksumSHA1": "GWlM3d2vPYyNATtTFgftS10/A9w=", "path": "github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg", "revision": "2f17f4a9d485bf34b4bfaccc273805040e4f86c8", "revisionTime": "2017-09-08T16:18:22Z" }, { "checksumSHA1": "jYpLEs+wZ5LZubvOJEDSQ8I14MI=", "path": "github.com/prometheus/common/log", "revision": "2f17f4a9d485bf34b4bfaccc273805040e4f86c8", "revisionTime": "2017-09-08T16:18:22Z" }, { "checksumSHA1": "3VoqH7TFfzA6Ds0zFzIbKCUvBmw=", "path": "github.com/prometheus/common/model", "revision": "2f17f4a9d485bf34b4bfaccc273805040e4f86c8", "revisionTime": "2017-09-08T16:18:22Z" }, { "checksumSHA1": "91KYK0SpvkaMJJA2+BcxbVnyRO0=", "path": "github.com/prometheus/common/version", "revision": "2f17f4a9d485bf34b4bfaccc273805040e4f86c8", "revisionTime": "2017-09-08T16:18:22Z" }, { "checksumSHA1": "ihxJIjxtbEYdQKwA0D0nRipj95I=", "path": "github.com/prometheus/procfs", "revision": "e645f4e5aaa8506fc71d6edbc5c4ff02c04c46f2", "revisionTime": "2017-07-03T10:12:42Z" }, { "checksumSHA1": "xCiFAAwVTrjsfZT1BIJQ3DgeNCY=", "path": "github.com/prometheus/procfs/xfs", "revision": "e645f4e5aaa8506fc71d6edbc5c4ff02c04c46f2", "revisionTime": "2017-07-03T10:12:42Z" }, { "checksumSHA1": "BYvROBsiyAXK4sq6yhDe8RgT4LM=", "path": "github.com/sirupsen/logrus", "revision": "89742aefa4b206dcf400792f3bd35b542998eb3b", "revisionTime": "2017-08-22T13:27:46Z" }, { "checksumSHA1": "nqWNlnMmVpt628zzvyo6Yv2CX5Q=", "path": "golang.org/x/crypto/ssh/terminal", "revision": "9419663f5a44be8b34ca85f08abc5fe1be11f8a3", "revisionTime": "2017-09-30T17:45:11Z" }, { "checksumSHA1": "tY+5thYxjKDUQyQXYcBqogmMS5U=", "path": "golang.org/x/sys/unix", "revision": "314a259e304ff91bd6985da2a7149bbf91237993", "revisionTime": "2017-07-19T03:44:26Z" }, { "checksumSHA1": "pBPFzDGt3AVSRffB7ffiUnruFUk=", "path": "golang.org/x/sys/windows", "revision": "314a259e304ff91bd6985da2a7149bbf91237993", "revisionTime": "2017-07-19T03:44:26Z" }, { "checksumSHA1": "ZdFZFaXmCgEEaEhVPkyXrnhKhsg=", "path": "golang.org/x/sys/windows/registry", "revision": "314a259e304ff91bd6985da2a7149bbf91237993", "revisionTime": "2017-07-19T03:44:26Z" }, { "checksumSHA1": "uVlUSSKplihZG7N+QJ6fzDZ4Kh8=", "path": "golang.org/x/sys/windows/svc/eventlog", "revision": "314a259e304ff91bd6985da2a7149bbf91237993", "revisionTime": "2017-07-19T03:44:26Z" }, { "checksumSHA1": "3SZTatHIy9OTKc95YlVfXKnoySg=", "path": "gopkg.in/alecthomas/kingpin.v2", "revision": "1087e65c9441605df944fb12c33f0fe7072d18ca", "revisionTime": "2017-07-27T04:22:29Z" } ], "rootPath": "github.com/Lusitaniae/apache_exporter" }