Skip to content

Commit

Permalink
Adjusted docker file and readme for new agent with config file
Browse files Browse the repository at this point in the history
also removed the dev pem file
  • Loading branch information
arrowplum committed Feb 20, 2020
1 parent 212f893 commit c882d0a
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 34 deletions.
34 changes: 31 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
FROM golang:alpine AS builder


ADD . $GOPATH/src/github.com/citrusleaf/aerospike-prometheus-exporter
WORKDIR $GOPATH/src/github.com/citrusleaf/aerospike-prometheus-exporter
RUN apk add git \
RUN apk add git\
&& apk add gettext libintl \
&& go get ./... \
&& go build -o aerospike-prometheus-exporter . \
&& cp aerospike-prometheus-exporter /aerospike-prometheus-exporter


FROM golang:alpine
ENV AGENT_UPDATE_INTERVAL=5\
AGENT_CERT_FILE=""\
AGENT_KEY_FILE=""\
AGENT_TAGS='"agent","aerospike"'\
AGENT_BIND_HOST=""\
AGENT_BIND_PORT=9145\
AGENT_TIMEOUT=10\
AGENT_LOG_LEVEL="info"\
AS_HOST=""\
AS_PORT=3000\
AS_CERT_FILE=""\
AS_KEY_FILE=""\
AS_NODE_TLS_NAME=""\
AS_ROOT_CA=""\
AS_AUTH_MODE=""\
AS_AUTH_USER=""\
TICKER_INTERVAL=5\
TICKER_TIMEOUT=5

RUN apk add gettext libintl
COPY --from=builder /aerospike-prometheus-exporter /usr/bin/aerospike-prometheus-exporter
CMD ["-h localhost", "-p 3000", "-b :9145", "-tags agent,aerospike"]
ENTRYPOINT ["aerospike-prometheus-exporter"]
COPY ape.toml.template /etc/aerospike-prometheus-exporter/ape.toml.template
# you could change the port via env var and then would have to --expose in run.
# That is likely unnecessary though
EXPOSE 9145

CMD cat /etc/aerospike-prometheus-exporter/ape.toml.template && env && envsubst < /etc/aerospike-prometheus-exporter/ape.toml.template > /etc/aerospike-prometheus-exporter/ape.toml && cat /etc/aerospike-prometheus-exporter/ape.toml && aerospike-prometheus-exporter -config /etc/aerospike-prometheus-exporter/ape.toml
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@

This repo contains Aerospike's monitoring agent for Prometheus.

1. Install Go v1.12+, and Docker for your platform.
2. Run `go get github.com/citrusleaf/aerospike-prometheus-exporter` and cd to it via: `cd $GOPATH/src/github.com/citrusleaf/aerospike-prometheus-exporter`
3. `go build -o aerospike-prometheus-exporter . && ./aerospike-prometheus-exporter -config <full path of the config file>` builds and runs the agent.

3.1. for a second agent on the same machine, bind it to a different port: `go build . && ./aerospike-prometheus-exporter -config <full path of the config file>`
4. Edit `docker/prometheus/prometheus.yml` and change the target IPs to aerospike-prometheus-exporter installations.
5. Run `docker-compose up` to download, build and run the docker images. To stop the containers, run `docker-compose down`
6. Go to your browser and use the URL: `http://localhost:3000`. User/Pass is `admin/pass`
7. Prometheus dashboard is at: `http://localhost:9090`

7.1. To make a dashboard your default, first choose that dashboard, and then star it on the toolbar on top right of the screen. After that, you can go to grafana preferences and choose that starred dashboard as default.

1. Install Go v1.12+
1. Run `go get github.com/citrusleaf/aerospike-prometheus-exporter` and cd to it via: `cd $GOPATH/src/github.com/citrusleaf/aerospike-prometheus-exporter`
1. `go build -o aerospike-prometheus-exporter . && ./aerospike-prometheus-exporter -config <full path of the config file>` builds and runs the agent.
Expand All @@ -34,7 +22,7 @@ This repo contains Aerospike's monitoring agent for Prometheus.
```
- Example run
```
docker run -itd --name exporter1 aerospike/aerospike-prometheus-exporter:latest -h 172.17.0.2 -p 3000 -b :9145 -tags agent1,aero_cluster
docker run -itd --name exporter1 aerospike/aerospike-prometheus-exporter:latest -e AS_HOST=172.17.0.2 -e AS_PORT=3000 -e AGENT_TAGS='"agent1","aero_cluster"'
```

Enjoy!
45 changes: 45 additions & 0 deletions ape.toml.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[Agent]
update_interval = ${AGENT_UPDATE_INTERVAL}
# File paths should be double quoted.
# Certificate file for the metric servers for prometheus
cert_file = "${AGENT_CERT_FILE}"
# Key file for the metric servers for prometheus
key_file = "${AGENT_KEY_FILE}"

# tags to append to the prometheus metrics
tags=[${AGENT_TAGS}]

bind_host = "${AGENT_BIND_HOST}"
bind_port = ${AGENT_BIND_PORT}

# metrics server timeout in seconds
timeout = ${AGENT_TIMEOUT}

# debug level can be info|warning,warn|error,err|debug
log_level = "${AGENT_LOG_LEVEL}"

[Aerospike]
db_host="${AS_HOST}"
db_port=${AS_PORT}

# certificate file
cert_file="${AS_CERT_FILE}"
# key file
key_file="${AS_KEY_FILE}"
# node TLS name for authentication
node_tls_name="${AS_NODE_TLS_NAME}"
# root certificate file
root_ca="${AS_ROOT_CA}"

# authentication mode: internal (for server), external (LDAP, etc.)
auth_mode="${AS_AUTH_MODE}"
# database user
user="${AS_AUTH_USER}"
# database password
password="$AS_AUTH_USER"

# ticker interval for requesting stats fro mthe database node
resolution=${TICKER_INTERVAL}

# timeout for sending commands to the server node in seconds
timeout=${TICKER_TIMEOUT}
12 changes: 0 additions & 12 deletions cert.pem

This file was deleted.

6 changes: 0 additions & 6 deletions key.pem

This file was deleted.

0 comments on commit c882d0a

Please sign in to comment.