From 6fac81f8449dc56cd79467f4c0c225487ed6d54a164348577feb8ffdf5713b40 Mon Sep 17 00:00:00 2001 From: Jan Fajerski Date: Mon, 21 Sep 2020 08:22:54 +0000 Subject: [PATCH] Accepting request 835207 from home:vtheile Get the image containing the Prometheus SNMP webhook into registry.opensuse.org. OBS-URL: https://build.opensuse.org/request/show/835207 OBS-URL: https://build.opensuse.org/package/show/server:monitoring/prometheus-webhook-snmp-image?expand=0&rev=1 --- .gitattributes | 25 ++++++ .gitignore | 1 + LICENSE | 17 ++++ README.md | 38 +++++++++ _icon | 3 + _service | 10 +++ config.sh | 29 +++++++ pre-checkin.sh | 11 +++ prometheus-webhook-snmp-image.changes | 4 + prometheus-webhook-snmp-image.kiwi | 53 ++++++++++++ prometheus-webhook-snmp-image.xsl | 113 ++++++++++++++++++++++++++ ses7.xml | 19 +++++ tumbleweed.xml | 9 ++ 13 files changed, 332 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 _icon create mode 100644 _service create mode 100644 config.sh create mode 100644 pre-checkin.sh create mode 100644 prometheus-webhook-snmp-image.changes create mode 100644 prometheus-webhook-snmp-image.kiwi create mode 100644 prometheus-webhook-snmp-image.xsl create mode 100644 ses7.xml create mode 100644 tumbleweed.xml diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ce711db --- /dev/null +++ b/.gitattributes @@ -0,0 +1,25 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text +## Specific LFS patterns +_icon filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2b62e4c --- /dev/null +++ b/LICENSE @@ -0,0 +1,17 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..c42decc --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +# Networking +You need to publish the port the Prometheus receiver is listening on by +using the command line argument `--publish :` +when running the container because the port is not exposed automatically +because it is configurable. The default port is `9099`. + +Additionally the SNMP host needs to be configured. Use the container's +network gateway to be able to receive SNMP traps outside the container. + +``` +$ docker run --publish : --env ARGS="--debug --snmp-host=" ... +``` + +Alternatively simply connect the container to the host network. + +``` +$ docker run --network=host ... +``` + +# Configure prometheus-webhook-snmp +The configuration documentation can be found [here](https://github.com/SUSE/prometheus-webhook-snmp/blob/master/README.md). + +The container can be configured via the environment variables `ARGS` and +`RUN_ARGS` or by mounting a configuration file into the container. + +## Using environment variables +Use `ARGS` to set [global options](https://github.com/SUSE/prometheus-webhook-snmp/blob/master/README.md#global) +and `RUN_ARGS` for the [run command options](https://github.com/SUSE/prometheus-webhook-snmp/blob/master/README.md#command-run). +The environment variable `ARGS` defaults to `--debug`. + +``` +$ docker run --env ARGS="--debug --snmp-community=foo" --env RUN_ARGS="--metrics" ... +``` + +## Using a configuration file +``` +$ docker run -v $(pwd)/prometheus-webhook-snmp.conf:/etc/prometheus-webhook-snmp.conf ... +``` diff --git a/_icon b/_icon new file mode 100644 index 0000000..6962b73 --- /dev/null +++ b/_icon @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4e5df815bbf2ccf53ab9fa0822eb607c81ecc4ca5c862ab89a7a4e9e8b126731 +size 12719 diff --git a/_service b/_service new file mode 100644 index 0000000..5ce9d74 --- /dev/null +++ b/_service @@ -0,0 +1,10 @@ + + + + prometheus-webhook-snmp-image.kiwi + %PKG_VERSION% + patch + prometheus-webhook-snmp + + + diff --git a/config.sh b/config.sh new file mode 100644 index 0000000..bb6b72d --- /dev/null +++ b/config.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +test -f /.kconfig && . /.kconfig +test -f /.profile && . /.profile + +echo "Configure image: [$kiwi_iname]..." + +#====================================== +# Disable recommends +#-------------------------------------- +sed -i 's/.*installRecommends.*/installRecommends = no/g' /etc/zypp/zypper.conf + +#====================================== +# Remove locale files +#-------------------------------------- +find /usr/share/locale -name '*.mo' -delete + +exit 0 diff --git a/pre-checkin.sh b/pre-checkin.sh new file mode 100644 index 0000000..cffdcd9 --- /dev/null +++ b/pre-checkin.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# +# Generate the kiwi file for the given target. + +image="prometheus-webhook-snmp-image" +target=${1:-tumbleweed} +if [ ! -e ${target}.xml ]; then + echo "Unknown target: ${target}.xml must exist!" + exit 1 +fi +xsltproc "${image}.xsl" "${target}.xml" > "${image}.kiwi" diff --git a/prometheus-webhook-snmp-image.changes b/prometheus-webhook-snmp-image.changes new file mode 100644 index 0000000..6bb8a76 --- /dev/null +++ b/prometheus-webhook-snmp-image.changes @@ -0,0 +1,4 @@ +------------------------------------------------------------------- +Fri Sep 11 10:49:05 CET 2020 - vtheile@suse.com + +- Initial version diff --git a/prometheus-webhook-snmp-image.kiwi b/prometheus-webhook-snmp-image.kiwi new file mode 100644 index 0000000..c032c1c --- /dev/null +++ b/prometheus-webhook-snmp-image.kiwi @@ -0,0 +1,53 @@ + + + + + + SUSE LLC + https://bugs.opensuse.org + Image containing Prometheus Alertmanager receiver for SNMP traps + + + + + + + + + + + + + + + + + + Install Prometheus Alertmanager receiver for SNMP traps + + + 1.0.0 + zypper + false + true + en_US + us.map.gz + + + + + + + + + diff --git a/prometheus-webhook-snmp-image.xsl b/prometheus-webhook-snmp-image.xsl new file mode 100644 index 0000000..3397273 --- /dev/null +++ b/prometheus-webhook-snmp-image.xsl @@ -0,0 +1,113 @@ + + + + + OBS-ExclusiveArch: aarch64 x86_64 + + This file is generated, don't manually modify this file. + + + + + + SUSE LLC + https://bugs.opensuse.org + Image containing Prometheus Alertmanager receiver for SNMP traps + + + + + + + + + + + ,%PKG_VERSION%,%PKG_VERSION%.%RELEASE% + + + + + + + + + + + + + + + + + + + + + + + + + + + + Install Prometheus Alertmanager receiver for SNMP traps + + + + 1.0.0 + zypper + false + true + en_US + us.map.gz + + + + + + + + + + + + + diff --git a/ses7.xml b/ses7.xml new file mode 100644 index 0000000..fbaaf59 --- /dev/null +++ b/ses7.xml @@ -0,0 +1,19 @@ + + + obsrepositories:/suse/sle15#15.2 + sle15.2.octopus + ses/7/prometheus-webhook-snmp + com.suse.ses + https://registry.suse.com/ses/7/prometheus-webhook-snmp:%PKG_VERSION%.%RELEASE% + registry.suse.com/ses/7/prometheus-webhook-snmp:%PKG_VERSION%.%RELEASE% + + + + + diff --git a/tumbleweed.xml b/tumbleweed.xml new file mode 100644 index 0000000..a050712 --- /dev/null +++ b/tumbleweed.xml @@ -0,0 +1,9 @@ + + + obsrepositories:/opensuse/tumbleweed + tumbleweed + opensuse/prometheus-webhook-snmp + org.opensuse.prometheus-webhook-snmp + https://registry.opensuse.org/opensuse/prometheus-webhook-snmp:%PKG_VERSION%.%RELEASE% + registry.opensuse.org/opensuse/prometheus-webhook-snmp:%PKG_VERSION%.%RELEASE% +