forked from softfire-eu/public-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-zabbix.sh
68 lines (42 loc) · 2.29 KB
/
install-zabbix.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
61
62
63
64
65
66
67
68
#!/bin/bash
export LC_ALL=C
export DEBIAN_FRONTEND="noninteractive"
if [[ -z "$zabbix_pwd" ]]; then
zabbix_pwd=zabbix
fi
if [ -z $mysql_pwd ]; then
mysql_pwd=root
fi
echo '# Zabbix Application PPA' >> /etc/apt/sources.list
echo 'deb http://ppa.launchpad.net/tbfr/zabbix/ubuntu precise main' >> /etc/apt/sources.list
echo 'deb-src http://ppa.launchpad.net/tbfr/zabbix/ubuntu precise main' >> /etc/apt/sources.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C407E17D5F76A32B
sudo apt-get update
# avoid promt of pwd
export DEBIAN_FRONTEND="noninteractive"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password password root"
sudo debconf-set-selections <<< "mysql-server mysql-server/root_password_again password root"
sudo apt-get install -y mysql-server-5.6
sudo apt-get install -y zabbix-server-mysql php5-mysql zabbix-frontend-php
echo "" >> /etc/zabbix/zabbix_server.conf
echo "" >> /etc/zabbix/zabbix_server.conf
echo "DBPassword=$zabbix_pwd" >> /etc/zabbix/zabbix_server.conf
cd /usr/share/zabbix-server-mysql/
sudo gunzip *.gz
mysql -u root -proot -e "create user 'zabbix'@'localhost' identified by '$zabbix_pwd';"
mysql -u root -proot -e "create database zabbix;"
mysql -u root -proot -e "grant all privileges on zabbix.* to 'zabbix'@'localhost';flush privileges;"
mysql -u zabbix -p$zabbix_pwd zabbix < schema.sql
mysql -u zabbix -p$zabbix_pwd zabbix < images.sql
mysql -u zabbix -p$zabbix_pwd zabbix < data.sql
sed -i -e "s/post_max_size = 8M/post_max_size = 16M/g" -e "s/max_execution_time = 30/max_execution_time = 300/g" -e "s/max_input_time = 60/max_input_time = 300/g" -e "s/;date.timezone =/date.timezone = UTC/g" /etc/php5/apache2/php.ini
sudo cp /usr/share/doc/zabbix-frontend-php/examples/zabbix.conf.php.example /etc/zabbix/zabbix.conf.php
sed -i -e "s/zabbix_password/zabbix/g" /etc/zabbix/zabbix.conf.php
sudo cp /usr/share/doc/zabbix-frontend-php/examples/apache.conf /etc/apache2/conf-enabled/zabbix.conf
sudo a2enmod alias
sudo service apache2 restart
sed -i -e "s/START=no/START=yes/g" /etc/default/zabbix-server
sudo service zabbix-server restart
# mysql -u zabbix -p$zabbix_pwd zabbix -e "update actions set status = 0 where name like '%Auto discovery%';"
python /opt/openbaton/scripts/zabbix-set-discovery.py
sudo apt-get install -y rabbitmq-server