Skip to content

Commit

Permalink
Hoenn/agentctl register integrations (#342)
Browse files Browse the repository at this point in the history
* Register integrations in agentctl

* Update changelog

* Changelog typo

* Update CHANGELOG.md

* build agentctl with CGO_ENABLED=1

importing integrations requires CGO_ENABLED=1 on macOS. Making this
change also requires installing libsystemd-dev in the agentctl Docker
containers, as CGO_ENABLED=1 will cause promtail to include the systemd
tailer.

Co-authored-by: Robert Fratto <robertfratto@gmail.com>
  • Loading branch information
hoenn and rfratto authored Jan 20, 2021
1 parent a41ea77 commit f705b84
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ can be found at [#317](https://github.com/grafana/agent/issues/317).

# Master (unreleased)

- [BUGFIX] `agentctl config-check` will now work correctly when the supplied config file contains integrations. (@hoenn)

# v0.11.0 (2021-01-20)

- [FEATURE] ARMv6 builds of `agent` and `agentctl` will now be included in
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ endif

cmd/agentctl/agentctl: cmd/agentctl/main.go
ifeq ($(CROSS_BUILD),false)
CGO_ENABLED=0 go build $(GO_FLAGS) -o $@ ./$(@D)
CGO_ENABLED=1 go build $(CGO_FLAGS) -o $@ ./$(@D)
else
CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM) go build $(GO_FLAGS) -o $@ ./$(@D)
@CGO_ENABLED=1 GOOS=$(GOOS) GOARCH=$(GOARCH) GOARM=$(GOARM); $(seego) build $(CGO_FLAGS) -o $@ ./$(@D)
endif
$(NETGO_CHECK)

Expand Down
16 changes: 12 additions & 4 deletions cmd/agentctl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
FROM golang:1.15 as build
FROM golang:1.15.3-buster as build
COPY . /src/agent
WORKDIR /src/agent
ARG RELEASE_BUILD=false
ARG IMAGE_TAG

# Backports repo required to get a libsystemd version 246 or newer which is required to handle journal +ZSTD compression
RUN echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
RUN apt-get update && apt-get install -t buster-backports -qy libsystemd-dev

RUN make clean && make IMAGE_TAG=${IMAGE_TAG} RELEASE_BUILD=${RELEASE_BUILD} BUILD_IN_CONTAINER=false agentctl

FROM debian:buster-slim
RUN apt-get update && \
apt-get install -qy \
tzdata ca-certificates && \

# Backports repo required to get a libsystemd version 246 or newer which is required to handle journal +ZSTD compression
RUN echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
RUN apt-get update && apt-get install -t buster-backports -qy libsystemd-dev && \
apt-get install -qy tzdata ca-certificates && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY --from=build /src/agent/cmd/agentctl/agentctl /bin/agentctl

ENTRYPOINT ["/bin/agentctl"]
9 changes: 6 additions & 3 deletions cmd/agentctl/Dockerfile.buildx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@ RUN cp /go_wrapper.sh /seego.sh
RUN make clean && IMAGE_TAG=${IMAGE_TAG} RELEASE_BUILD=${RELEASE_BUILD} BUILD_IN_CONTAINER=false bash ./tools/cross_build.bash agentctl

FROM debian:buster-slim
RUN apt-get update && \
apt-get install -qy \
tzdata ca-certificates && \

# Backports repo required to get a libsystemd version 246 or newer which is required to handle journal +ZSTD compression
RUN echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
RUN apt-get update && apt-get install -t buster-backports -qy libsystemd-dev && \
apt-get install -qy tzdata ca-certificates libsystemd-dev && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY --from=build /src/agent/cmd/agentctl/agentctl /bin/agentctl

ENTRYPOINT ["/bin/agentctl"]
3 changes: 3 additions & 0 deletions cmd/agentctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import (

// Register Prometheus SD components
_ "github.com/prometheus/prometheus/discovery/install"

// Register integrations
_ "github.com/grafana/agent/pkg/integrations/install"
)

func main() {
Expand Down

0 comments on commit f705b84

Please sign in to comment.