пятница, 30 июня 2017 г.

How to install Zabbix server 3.0 with RDS MySQL on Amazon linux

1) Create Mysql RDS
2) yum install mysql
3) check the connection : mysql -h <name of endpoint  in RDS> -u root -p PASSWORD 
create database and give permissions: 
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@'%' identified by 'zabbix';
    FLUSH PRIVILEGES; 
4) download zabbix: curl -O http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm (NOT EL7 or centos 7! only 6!)
5) rpm -ivh zabbix-release-3.0-1.el6.noarch.rpm
6) yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent zabbix-java-gateway
7) chkconfig zabbix-server on


set connection to RDS: 
vi /etc/zabbix/zabbix_server.conf
DBHost=<name of endpoint  in RDS>
DBName=zabbix
DBUser=zabbix
DBPassword=PASSWORD


8) create zabbix schema from  the template:
zcat /usr/share/doc/zabbix-server-mysql-3.0.9/create.sql.gz | mysql zabbix -u zabbix -pPASSWORD -h <name of endpoint  in RDS> 
9) yum install httpd24 php54 (PHP 5.4.0 is required for Zabbix 3.0 web frontend) 
yum install php54-mysqlnd.x86_64 php54-gd php54-bcmath php54-pdo php54-xml php54-mbstring 
if httpd and php 5.3 was installed (max versions in amazon linux) - do this 
    sudo yum list installed | grep "php"
       sudo yum remove httpd*
   sudo yum list installed | grep "php"
  yum remove php-cli.x86_64 php-common.x86_64
   sudo yum install httpd24 php54 php54-mysqlnd.x86_64 php54-gd php54-bcmath php54-pdo php54-xml php54-mbstring

chkconfig httpd on
10) sudo chown -R apache:apache /usr/share/zabbix/
11) sudo chown -R apache:apache /etc/zabbix/web/
12) vi  /etc/httpd/conf.d/zabbix.conf 
Alias /zabbix /usr/share/zabbix/
<Directory /usr/share/zabbix>
RemoveHandler .php
AddType application/x-httpd-php .php
php_admin_value open_basedir /usr/share/zabbix:/usr/share/zabbix-agent:/usr/share/zabbix-server:/etc/zabbix:/tmp:.:..:./:../
AllowOverride All
Require all granted
Order allow,deny
Allow from all
</Directory>

13) Go to PUBLIC (PRIVATE) IP with /zabbix (http://34.226.45.64/zabbix in my case) and look at
 Check of pre-requisites and change what's needed
14) change php.ini settings 
vim /etc/php.ini

post_max_size = 16M
max_input_time = 600
max_execution_time = 300
date.timezone = Asia/Jerusalem
15) Configure DB connection settings via web interface - endpoint url instead of localhost
16) Finish the installation and start zabbix agent:

vi /etc/zabbix/zabbix_agentd.conf
        change ServerActive and Hostname
/etc/init.d/zabbix-agent start
chkconfig zabbix-agent on

1 комментарий:

Bash: MySql backup (file per db), restore+ users and privileges

Backup Mysql DB (file per db) #!/bin/bash USER="root" databases=`mysql -u $USER -e "SHOW DATABASES;" | tr -d "|...