Add prometheus, prometheus-node-exporter, loki and loki-promtail

This commit is contained in:
Alex D. 2022-02-04 11:12:06 +00:00
parent c34c776d86
commit 3a7e13e09b
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
22 changed files with 275 additions and 6 deletions

View File

@ -17,6 +17,8 @@ Internal ports: 7500-7600
PostgreSQL: 7550
Redis: 7551
InfluxDB: 7552
Loki: 7553
Prometheus: 7554
# Services (70-99)
Gitea:
@ -31,6 +33,9 @@ Internal ports: 7500-7600
Grafana: 7577
Monerod:
RPC: 7579
Prometheus:
node_exporter: 7580
Promtail: 7590
Public ports:
SSH: 22

View File

@ -0,0 +1,13 @@
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
. ../APKBUILD-config.template
pkgver=2022.01.25.01
pkgrel=0
source="
config.yaml
"
sha512sums="
3353360bc460a50665bda4a9f0ad78703c9c22c31fdfd238155c709fce23b0b9a2cf41da97b0afd72681eff8ad9d561d7c7f9775e1306aa70c023c78a92fe7cc config.yaml
"

View File

@ -0,0 +1,26 @@
server:
disable: true
clients:
- url: "http://loki.routinginfo.internal:7553/loki/api/v1/push"
positions:
filename: "/tmp/positions.yaml"
scrape_configs:
- job_name: "rsyslog"
syslog:
listen_address: localhost:7590
use_incoming_timestamp: true
label_structured_data: yes
labels:
job: "rsyslog"
relabel_configs:
- source_labels: ["__syslog_connection_ip_address"]
target_label: "ip_address"
- source_labels: ["__syslog_message_severity"]
target_label: "severity"
- source_labels: ["__syslog_message_facility"]
target_label: "facility"
- source_labels: ["__syslog_message_hostname"]
target_label: "host"

19
config/loki/APKBUILD Normal file
View File

@ -0,0 +1,19 @@
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
. ../APKBUILD-config.template
pkgver=2022.01.25.01
pkgrel=0
source="
config.yaml
"
package() {
rx_install config.yaml
install -dm700 "$(rx_cpkgdir)"/var/lib/loki
}
sha512sums="
33ed125f197c840e273a5b56432156d1112f991d2e9bef4da56cd997d45f6d2636250229ce805e2bd1b2e3fc0477732bb8b32d60c746794d95a5127afafad948 config.yaml
"

38
config/loki/config.yaml Normal file
View File

@ -0,0 +1,38 @@
auth_enabled: false
server:
http_listen_address: 0.0.0.0
http_listen_port: 7553
register_instrumentation: true
ingester:
lifecycler:
address: 127.0.0.1
ring:
kvstore:
store: inmemory
replication_factor: 1
final_sleep: 0s
chunk_idle_period: 5m
chunk_retain_period: 30s
schema_config:
configs:
- from: 2021-12-16
store: boltdb
object_store: filesystem
schema: v11
index:
prefix: index_
period: 168h
storage_config:
boltdb:
directory: /var/lib/loki/index
filesystem:
directory: /var/lib/loki/chunks
limits_config:
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 168h

View File

@ -0,0 +1,19 @@
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
. ../APKBUILD-config.template
pkgver=2022.02.03.01
pkgrel=0
source="
config.yaml
"
package() {
rx_install config.yaml
install -dm700 "$(rx_cpkgdir)"/var/lib/prometheus
}
sha512sums="
a8fae8e3f808fa42599e20c098b36fd598260ff8390ba8da0aabe7940c8e9880f7945855eba710e9520be88d8cfb7c4c54cceb2ebbe9d53aa2318117a98cd5af config.yaml
"

View File

@ -0,0 +1,8 @@
global:
scrape_interval: 5s
scrape_configs:
- job_name: "linux"
dns_sd_configs:
- names: [ 'node_exporters.prometheus.routinginfo.internal' ]
type: 'SRV'

View File

@ -3,7 +3,7 @@
. ../APKBUILD-data.template
pkgver=2021.12.30.01
pkgver=2022.02.03.01
pkgrel=0
checkdepends="bind-tools"
makedepends="
@ -69,6 +69,6 @@ internal() {
}
sha512sums="
2fe4fd00c5aa1de97862b6d20b477ad284ff32d24d77eeae9974412480ece77b7c677930f07a09b84e16804d38505bfb97beeace93b3da7eca0f2782a81e058c redxen.eu
71588fc99e8fa42f6e47d29d941e8b4af2bf10b3e2839c4ddb0dd770f25c3b224227725e7911124c99937350768f7871b35abd83fc1912ddafcab41b36e34f4f internal
7232c54d1b07910631af39424ae58e7749b9411ba79aae31e8ff90547faadc9219a7c878fc48d3380aee80eb57dea4493781cfdaae3bf55bfc25411a7412d1b2 redxen.eu
154ba153566d198159ec4f007677e3a595a4ba9949ae9246b89a3ebfceac0b6c37296fc1b2f1d4cc0f23175736f3ac975213605dfe3026723ad098f10574aa68 internal
"

View File

@ -23,6 +23,11 @@ $TTL 120
12180711.fsn1-dc14.hetzner 86400 A 10.10.0.6
; Services
node_exporters.prometheus.routinginfo SRV 0 5 7580 12180623.nbg1-dc3.hetzner
SRV 0 5 7580 12180621.nbg1-dc3.hetzner
SRV 0 5 7580 12180625.nbg1-dc3.hetzner
SRV 0 5 7580 12180710.fsn1-dc14.hetzner
SRV 0 5 7580 12180711.fsn1-dc14.hetzner
_grafana._tcp.routinginfo SRV 0 5 7577 12180621.nbg1-dc3.hetzner
SRV 0 5 7577 12180710.fsn1-dc14.hetzner
_gitea._tcp.routinginfo SRV 0 5 7570 12180711.fsn1-dc14.hetzner
@ -34,6 +39,8 @@ _seedown._tcp.routinginfo SRV 0 5 7576 12180710
postgresql.routinginfo CNAME 12180625.nbg1-dc3.hetzner
redis.routinginfo CNAME 12180625.nbg1-dc3.hetzner
loki.routinginfo CNAME 12180625.nbg1-dc3.hetzner
prometheus.routinginfo CNAME 12180625.nbg1-dc3.hetzner
influxdb.routinginfo CNAME 12180625.nbg1-dc3.hetzner
rspamd.routinginfo CNAME 12180623.nbg1-dc3.hetzner
opendkim.routinginfo CNAME 12180623.nbg1-dc3.hetzner

View File

@ -87,9 +87,6 @@ imap CNAME 12180623.nbg1-dc
@ TXT "v=spf1 mx -all"
_DMARC TXT "v=DMARC1; p=quarantine; rua=mailto:postmaster@redxen.eu; ruf=mailto:postmaster@redxen.eu; fo=1; pct=100"
; Mumble
_mumble._tcp SRV 0 5 64738 12180623.nbg1-dc3.hetzner
; ACME
_acme-challenge 300 TXT "eS7eDpgZN0YykZ3eazlDdZ40BXAL5XjdLaU2phH-2FE"
_acme-challenge 300 TXT "do9dQL6ImWbkZ_eoOK_BzRm9GWXIWwYgFSFN7Q2ZLsM"
@ -97,4 +94,7 @@ _acme-challenge 300 TXT "do9dQL6ImWbkZ_e
ripped-condoms MX 0 mail.ripped-condoms
mail.ripped-condoms A 18.222.170.67
; Autodiscovery
_mumble._tcp SRV 0 5 64738 12180623.nbg1-dc3.hetzner
; Build-time records and custom ones

View File

@ -0,0 +1,12 @@
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
. ../APKBUILD-openrc.template
pkgver=2022.01.21.02
pkgrel=0
sha512sums="
277e0b18fef313dd546396356123fb475e9cad6cce6a3af284679534fe08f0718265a2c937f6b358c3e02ab3f2fda78a24d6fdc915ed30d9d1fbd95bb1cea79f runfile
7d5d54ba0937b6ada1fdfd6d53d1f022009cb9c2bfb5afd804a59b6522747f1dbf6702991dd89b0a87ff9c1ecfa04bd0250e4ce5c36f337a18d54ae1e322b9e9 conffile
"

View File

@ -0,0 +1,5 @@
# The promtail config file
PROMTAIL_CONF="/etc/redxen/loki-promtail/config.yaml"
# Add any extra options to pass to promtail to this setting.
#PROMTAIL_OPTS=""

View File

@ -0,0 +1,14 @@
#!/sbin/openrc-run
configfile="${PROMTAIL_CONF:-/etc/loki/promtail-local-config.yaml}"
name="${name:-Promtail}"
command="/usr/bin/promtail"
command_args="-config.file=${configfile} ${PROMTAIL_OPTS}"
command_background=yes
make_pidfile=yes
pidfile="/run/${RC_SVCNAME}.pid"
depend() {
need net
}

12
openrc/loki/APKBUILD Normal file
View File

@ -0,0 +1,12 @@
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
. ../APKBUILD-openrc.template
pkgver=2022.01.04.03
pkgrel=0
sha512sums="
72ee1894736d7bca005a96b37ef3e4c6cbac5297f623f5f63e9c785914360634efd299522ebfcf4a374b3c6293b4103ec9c8b2f3b9d0129d2c8629a668ab0f1f runfile
76c932b2939be66c4208d7657c274cfd98b8c7946a041f892124341a6814be0b5c7bdacab3e088121bdabc01940acde43455c114d4b375458f31df1c4c2dec39 conffile
"

5
openrc/loki/conffile Normal file
View File

@ -0,0 +1,5 @@
# The loki config file
LOKI_CONF="/etc/redxen/loki/config.yaml"
# Add any extra options to pass to loki to this setting.
#LOKI_OPTS=""

10
openrc/loki/runfile Normal file
View File

@ -0,0 +1,10 @@
#!/sbin/openrc-run
configfile="${LOKI_CONF:-/etc/loki/loki-local-config.yaml}"
command=/usr/bin/loki
command_args="-config.file=${configfile}
${LOKI_OPTS}"
command_background=yes
make_pidfile=yes
pidfile=/var/run/loki.pid

View File

@ -0,0 +1,13 @@
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
. ../APKBUILD-openrc.template
pkgver=2022.02.03.02
pkgrel=0
depends="openrc $_rx_pkgname"
sha512sums="
1ce3ec50377ff736f9d9009bdd951b5e31089ac9446d1a148edc0ebca2e26e70039a7675136d2fa0266a6db531c82cc005f5ab5be001b109cab334fb62c5c7be runfile
529d384b3c0deb30ade373a027bb733fbb1ccc9a77f172b52f6229ee478a7e931ae0c55953fc03ff46139906081e43a5f6f0218888ed8a02643c3a1b2d48a466 conffile
"

View File

@ -0,0 +1,6 @@
command_args="\
--web.listen-address=':7580' \
--collector.tcpstat \
--collector.processes \
--collector.mountstats \
"

View File

@ -0,0 +1,13 @@
#!/sbin/openrc-run
supervisor=supervise-daemon
command="/usr/bin/node_exporter"
command_background="yes"
pidfile="/var/run/${SVCNAME}.pid"
command_user="prometheus:prometheus"
depend() {
need net
after firewall
}

View File

@ -0,0 +1,12 @@
# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer: Alex Denes <caskd@redxen.eu>
. ../APKBUILD-openrc.template
pkgver=2022.02.03.03
pkgrel=0
sha512sums="
8417a9b052cd0ba10fd751a5eccbddb1819855bf7dd90aa885323581907a219c227ba3b2dd35c37fbeefb6ab09c5acced86709dcaf98fa7329cf583f657175c6 runfile
e2cb3e5f5cbefcabbddcae049fd4975434ab346c7c834c08250a92892ace4bf3d199ce2272851821b6146a319b6cda02661abb74554c82e94cec23f3b8d7a2eb conffile
"

View File

@ -0,0 +1,4 @@
prometheus_config_file=/etc/redxen/prometheus/config.yaml
prometheus_storage_path=/var/lib/prometheus/data
prometheus_retention_time=30d
prometheus_listen_address="0.0.0.0:7554"

28
openrc/prometheus/runfile Normal file
View File

@ -0,0 +1,28 @@
#!/sbin/openrc-run
name="prometheus"
description="prometheus monitoring system & time series database"
supervisor=supervise-daemon
command=/usr/bin/prometheus
command_args="--config.file=$prometheus_config_file \
--storage.tsdb.path=$prometheus_storage_path \
--storage.tsdb.retention.time=$prometheus_retention_time \
--web.listen-address=$prometheus_listen_address"
command_user="prometheus:prometheus"
extra_started_commands="reload"
# prometheus need to open a lot chunks
rc_ulimit="${prometheus_ulimit:--n 65536}"
start_pre() {
[ -n "$output_log" ] && checkpath -f "$output_log" \
-m 644 -o prometheus:prometheus
[ -n "$error_log" ] && checkpath -f "$error_log" \
-m 644 -o prometheus:prometheus
checkpath -d "$prometheus_storage_path" -m 755 -o prometheus:prometheus
}
reload() {
ebegin "Reloading $RC_SVCNAME"
supervise-daemon $RC_SVCNAME --signal HUP
eend $?
}