Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM docker.io/golang:alpine AS builder

WORKDIR /usr/local/src/exporter
COPY --chown=nobody:nogroup . .
RUN apk --no-cache add --update make && make build

FROM docker.io/alpine:latest

RUN addgroup -S icinga_exporter && \
adduser -S icinga_exporter -G icinga_exporter && \
apk --no-cache add --update ca-certificates

COPY --from=builder /usr/local/src/exporter/dist/icinga2-exporter /usr/sbin/icinga2-exporter

USER icinga_exporter
ENTRYPOINT ["/usr/sbin/icinga2-exporter"]

EXPOSE 9665
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

COMMIT := $(shell git rev-parse HEAD)
VERSION?=latest
DATE := $(shell date --iso-8601)
DATE := $(shell date -I)

GOARCH?=amd64
GOOS?=linux
Expand All @@ -20,5 +20,7 @@ test:
coverage:
go test -v -cover -coverprofile=coverage.out ./... &&\
go tool cover -html=coverage.out -o coverage.html
container:
podman build -t icinga-exporter:latest .
clean:
rm -f dist/*
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,12 @@ The tables below list all existing collectors.
| Collector | Flag |
| ------------- | ---------- |
| APIListener | `-collector.apilistener` |

# Development

Running tests:

```
make test
make coverage
```