Public Repository

Last pushed: 2 months ago
Short Description
Docker Image based on Alpine Linux, running NRPE through Supervisor. Logs collected through rsyslog.
Full Description

Docker Image based on Alpine Linux, running NRPE through Supervisor

  • Based on Alpine Linux (Docker Image insightsoftware/base:1.0.0-supervisor)
  • Includes confd to configure services
  • Includes supervisor to ensure services are running.
  • Logs collected through rsyslog

ENV VARIABLES

NAGIOS_NRPE_CONFIG

JSON formatted list of configs for NRPE to use.

Syntax:
{
    "pid_file": "/var/run/nagios/nrpe.pid",
    "server_address": "0.0.0.0",
    "dont_blame_nrpe": "1",
    "allowed_hosts": "127.0.0.1,172.16.0.0/12",
    "log_facility": "local1",
    "debug": "1"
}

NAGIOS_NRPE_RSYSLOG_CONFIG

JSON formatted list of configs for rsyslog to use.

Syntax:
{
    "FileOwner": "root",
    "FileGroup": "adm",
    "logs": [{
        "log_facility": "local1.*",
        "log_target": "/var/log/nrpe"
    }]
}

SUPERVISOR_CONF

SUPERVISOR_CONF: which programs we want supervisor to run, in a JSON format that will map to a supervisor.conf format. A default value is set in the Dockerfile as follows, although this can be overridden.

Syntax:
{
    "programs": [{
        "program": "rsyslog",
        "command": "rsyslogd -dn",
        "start_secs": "20",
        "priority": "2"
    }, {
        "program": "nrpe",
        "command": " sh start-nrpe.sh",
        "start_secs": "20",
        "autorestart": "true",
        "stdout_logfile": "/var/log/supervisor/nrpe.log",
        "priority": "3"
    }]
}
Example Usage
 docker run -d --name="nrpe" \
  -e NAGIOS_NRPE_CONFIG='{"pid_file": "/var/run/nagios/nrpe.pid", "server_address": "0.0.0.0", "dont_blame_nrpe": "1", "allowed_hosts": "127.0.0.1,172.16.0.0/12", "log_facility": "local1", "debug": "1"}' \
  -e NAGIOS_NRPE_RSYSLOG_CONFIG='{"FileOwner": "root", "FileGroup": "adm", "logs": [{"log_facility": "local1.*", "log_target": "/var/log/nrpe"}]}' \
 -p "5666:5666" \
 --link nagios:nagios \
 insightsoftware/nagios_nrpe:1.1.0

Dockerfile

FROM insightsoftware/base:1.0.0-supervisor

MAINTAINER Hubble Infrastructure <hubble.infrastructure@insightsoftware.com>

ENV NAGIOS_PLUGINS_VERSION=2.0
ENV NRPE_MAJOR_VERSION=2
ENV NRPE_VERSION=2.15
ENV SUPERVISOR_CONF='{"programs": [{"program": "rsyslog", "command": "rsyslogd -dn", "startsecs": "20", "priority": "2"},{"program": "nrpe", "command": " sh start-nrpe.sh", "startsecs": "20", "autorestart": "true", "stdout_logfile": "/var/log/supervisor/nrpe.log", "priority": "3"}]}'

RUN set -ex \
  && cd /usr/lib \
  && ln -s libssl.so.0.9.8 libssl.so \
  && addgroup -S nagios && adduser -S -G nagios nagios \
  && apk add --no-cache --virtual .build-dependencies curl alpine-sdk openssl-dev perl \
  && curl -fsSL  http://sourceforge.net/projects/nagios/files/nrpe-$NRPE_MAJOR_VERSION.x/nrpe-$NRPE_VERSION/nrpe-$NRPE_VERSION.tar.gz -o /tmp/nrpe-$NRPE_VERSION.tar.gz \
  && cd /tmp \
  && tar xzf nrpe-$NRPE_VERSION.tar.gz \
  && cd /tmp/nrpe-$NRPE_VERSION \
  && ./configure --enable-command-args --enable-ssl \
  && make all \
  && make install \
  && apk del .build-dependencies \
  && mkdir /etc/nrpe \
  && chown -R nagios /etc/nrpe \
  && mkdir /var/run/nagios \
  && chown -R nagios /var/run/nagios \
  && apk add --no-cache rsyslog 

COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh

EXPOSE 5666

#USER nagios
Docker Pull Command
Owner
insightsoftware

Comments (0)