-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Dockerfile, docker-compose.yml, entrypoint and example configs
- Loading branch information
Showing
6 changed files
with
218 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
FROM debian:11-slim | ||
|
||
LABEL org.opencontainers.image.authors="info@paessler.com" | ||
LABEL org.opencontainers.image.vendor="Paessler GmbH" | ||
LABEL org.opencontainers.image.licenses="MIT" | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
# enforce image to be up to date | ||
RUN \ | ||
apt-get update \ | ||
&& apt-get -y upgrade \ | ||
&& apt-get clean | ||
|
||
# install necessary prerequisites | ||
# | ||
# needed additional packages: | ||
# - ca-certificates (for TLS certificate validation and curl) | ||
# - python3-minimal (for Script v2 sensor) | ||
# - gosu (to drop to unprivileged user) | ||
# - libcap2-bin (for setcap command) | ||
# | ||
RUN \ | ||
apt-get update \ | ||
&& apt-get -y install --no-install-recommends --no-install-suggests \ | ||
ca-certificates \ | ||
python3-minimal \ | ||
gosu \ | ||
libcap2-bin \ | ||
&& apt-get clean | ||
|
||
# add paessler's official package repository | ||
RUN \ | ||
apt-get update \ | ||
&& apt-get -y install --no-install-recommends --no-install-suggests \ | ||
curl \ | ||
&& curl --fail --silent https://packages.paessler.com/keys/paessler.asc > /usr/share/keyrings/paessler-archive-keyring.asc \ | ||
&& curl --fail --silent https://packages.paessler.com/docs/apt-sources/$(. /etc/os-release && echo $VERSION_CODENAME).sources > /etc/apt/sources.list.d/paessler.sources \ | ||
&& apt-get -y remove --purge curl \ | ||
&& apt-get clean | ||
|
||
# install the latest multi-platform probe | ||
RUN \ | ||
apt-get update \ | ||
&& apt-get -y install --no-install-recommends --no-install-suggests \ | ||
prtgmpprobe \ | ||
&& apt-get clean | ||
|
||
# add entrypoint script | ||
COPY --chown=root:root --chmod=0555 run-prtgmpprobe.sh /run-prtgmpprobe.sh | ||
|
||
# specify volumes: | ||
# - /config : configuration directory for the prtgmpprobe, put your config.yml here. | ||
# - /opt/paessler/share/scripts : scripts directory for the Script v2 sensor. Mount your scripts here. | ||
VOLUME [ "/config", "/opt/paessler/share/scripts" ] | ||
|
||
# set WORKDIR to a sane default | ||
WORKDIR / | ||
|
||
ENTRYPOINT [ "/run-prtgmpprobe.sh", "service-run" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
id: 0f2dcfe4-3ea4-4fd8-99d1-f22bd923544a | ||
access_key: YOUR_SUPER_SECRET_ACCESS_KEY | ||
name: multi-platform-probe@HOSTNAME | ||
max_scheduling_delay: 300 | ||
heartbeat_interval: 30 | ||
nats: | ||
url: tls://localhost:23561 | ||
authentication: | ||
user: USER | ||
password: PASSWORD | ||
request_timeout: 15 | ||
server_ca: /config/certs/example-ca.crt | ||
client_name: ClientName (displayed on NATS Server) | ||
momo: | ||
dir: MonitoringModules/ | ||
timeout: 900 | ||
logging: | ||
console: | ||
level: info | ||
without_time: false | ||
journald: | ||
level: off | ||
field_prefix: PRTGMPPROBE | ||
observability: | ||
enable_endpoint: true | ||
endpoint: | ||
interface: localhost | ||
port: 23562 | ||
process_check_interval: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
access_key: YOUR_SUPER_SECRET_ACCESS_KEY | ||
nats: | ||
url: tls://localhost:23561 | ||
authentication: | ||
user: USER | ||
password: PASSWORD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: "2.4" | ||
|
||
services: | ||
prtgmpprobe: | ||
build: . | ||
image: paessler/multi-platform-probe:latest | ||
restart: unless-stopped | ||
|
||
network_mode: "bridge" | ||
|
||
volumes: | ||
- ./scripts:/opt/paessler/share/scripts:ro | ||
- ./config:/config | ||
|
||
cap_add: | ||
- NET_ADMIN # for gosu and icmp | ||
- NET_RAW # for icmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
#!/bin/bash | ||
set -eu | ||
|
||
error() { | ||
echo >&2 "Error: $*" | ||
} | ||
|
||
################# | ||
|
||
PRTGMPPROBE__BINARY=/opt/paessler/mpprobe/prtgmpprobe | ||
|
||
_passthrough=0 | ||
for _arg in "$@" | ||
do | ||
case "$_arg" in | ||
--help|example-config) | ||
_passthrough=1 | ||
;; | ||
esac | ||
done | ||
if [ ! $_passthrough -eq 0 ] ; then | ||
exec gosu paessler_mpprobe:paessler_mpprobe \ | ||
${PRTGMPPROBE__BINARY} \ | ||
"$@" | ||
fi | ||
|
||
PRTGMPPROBE__CONFIG_FILE=${PRTGMPPROBE__CONFIG_FILE:-/config/config.yml} # needs to be provided by user | ||
PRTGMPPROBE__ID_FILE=${PRTGMPPROBE__ID_FILE:-/config/id.txt} | ||
|
||
for _var in PRTGMPPROBE__ACCESS_KEY \ | ||
PRTGMPPROBE__NATS__AUTHENTICATION__USER \ | ||
PRTGMPPROBE__NATS__AUTHENTICATION__PASSWORD | ||
do | ||
if [ -n "${!_var-}" ] ; then | ||
error "Setting ${_var} = ${!_var-} as environment variable is insecure. Please set any security related variables inside ${PRTGMPPROBE__CONFIG_FILE}." | ||
echo >&2 " " | ||
echo >&2 "Example:" | ||
${PRTGMPPROBE__BINARY} example-config >&2 | ||
exit 1 | ||
fi | ||
done | ||
|
||
# Handling Env vars | ||
|
||
# Get/Generate a probe id from PRTGMPPROBE__ID_FILE or from PRTGMPPROBE__ID | ||
if [ -z "${PRTGMPPROBE__ID-}" ] ; then | ||
if [ ! -f "${PRTGMPPROBE__ID_FILE}" ] ; then | ||
cat /proc/sys/kernel/random/uuid > ${PRTGMPPROBE__ID_FILE} || ( | ||
error "Unable to write to ${PRTGMPPROBE__ID_FILE}. Please either set PRTGMPPROBE__ID in the container environment or make sure the location ${PRTGMPPROBE__ID_FILE} is writable." | ||
echo >&2 " " | ||
echo >&2 "Example:" | ||
echo >&2 "PRTGMPPROBE__ID=$(cat /proc/sys/kernel/random/uuid)" | ||
exit 1 | ||
) | ||
fi | ||
PRTGMPPROBE__ID=$(cat ${PRTGMPPROBE__ID_FILE}) | ||
export PRTGMPPROBE__ID | ||
fi | ||
|
||
export PRTGMPPROBE__NAME=${PRTGMPPROBE__NAME:-"multi-platform-probe@$(hostname)"} | ||
|
||
export PRTGMPPROBE__MOMO__DIR=${PRTGMPPROBE__MOMO__DIR:-/opt/paessler/mpprobe/monitoringmodules/} | ||
export PRTGMPPROBE__MAX_SCHEDULING_DELAY=${PRTGMPPROBE__MAX_SCHEDULING_DELAY:-300} | ||
export PRTGMPPROBE__HEARTBEAT_INTERVAL=${PRTGMPPROBE__HEARTBEAT_INTERVAL:-30} | ||
export PRTGMPPROBE__NATS__CLIENT_NAME=${PRTGMPPROBE__NATS__CLIENT_NAME:-${PRTGMPPROBE__NAME}} | ||
|
||
# Containers don't have journald available | ||
export PRTGMPPROBE__LOGGING__CONSOLE__LEVEL=${PRTGMPPROBE__LOGGING__CONSOLE__LEVEL:-"info"} | ||
export PRTGMPPROBE__LOGGING__CONSOLE__WITHOUT_TIME=${PRTGMPPROBE__LOGGING__CONSOLE__WITHOUT_TIME:-"true"} | ||
export PRTGMPPROBE__LOGGING__JOURNALD__LEVEL=${PRTGMPPROBE__LOGGING__JOURNALD__FIELD_PREFIX:-"off"} | ||
export PRTGMPPROBE__LOGGING__JOURNALD__FIELD_PREFIX=${PRTGMPPROBE__LOGGING__JOURNALD__FIELD_PREFIX:-"PRTGMPPROBE"} | ||
|
||
if [ ! -f "${PRTGMPPROBE__CONFIG_FILE}" ] ; then | ||
error "Configuration file ${PRTGMPPROBE__CONFIG_FILE} does not exist. Please create one." | ||
echo >&2 " " | ||
echo >&2 "Example:" | ||
${PRTGMPPROBE__BINARY} example-config >&2 | ||
exit 1 | ||
fi | ||
|
||
env | grep PRTGMPPROBE__ >&2 | ||
|
||
# add capabilities for icmp to the probe executable | ||
setcap cap_net_admin,cap_net_raw+eip ${PRTGMPPROBE__BINARY} || true | ||
|
||
exec gosu paessler_mpprobe:paessler_mpprobe \ | ||
${PRTGMPPROBE__BINARY} \ | ||
--config ${PRTGMPPROBE__CONFIG_FILE} \ | ||
"$@" |