1
0

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
This commit is contained in:
Jan Fajerski 2020-09-21 08:22:54 +00:00 committed by Git OBS Bridge
commit 6fac81f844
13 changed files with 332 additions and 0 deletions

25
.gitattributes vendored Normal file
View File

@ -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

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

17
LICENSE Normal file
View File

@ -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.

38
README.md Normal file
View File

@ -0,0 +1,38 @@
# Networking
You need to publish the port the Prometheus receiver is listening on by
using the command line argument `--publish <HOST_PORT>:<CONTAINER_PORT>`
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 <LISTENING_PORT>:<LISTENING_PORT> --env ARGS="--debug --snmp-host=<CONTAINER_GATEWAY>" ...
```
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 ...
```

3
_icon Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:4e5df815bbf2ccf53ab9fa0822eb607c81ecc4ca5c862ab89a7a4e9e8b126731
size 12719

10
_service Normal file
View File

@ -0,0 +1,10 @@
<services>
<service mode="buildtime" name="kiwi_metainfo_helper"/>
<service name="replace_using_package_version" mode="buildtime">
<param name="file">prometheus-webhook-snmp-image.kiwi</param>
<param name="regex">%PKG_VERSION%</param>
<param name="parse-version">patch</param>
<param name="package">prometheus-webhook-snmp</param>
</service>
<service mode="buildtime" name="kiwi_label_helper"/>
</services>

29
config.sh Normal file
View File

@ -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

11
pre-checkin.sh Normal file
View File

@ -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"

View File

@ -0,0 +1,4 @@
-------------------------------------------------------------------
Fri Sep 11 10:49:05 CET 2020 - vtheile@suse.com
- Initial version

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- OBS-ExclusiveArch: aarch64 x86_64 -->
<!--
This file is generated, don't manually modify this file.
-->
<image xmlns:suse_label_helper="com.suse.label_helper" schemaversion="6.9" name="prometheus-webhook-snmp-image">
<description type="system">
<author>SUSE LLC</author>
<contact>https://bugs.opensuse.org</contact>
<specification>Image containing Prometheus Alertmanager receiver for SNMP traps</specification>
</description>
<preferences>
<type image="docker" derived_from="obsrepositories:/opensuse/tumbleweed">
<containerconfig tag="latest" maintainer="SUSE LLC (https://bugs.opensuse.org)" additionaltags="tumbleweed,%PKG_VERSION%,%PKG_VERSION%.%RELEASE%" name="opensuse/prometheus-webhook-snmp">
<environment>
<env name="PATH" value="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"/>
<env name="ARGS" value="--debug"/>
<env name="RUN_ARGS" value=""/>
</environment>
<subcommand execute="/bin/sh">
<argument name="-c"/>
<argument name="exec /usr/bin/prometheus-webhook-snmp $ARGS run $RUN_ARGS"/>
</subcommand>
<labels>
<suse_label_helper:add_prefix prefix="org.opensuse.prometheus-webhook-snmp">
<label name="org.opencontainers.image.title" value="Prometheus Alertmanager SNMP webhook"/>
<label name="org.opencontainers.image.description" value="Image containing Prometheus Alertmanager receiver for SNMP traps"/>
<label name="org.opencontainers.image.version" value="v%PKG_VERSION%.%RELEASE%"/>
<label name="org.opencontainers.image.created" value="%BUILDTIME%"/>
<label name="org.opencontainers.image.vendor" value="SUSE LLC"/>
<label name="org.opencontainers.image.url" value="https://registry.opensuse.org/opensuse/prometheus-webhook-snmp:%PKG_VERSION%.%RELEASE%"/>
<label name="org.opensuse.reference" value="registry.opensuse.org/opensuse/prometheus-webhook-snmp:%PKG_VERSION%.%RELEASE%"/>
<label name="org.openbuildservice.disturl" value="%DISTURL%"/>
</suse_label_helper:add_prefix>
</labels>
<history author="SUSE LLC">Install Prometheus Alertmanager receiver for SNMP traps</history>
</containerconfig>
</type>
<version>1.0.0</version>
<packagemanager>zypper</packagemanager>
<rpm-check-signatures>false</rpm-check-signatures>
<rpm-excludedocs>true</rpm-excludedocs>
<locale>en_US</locale>
<keytable>us.map.gz</keytable>
</preferences>
<packages type="bootstrap">
<package name="prometheus-webhook-snmp"/>
<package name="python3-prometheus_client"/>
</packages>
<repository type="rpm-md">
<source path="obsrepositories:/"/>
</repository>
</image>

View File

@ -0,0 +1,113 @@
<?xml version="1.0"
encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml"
encoding="UTF-8"
indent="yes"/>
<xsl:template match="/">
<xsl:comment> OBS-ExclusiveArch: aarch64 x86_64 </xsl:comment>
<xsl:comment>
This file is generated, don't manually modify this file.
</xsl:comment>
<image xmlns:suse_label_helper="com.suse.label_helper"
schemaversion="6.9"
name="prometheus-webhook-snmp-image">
<description type="system">
<author>SUSE LLC</author>
<contact>https://bugs.opensuse.org</contact>
<specification>Image containing Prometheus Alertmanager receiver for SNMP traps</specification>
</description>
<preferences>
<type image="docker">
<xsl:attribute name="derived_from">
<xsl:value-of select="param/image"/>
</xsl:attribute>
<containerconfig tag="latest"
maintainer="SUSE LLC (https://bugs.opensuse.org)">
<xsl:attribute name="additionaltags">
<xsl:value-of select="param/tags"/>,%PKG_VERSION%,%PKG_VERSION%.%RELEASE%</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="param/name"/>
</xsl:attribute>
<environment>
<env name="PATH" value="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"/>
<env name="ARGS" value="--debug"/>
<env name="RUN_ARGS" value=""/>
</environment>
<subcommand execute="/bin/sh">
<argument name="-c"/>
<argument name="exec /usr/bin/prometheus-webhook-snmp $ARGS run $RUN_ARGS"/>
</subcommand>
<labels>
<suse_label_helper:add_prefix>
<xsl:attribute name="prefix">
<xsl:value-of select="param/prefix"/>
</xsl:attribute>
<label name="org.opencontainers.image.title"
value="Prometheus Alertmanager SNMP webhook"/>
<label name="org.opencontainers.image.description"
value="Image containing Prometheus Alertmanager receiver for SNMP traps"/>
<label name="org.opencontainers.image.version"
value="v%PKG_VERSION%.%RELEASE%"/>
<label name="org.opencontainers.image.created"
value="%BUILDTIME%"/>
<label name="org.opencontainers.image.vendor"
value="SUSE LLC"/>
<label name="org.opencontainers.image.url">
<xsl:attribute name="value">
<xsl:value-of select="param/url"/>
</xsl:attribute>
</label>
<label name="org.opensuse.reference">
<xsl:attribute name="value">
<xsl:value-of select="param/reference"/>
</xsl:attribute>
</label>
<label name="org.openbuildservice.disturl"
value="%DISTURL%"/>
</suse_label_helper:add_prefix>
<xsl:for-each select="param/labels/label">
<label>
<xsl:attribute name="name">
<xsl:value-of select="name"/>
</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="value"/>
</xsl:attribute>
</label>
</xsl:for-each>
</labels>
<history author="SUSE LLC">Install Prometheus Alertmanager receiver for SNMP traps</history>
</containerconfig>
</type>
<version>1.0.0</version>
<packagemanager>zypper</packagemanager>
<rpm-check-signatures>false</rpm-check-signatures>
<rpm-excludedocs>true</rpm-excludedocs>
<locale>en_US</locale>
<keytable>us.map.gz</keytable>
</preferences>
<packages type="bootstrap">
<package name="prometheus-webhook-snmp"/>
<package name="python3-prometheus_client"/>
</packages>
<repository type='rpm-md'>
<source path='obsrepositories:/'/>
</repository>
</image>
</xsl:template>
</xsl:stylesheet>

19
ses7.xml Normal file
View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<param>
<image>obsrepositories:/suse/sle15#15.2</image>
<tags>sle15.2.octopus</tags>
<name>ses/7/prometheus-webhook-snmp</name>
<prefix>com.suse.ses</prefix>
<url>https://registry.suse.com/ses/7/prometheus-webhook-snmp:%PKG_VERSION%.%RELEASE%</url>
<reference>registry.suse.com/ses/7/prometheus-webhook-snmp:%PKG_VERSION%.%RELEASE%</reference>
<labels>
<label>
<name>com.suse.ses.version</name>
<value>7.0</value>
</label>
<label>
<name>com.suse.ses.url</name>
<value>https://www.suse.com/products/suse-enterprise-storage/</value>
</label>
</labels>
</param>

9
tumbleweed.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<param>
<image>obsrepositories:/opensuse/tumbleweed</image>
<tags>tumbleweed</tags>
<name>opensuse/prometheus-webhook-snmp</name>
<prefix>org.opensuse.prometheus-webhook-snmp</prefix>
<url>https://registry.opensuse.org/opensuse/prometheus-webhook-snmp:%PKG_VERSION%.%RELEASE%</url>
<reference>registry.opensuse.org/opensuse/prometheus-webhook-snmp:%PKG_VERSION%.%RELEASE%</reference>
</param>