forked from ffulm/server-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stats.sh
executable file
·60 lines (51 loc) · 1.58 KB
/
stats.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
echo "${green}*********************${col_reset}"
echo "${green}* set up statistics *${col_reset}"
echo "${green}*********************${col_reset}"
case "$munin_type" in
"client")
echo "(I) ${green} Setup statistic client (munin)${col_reset}"
# get munin node package
apt install --assume-yes munin-node
cp -f etc/munin/munin-node.conf /etc/munin/
# substitute hostname in munin-node.conf
sed -i "s/host_name\ vpnX/host_name\ $ff_servername/g" /etc/munin/munin-node.conf
# restart client
/etc/init.d/munin-node restart
;;
"server")
echo "(I) ${green} Setup statistic server (munin)${col_reset}"
# get munin package
apt --assume-yes install munin
cp -f etc/munin/munin.conf /etc/munin/
# create webroot even if no webserver installed
mkdir -p /var/www/munin/
chown www-data.www-data /var/www/munin/
# link to it
ln -s /var/cache/munin/www/ /var/www/munin
/etc/init.d/munin restart
;;
*)
echo "(E) ${red} Provide \"client\" or \"server\" in setup.sh${col_reset}"
exit 1
;;
esac
# DEACTIVATED
#{
# get vnstat backend
#echo "(I) ${green} Setup statistic client (vnstat)${col_reset}"
#apt install --assume-yes php5-cgi vnstat
# remove remains of vnstat frontend
#rm -rf /var/www/vnstat/
# get vnstat frontend anew
#git clone https://github.com/bjd/vnstat-php-frontend /var/www/vnstat/
#chown www-data.www-data /var/www/vnstat/
# copy config
#cp -f etc/vnstat.conf /etc/
#cp -f etc/vnstat/config.php /var/www/vnstat/
# add vnstat interface for main NIC
#vnstat -u -i eth0
# grant access for vnstat
#chown vnstat.vnstat /var/lib/vnstat/eth0
#}
exit 0