Add Docker

* Add Dockerfile and prometheuscommunity.
* Add promehteus common Version handler.
* Update README.

Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
Ben Kochie 2020-04-17 10:06:54 +02:00
parent c483776514
commit 2d1678ed95
No known key found for this signature in database
GPG Key ID: C646B23C9E3245F1
5 changed files with 36 additions and 9 deletions

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
ARG ARCH="amd64"
ARG OS="linux"
FROM quay.io/prometheus/busybox-${OS}-${ARCH}:glibc
LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"
ARG ARCH="amd64"
ARG OS="linux"
COPY .build/${OS}-${ARCH}/json_exporter /bin/json_exporter
EXPOSE 7979
USER nobody
ENTRYPOINT [ "/bin/bind_exporter" ]

View File

@ -3,6 +3,7 @@ all::
# Needs to be defined before including Makefile.common to auto-generate targets
DOCKER_ARCHS ?= amd64 armv7 arm64 ppc64le
DOCKER_REPO ?= prometheuscommunity
include Makefile.common

View File

@ -1,17 +1,17 @@
json_exporter
========================
[![CircleCI](https://circleci.com/gh/prometheus-community/json_exporter.svg?style=svg)](https://circleci.com/gh/prometheus-community/json_exporter)
A [prometheus](https://prometheus.io/) exporter which scrapes remote JSON by JSONPath.
Build
=====
# Build
```sh
./gow get .
./gow build -o json_exporter .
make build
```
Example Usage
=============
# Example Usage
```sh
$ cat example/data.json
{
@ -68,7 +68,16 @@ example_value_count{environment="beta",id="id-A"} 1
example_value_count{environment="beta",id="id-C"} 3
```
See Also
========
# Docker
```console
docker run \
-v config.yml:/config.yml
json_exporter \
http://example.com/target.json \
/config.yml
```
# See Also
- [kawamuray/jsonpath](https://github.com/kawamuray/jsonpath#path-syntax) : For syntax reference of JSONPath.
Originally forked from nicksardo/jsonpath(now is https://github.com/NodePrime/jsonpath).

1
go.mod
View File

@ -8,6 +8,7 @@ require (
github.com/kawamuray/jsonpath v0.0.0-20160208140654-5c448ebf9735
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/prometheus/client_golang v1.5.1
github.com/prometheus/common v0.9.1
github.com/prometheus/procfs v0.0.11 // indirect
github.com/sirupsen/logrus v1.5.0
github.com/urfave/cli v1.22.4

View File

@ -13,4 +13,8 @@
package jsonexporter
const Version = "0.0.2"
import (
"github.com/prometheus/common/version"
)
var Version = version.Version