mirror of
https://gh.wpcy.net/https://github.com/WeblateOrg/scripts.git
synced 2026-04-24 14:42:19 +08:00
48 lines
1.2 KiB
Bash
Executable file
48 lines
1.2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
# shellcheck disable=SC1091
|
|
. /etc/weblate-bootstrap
|
|
|
|
# Set path to include script directory
|
|
PATH="$(dirname "$(readlink -f "$0")"):$PATH"
|
|
export PATH
|
|
|
|
# Munin
|
|
mkdir -p /etc/munin/plugin-conf.d/
|
|
cat > /etc/munin/plugin-conf.d/postgres << EOT
|
|
[postgres_*]
|
|
user weblate
|
|
env.PGHOST 127.0.0.1
|
|
env.PGUSER weblate
|
|
env.PGPASSWORD weblate
|
|
EOT
|
|
cat > /etc/munin/plugin-conf.d/redis << EOT
|
|
[redis]
|
|
env.host1 127.0.0.1
|
|
env.port1 6379
|
|
EOT
|
|
|
|
# Plugins
|
|
mkdir -p /usr/share/munin/plugins/
|
|
cd /usr/share/munin/plugins/
|
|
wget https://raw.githubusercontent.com/munin-monitoring/contrib/master/plugins/redis/redis
|
|
wget https://raw.githubusercontent.com/WeblateOrg/munin/master/weblate
|
|
wget https://raw.githubusercontent.com/WeblateOrg/munin/master/ksm
|
|
chmod +x redis weblate ksm
|
|
cat > /etc/munin/plugin-conf.d/weblate_servers << EOT
|
|
[weblate]
|
|
env.SERVER https://$WEBLATE_DOMAIN/
|
|
env.KEY
|
|
EOT
|
|
create-monitor-user
|
|
|
|
# Install and configure munin
|
|
# The mkdir is needed on Ubuntu (used for CI)
|
|
mkdir /run/munin/
|
|
chmod 777 /run/munin/
|
|
apt install -y munin-node munin-plugins-extra libdbd-pg-perl libwww-perl libswitch-perl
|
|
|
|
sed -i '/allow.*::1/ a allow ^172\\.16\\.0\\.9$' /etc/munin/munin-node.conf
|
|
systemctl restart munin-node
|