Skip to content

Commit 2d1678e

Browse files
committed
Add Docker
* Add Dockerfile and prometheuscommunity. * Add promehteus common Version handler. * Update README. Signed-off-by: Ben Kochie <superq@gmail.com>
1 parent c483776 commit 2d1678e

File tree

5 files changed

+36
-9
lines changed

5 files changed

+36
-9
lines changed

Dockerfile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ARG ARCH="amd64"
2+
ARG OS="linux"
3+
FROM quay.io/prometheus/busybox-${OS}-${ARCH}:glibc
4+
LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"
5+
6+
ARG ARCH="amd64"
7+
ARG OS="linux"
8+
COPY .build/${OS}-${ARCH}/json_exporter /bin/json_exporter
9+
10+
EXPOSE 7979
11+
USER nobody
12+
ENTRYPOINT [ "/bin/bind_exporter" ]

Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ all::
33

44
# Needs to be defined before including Makefile.common to auto-generate targets
55
DOCKER_ARCHS ?= amd64 armv7 arm64 ppc64le
6+
DOCKER_REPO ?= prometheuscommunity
67

78
include Makefile.common
89

README.md

+17-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
json_exporter
22
========================
3+
[![CircleCI](https://circleci.com/gh/prometheus-community/json_exporter.svg?style=svg)](https://circleci.com/gh/prometheus-community/json_exporter)
34

45
A [prometheus](https://prometheus.io/) exporter which scrapes remote JSON by JSONPath.
56

6-
Build
7-
=====
7+
# Build
8+
89
```sh
9-
./gow get .
10-
./gow build -o json_exporter .
10+
make build
1111
```
1212

13-
Example Usage
14-
=============
13+
# Example Usage
14+
1515
```sh
1616
$ cat example/data.json
1717
{
@@ -68,7 +68,16 @@ example_value_count{environment="beta",id="id-A"} 1
6868
example_value_count{environment="beta",id="id-C"} 3
6969
```
7070

71-
See Also
72-
========
71+
# Docker
72+
73+
```console
74+
docker run \
75+
-v config.yml:/config.yml
76+
json_exporter \
77+
http://example.com/target.json \
78+
/config.yml
79+
```
80+
81+
# See Also
7382
- [kawamuray/jsonpath](https://github.com/kawamuray/jsonpath#path-syntax) : For syntax reference of JSONPath.
7483
Originally forked from nicksardo/jsonpath(now is https://github.com/NodePrime/jsonpath).

go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ require (
88
github.com/kawamuray/jsonpath v0.0.0-20160208140654-5c448ebf9735
99
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
1010
github.com/prometheus/client_golang v1.5.1
11+
github.com/prometheus/common v0.9.1
1112
github.com/prometheus/procfs v0.0.11 // indirect
1213
github.com/sirupsen/logrus v1.5.0
1314
github.com/urfave/cli v1.22.4

jsonexporter/version.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@
1313

1414
package jsonexporter
1515

16-
const Version = "0.0.2"
16+
import (
17+
"github.com/prometheus/common/version"
18+
)
19+
20+
var Version = version.Version

0 commit comments

Comments
 (0)