Skip to content

Commit 85d130f

Browse files
committed
docker/snmp-exporter-config-generator: Update generator and install missing MIBs from cisco repo
Note that the current version of cisco/cisco-mibs is broken. See cisco/cisco-mibs#20 (comment)
1 parent 1705b2e commit 85d130f

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed
Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,41 @@
1-
FROM ubuntu:jammy AS build
1+
FROM public.ecr.aws/ubuntu/ubuntu:jammy AS build
22

33
RUN apt-get update -qq && \
4-
apt-get install -y --no-install-recommends build-essential golang libsnmp-dev p7zip-full unzip git curl ca-certificates snmp-mibs-downloader
4+
apt-get install -y --no-install-recommends build-essential golang libsnmp-dev p7zip-full unzip git curl ca-certificates snmp-mibs-downloader rename
55

66
WORKDIR /build
77
RUN git init && \
88
git remote add origin https://github.com/prometheus/snmp_exporter && \
9-
git fetch origin 58b902ede4f6bee7a150566ac7fae05ef0a4b1fb && \
9+
git fetch --depth=1 origin 4b68fe9f8155d81bdaf3e2ef018532da545aa969 && \
1010
git checkout FETCH_HEAD
1111

1212
WORKDIR /build/generator
1313

1414
RUN make mibs
15-
RUN mv mibs/cisco_v2/* mibs/
1615
RUN make generator
1716
RUN download-mibs
1817

19-
FROM ubuntu:jammy
18+
WORKDIR /build/generator/cisco
19+
RUN git init && \
20+
git remote add origin https://github.com/cisco/cisco-mibs && \
21+
git fetch --depth=1 origin 2d465cce2de4e67a3561d8e41e4c99b597558d4b && \
22+
git checkout FETCH_HEAD
23+
24+
RUN file-rename -- 's/\.my$//' v2/*.my
25+
26+
FROM public.ecr.aws/ubuntu/ubuntu:jammy
2027

2128
RUN apt-get update -qq && \
2229
apt-get install -y --no-install-recommends libsnmp40 && \
2330
rm -rf /var/lib/apt/lists/*
2431

2532
COPY --from=build /build/generator/generator /opt/snmp-exporter/bin/
2633
COPY --from=build /build/generator/mibs/ /usr/share/snmp/mibs/
34+
COPY --from=build /build/generator/cisco/v2/ /usr/share/snmp/mibs/
2735
COPY --from=build /usr/share/snmp/mibs/ /usr/share/snmp/mibs/
2836
COPY --from=build /var/lib/mibs/ /var/lib/mibs/
2937

30-
COPY ./entrypoint.sh /
38+
COPY --chmod=0755 ./entrypoint.sh /
3139
RUN chmod +x /entrypoint.sh
3240

3341
ENTRYPOINT ["/entrypoint.sh"]

snmp-exporter-config-generator/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ set -eu
44
cd "$(mktemp -d)"
55

66
cat > generator.yml
7-
/opt/snmp-exporter/bin/generator generate
7+
/opt/snmp-exporter/bin/generator "$@"
88
cat snmp.yml

0 commit comments

Comments
 (0)