From b7d51bd24272dfd5b70515e5c26b599999295a56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=BDubo=C5=A1=20Hozz=C3=A1n?= Date: Thu, 19 Jan 2023 12:55:57 +0100 Subject: [PATCH] Minor updates - Change main module - Update module `client_golang` (`v1.13.0` -> `v1.14.0`) - Improve documentation --- README.md | 76 ++++++++++++++++++++++++++++++++++++++++--------------- go.mod | 6 ++--- go.sum | 4 +++ 3 files changed, 63 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 6c74bfd..4937cf2 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,65 @@ -Logstash exporter -================= +# Logstash exporter -Prometheus exporter for metrics provided by Node Stats API of Logstash. +Prometheus exporter for metrics provided by [Node Stats API](https://www.elastic.co/guide/en/logstash/current/monitoring-logstash.html) of Logstash. -Building and running --------------------- +## Building - go get gitlab.com/alxrem/prometheus-logstash-exporter - cd ${GOPATH-$HOME/go}/src/gitlab.com/alxrem/prometheus-logstash-exporter - go build - ./prometheus-logstash-exporter +*Golang must be installed on the local machine!* -To see all available configuration flags: +```bash +$ git clone https://github.com/sap-contributions/prometheus-logstash-exporter.git +$ cd prometheus-logstash-exporter +$ CGO_ENABLED=0 go build -o prometheus-logstash-exporter +``` + +## Running - ./prometheus-logstash-exporter -h - -Packages --------- +```bash +./prometheus-logstash-exporter +``` -Binary builds are available on the [releases page of Gitlab project](https://gitlab.com/alxrem/prometheus-logstash-exporter/-/releases). +*If you hold Logstash defaults, the Exporter follow them too.* + +To see all available configuration flags: -Packages for latest Debian and Ubuntu releases are available on -[PackageCloud](https://packagecloud.io/alxrem/prometheus-logstash-exporter/). +```bash +$ ./prometheus-logstash-exporter -h +Usage of ./prometheus-logstash-exporter: + -logstash.host string + Host address of logstash server. (default "localhost") + -logstash.port int + Port of logstash server. (default "9600") + -logstash.timeout duration + Timeout to get stats from logstash server. (default "5s") + -web.listen-address string + Address to listen on for web interface and telemetry. (default ":9304") + -web.telemetry-path string + Path under which to expose metrics. (default "/metrics") +``` -Docker images are available at [Docker Hub](https://hub.docker.com/r/alxrem/prometheus-logstash-exporter/). -Pull the latest version with +In Kubernetes we recommend deploy the Exporter as a sidecar in pod with Logstash. - docker pull alxrem/prometheus-logstash-exporter \ No newline at end of file +E.g.: +```yaml +... +spec: + containers: + - name: logstash + (... setup for logstash ...) + - name: exporter + image: : + args: + - --web.listen-address=:9310 # by default is used port 9304, but feel free adapt this setting + ports: + - containerPort: 9310 + name: metrics + protocol: TCP + resources: + requests: + cpu: "100m" + memory: "16M" + limits: + cpu: "200m" + memory: "32M" +... +``` diff --git a/go.mod b/go.mod index dc8bc1b..02dcd3a 100644 --- a/go.mod +++ b/go.mod @@ -1,15 +1,15 @@ -module gitlab.com/alxrem/prometheus-logstash-exporter +module github.com/sap-contributions/prometheus-logstash-exporter go 1.19 -require github.com/prometheus/client_golang v1.13.0 +require github.com/prometheus/client_golang v1.14.0 require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cespare/xxhash/v2 v2.1.2 // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/prometheus/client_model v0.2.0 // indirect + github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.37.0 // indirect github.com/prometheus/procfs v0.8.0 // indirect golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect diff --git a/go.sum b/go.sum index 01abb3a..fe96f60 100644 --- a/go.sum +++ b/go.sum @@ -164,11 +164,15 @@ github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnY github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= github.com/prometheus/client_golang v1.13.0 h1:b71QUfeo5M8gq2+evJdTPfZhYMAU0uKPkyPJ7TPsloU= github.com/prometheus/client_golang v1.13.0/go.mod h1:vTeo+zgvILHsnnj/39Ou/1fPN5nJFOEMgftOUOmlvYQ= +github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= +github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=