mirror of
https://gh.llkk.cc/https://github.com/WeblateOrg/scripts.git
synced 2025-10-03 15:01:00 +08:00
41 lines
1.2 KiB
Bash
Executable file
41 lines
1.2 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
# shellcheck disable=SC1091
|
|
. /etc/weblate-bootstrap
|
|
|
|
# Munin
|
|
mkdir -p /etc/munin/plugin-conf.d/
|
|
cat > /etc/munin/plugin-conf.d/postgres <<EOT
|
|
[postgres_*]
|
|
user postgres
|
|
env.PGUSER postgres
|
|
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 $(sudo -u weblate /home/weblate/weblate-env/bin/weblate shell -c 'from weblate.auth.models import User; user = User.objects.create(username="monitor"); print(user.auth_token.key)')
|
|
EOT
|
|
|
|
# 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
|