Search code examples
dockernagiosalpine-linux

Setting up NSCA in Docker Alpine image for passive nagios check


In the Alpine linux package site https://pkgs.alpinelinux.org/packages NSCA packages are yet to get added. Is there an alternative to setup NSCA in Alpine Linux for passive-check?


Solution

  • If there is no package for it, you can always build it yourself.

    FROM alpine AS builder
    
    ARG NSCA_VERSION=2.9.2
    
    RUN apk update && apk add build-base build-base gcc wget git
    
    RUN wget http://prdownloads.sourceforge.net/nagios/nsca-$NSCA_VERSION.tar.gz
    RUN tar xzf nsca-$NSCA_VERSION.tar.gz
    RUN cd nsca-$NSCA_VERSION&& ./configure && make all
    RUN ls -lah nsca-$NSCA_VERSION/src
    RUN mkdir -p /dist/bin && cp nsca-$NSCA_VERSION/src/nsca /dist/bin
    RUN mkdir -p /dist/etc && cp nsca-$NSCA_VERSION/sample-config/nsca.cfg /dist/etc
    
    FROM alpine
    
    COPY --from=builder /dist/bin/nsca /bin/
    COPY --from=builder /dist/etc/nsca.cfg /etc/
    

    Since this is using multiple stages, your resulting image will not contain development files and will still be small.