Add telegraf monitoring for postgresql

This commit is contained in:
Alex D. 2021-06-06 14:26:46 +00:00
parent ebbd2096e7
commit 587d280601
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
3 changed files with 40 additions and 12 deletions

1
.gitignore vendored
View File

@ -5,6 +5,7 @@ pkg/
secret/alpinepkg-httpauth/secret
secret/letsencrypt/private.key
config/telegraf/secret
config/grafana/secret
config/wireguard/secret
config/murmur/secret

View File

@ -3,11 +3,14 @@
. ../APKBUILD-config.template
pkgver=2021.06.01.05
pkgver=2021.06.06.03
pkgrel=0
options=""
checkdepends="telegraf"
source="main.conf"
source="
main.conf
secret
"
_modules="
base
unbound
@ -15,6 +18,7 @@ _modules="
haproxy
rspamd
wireguard
postgresql
"
for i in $_modules; do
@ -22,6 +26,12 @@ for i in $_modules; do
subpackages="$subpackages $pkgname-$i"
done
build() {
. secret
cp postgresql.conf postgresql.conf-mod
rx_replace "POSTGRESQL_PASSWORD" "$POSTGRESQL_PASSWORD" "postgresql.conf-mod"
}
check() {
telegraf --config main.conf --config base.conf --test >/dev/null
}
@ -32,41 +42,55 @@ package() {
base() {
install_if="$pkgname"
_rx_installdir="$_rx_installdir/module" rx_install base.conf
_modinstall "base"
}
unbound() {
install_if="$pkgname redxen-config-unbound-rctrl"
_rx_installdir="$_rx_installdir/module" rx_install unbound.conf
_modinstall "unbound"
}
postgresql() {
install_if="$pkgname redxen-config-postgresql"
_rx_installdir="$_rx_installdir/module" rx_install "postgresql.conf-mod" "postgresql.conf"
}
redis() {
install_if="$pkgname redxen-config-redis"
_rx_installdir="$_rx_installdir/module" rx_install redis.conf
_commonmod
}
haproxy() {
install_if="$pkgname redxen-config-haproxy"
_rx_installdir="$_rx_installdir/module" rx_install haproxy.conf
_commonmod
}
rspamd() {
install_if="$pkgname redxen-config-rspamd"
_rx_installdir="$_rx_installdir/module" rx_install rspamd.conf
_commonmod
}
wireguard() {
install_if="$pkgname redxen-config-wireguard"
_rx_installdir="$_rx_installdir/module" rx_install wireguard.conf
_commonmod
}
_commonmod() {
modname="${subpkgname##$pkgname-}"
install_if="$pkgname redxen-config-$modname"
_modinstall "$modname"
}
_modinstall() {
_rx_installdir="$_rx_installdir/module" rx_install "$1".conf
}
sha512sums="
5a0f1dab5c4887700f7f29eeb0d1be28690737f1689a12e67861be4c0bb8276ece8fcb279983e6e3bc5484bd6aa932b663d6ff775c68e33c1190fcdbaa3b1889 main.conf
3f01fceee3333cb4f1723333d2e8f7c77e2cf2d2d5a6d7679ebcdb4edda23db22ebe1bd4eeec1a92a0245ef81b6a0849a4b9341fa66092ea82149100d189e037 secret
532d6b79eafb7629ef3f2a16f2f9323369d93357b301e44c111661eab8108a3d09dae1fd2c7f8a4c3d832c66285e2098fcd7713f37b545b5616d7c9a749a2684 base.conf
5a81b295f17189115fe93d1d68d94181aaab32dfcdd3e4d0480991c515d0cec57cb58bac354b893a5109a9e62d400a278489c9d64b997968ad8f326e02c7ddb1 unbound.conf
a4bc80850c94291d00b2ad56e50216ab36515bcc176b3c5678b24c3d5a3740b9de9006df8e37e42942a50227e6b27321d267e27decffbf6d9a37755d3224121e redis.conf
f219fcd9c1aeb4503e813f00c51cc2a2ccb8c297727f3542e614c784b977ef6a32d492de750b8d4338f95172dfdc0e388a72662e80c92a890e2bfc7d34e3396d haproxy.conf
0e5e8282a77553cf75b3184367486d37f4dd6e6ed5a216f2ca5b94f4fe7b151565eb5d9fc35f5eadc154da41aa39f0f7979ded054be9da94b981326ca13c6b8f rspamd.conf
3f6d05082d4e01fb7498c82fb92fb479c5766148c9dcfd118d248ceaf6838f4794b940a8fcff0ec6020000806c6418f93e5aa60cbf32fd826fa4f9870f925ba7 wireguard.conf
cd891003216a1f0b1d7718b0cda39f798984a5a0ffae11b87edc933f2a96c15255cddaa19e8bb5514c7e1c2478c46d5042043a4af6e21805188863e29606daab postgresql.conf
"

View File

@ -0,0 +1,3 @@
[[inputs.postgresql]]
address = "postgres://telegraf:POSTGRESQL_PASSWORD@localhost:7550/postgres?sslmode=disable"
ignored_databases = ["template0", "template1"]