Merge pull request #36 from neoaggelos/docker

Added Dockerfile and example docker-compose.yml
This commit is contained in:
Conrad Hoffmann 2019-10-14 15:44:24 +02:00 committed by GitHub
commit 5ac3a479c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 2 deletions

24
Dockerfile Normal file
View File

@ -0,0 +1,24 @@
# Build /go/bin/ipmi_exporter
FROM golang:latest AS builder
RUN go get github.com/soundcloud/ipmi_exporter \
&& cd /go/src/github.com/soundcloud/ipmi_exporter \
&& go build
# Container image
FROM ubuntu:18.04
LABEL maintainer="Aggelos Kolaitis <neoaggelos@gmail.com>"
WORKDIR /
RUN apt-get update \
&& apt-get install freeipmi-tools -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /go/bin/ipmi_exporter /ipmi_exporter
EXPOSE 9290
CMD ["/ipmi_exporter", "--config.file", "/config.yml"]

View File

@ -15,7 +15,7 @@ implementation.
## Installation
You need a Go development environment. Then, run the following to get the
You need a Go development environment. Then, run the following to get the
source code and build and install the binary:
go get github.com/soundcloud/ipmi_exporter
@ -67,6 +67,18 @@ When running this exporter as non root, you should do the followings.
4. execute ipmi-exporter with the option
`--freeipmi.path=/home/ipmi-exporter`
### Running with docker (NOTE: remote metrics only)
The root folder contains a `Dockerfile` and an example `docker-compose.yml`.
Edit the `ipmi_remote.yml` file to configure IPMI credentials, then run with:
```
$ sudo docker-compose up -d
```
By default, the server will bind on `0.0.0.0:9290`.
## Configuration
Simply scraping the standard `/metrics` endpoint will make the exporter emit
@ -323,4 +335,3 @@ type is added as label (in addition to name and ID). Example:
ipmi_sensor_state{id="139",name="Power Cable",type="Cable/Interconnect"} 0
ipmi_sensor_value{id="139",name="Power Cable",type="Cable/Interconnect"} NaN

11
docker-compose.yml Normal file
View File

@ -0,0 +1,11 @@
version: '3.7'
services:
ipmi_exporter:
build:
context: .
volumes:
- ./ipmi_remote.yml:/config.yml:ro # replace with your own config
ports:
- 9290:9290 # bind on 0.0.0.0
# - 127.0.0.1:9290:9290 # or bind to specific interface
hostname: ipmi_exporter_docker