commit afa7374920481b7763ff76256d53655e64ed48e3 Author: George Rawlinson Date: Sun Jun 6 00:26:48 2021 +0000 addpkg: prometheus-bind-exporter diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 0000000..49448f1 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,18 @@ +pkgbase = prometheus-bind-exporter + pkgdesc = Prometheus exporter for BIND metrics + pkgver = 0.4.0 + pkgrel = 1 + url = https://github.com/prometheus-community/bind_exporter + arch = x86_64 + license = Apache + makedepends = go + depends = glibc + optdepends = bind: for monitoring a local BIND server + source = prometheus-bind-exporter-0.4.0.tar.gz::https://github.com/prometheus-community/bind_exporter/archive/v0.4.0.tar.gz + source = systemd.service + source = sysusers.conf + b2sums = ec391fa2db90d02f3f468d8db5b6ada47f84853401d4f00fdfd9be7a142cc4305de0fdedd3aa553ab08d78ddd55ce948f098eb4f7a6e9412f5327d2499eb65c1 + b2sums = 83ac2fb9b39f10f9eb130fc566887a5dc70447265d9d567221ceccf83a9fe7ad8035dfa751ecefe9681c64fd8ddb260b3e370f956350b9cab699eed507d9affc + b2sums = 739b1e4e7ab277096d0875ed14d61f223e7b990e7081721e4638aebad9c3beccc270ce9944384784af8eab035dbb34a86badae687c065291bfb384abfb42573a + +pkgname = prometheus-bind-exporter diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..72a2285 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,61 @@ +# Maintainer: George Rawlinson + +pkgname=prometheus-bind-exporter +_pkgname=bind_exporter +pkgver=0.4.0 +pkgrel=1 +pkgdesc="Prometheus exporter for BIND metrics" +arch=('x86_64') +url="https://github.com/prometheus-community/bind_exporter" +license=('Apache') +depends=('glibc') +makedepends=('go') +optdepends=('bind: for monitoring a local BIND server') +source=( + "$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz" + 'systemd.service' + 'sysusers.conf' +) +b2sums=('ec391fa2db90d02f3f468d8db5b6ada47f84853401d4f00fdfd9be7a142cc4305de0fdedd3aa553ab08d78ddd55ce948f098eb4f7a6e9412f5327d2499eb65c1' + '83ac2fb9b39f10f9eb130fc566887a5dc70447265d9d567221ceccf83a9fe7ad8035dfa751ecefe9681c64fd8ddb260b3e370f956350b9cab699eed507d9affc' + '739b1e4e7ab277096d0875ed14d61f223e7b990e7081721e4638aebad9c3beccc270ce9944384784af8eab035dbb34a86badae687c065291bfb384abfb42573a') + +prepare() { + cd "$_pkgname-$pkgver" + + # create folder for build output + mkdir build + + # download dependencies + go mod vendor +} + +build() { + cd "$_pkgname-$pkgver" + go build -v \ + -buildmode=pie \ + -trimpath \ + -mod=vendor \ + -modcacherw \ + -ldflags "-linkmode external -extldflags ${LDFLAGS} \ + -X github.com/prometheus/common/version.Version=$pkgver \ + -X github.com/prometheus/common/version.Revision=$pkgver \ + -X github.com/prometheus/common/version.Branch=tarball \ + -X github.com/prometheus/common/version.BuildUser=someone@builder \ + -X github.com/prometheus/common/version.BuildDate=$(date -d@"$SOURCE_DATE_EPOCH" +%Y%m%d-%H:%M:%S)" \ + -o build . +} + +check() { + cd "$_pkgname-$pkgver" + go test ./... +} + +package() { + # systemd integration + install -Dm644 systemd.service "$pkgdir/usr/lib/systemd/system/$pkgname.service" + install -Dm644 sysusers.conf "$pkgdir/usr/lib/sysusers.d/$pkgname.conf" + + # binary + install -Dm755 -t "$pkgdir/usr/bin" "$_pkgname-$pkgver/build/$_pkgname" +} diff --git a/systemd.service b/systemd.service new file mode 100644 index 0000000..baf8d72 --- /dev/null +++ b/systemd.service @@ -0,0 +1,46 @@ +[Unit] +Description=Prometheus exporter for BIND metrics +Requires=network-online.target +After=network-online.target + +[Service] +# If BIND_EXPORTER_ARGS is required, it should be applied using a +# drop-in systemd file. See `man 5 systemd.unit` for details. +ExecStart=/usr/bin/bind_exporter $BIND_EXPORTER_ARGS +ExecReload=/bin/kill -HUP $MAINPID +User=bind-exporter +Group=bind-exporter +Restart=on-failure +RestartSec=5s + +NoNewPrivileges=true +LimitNOFILE=1048576 +UMask=0077 + +ProtectSystem=strict +ProtectHome=true +PrivateUsers=yes +PrivateTmp=true +PrivateDevices=true +ProtectHostname=true +ProtectClock=true +ProtectKernelTunables=true +ProtectKernelModules=true +ProtectKernelLogs=true +ProtectControlGroups=true +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 +RestrictNamespaces=true +LockPersonality=true +MemoryDenyWriteExecute=true +RestrictRealtime=true +RestrictSUIDSGID=true +RemoveIPC=true +CapabilityBoundingSet= +AmbientCapabilities= + +SystemCallFilter=@system-service +SystemCallFilter=~@privileged @resources +SystemCallArchitectures=native + +[Install] +WantedBy=multi-user.target diff --git a/sysusers.conf b/sysusers.conf new file mode 100644 index 0000000..b0c0b80 --- /dev/null +++ b/sysusers.conf @@ -0,0 +1 @@ +u bind-exporter - "Prometheus BIND exporter user"