##Introduction Script to create a backup Zabbix monitoring server, as backend be used PostgresSQL, Web interface will run through Nginx and php-fpm. Tested on these dependences.
###Dependencies
№ | Dependencies |
---|---|
1 | СentOS 7 |
2 | Zabbix 2.4 |
3 | PostgreSQL 9.4 |
4 | Nginx 1.8.0 |
5 | php-fpm 5.4.16-36 |
vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
yum install http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm -y
yum install http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-1.noarch.rpm -y
yum makecache
###Import SQL dump the contents of the database
psql -U postgres zabbix < zabbix-db-`date +%Y%m%d`.sql
###Unpack zabbix-config
tar xvf zabbix-config-`date +%Y%m%d`.tar -C /
###Give the right to use files zabbix
chown zabbix:zabbix /etc/httpd/conf.d/zabbix.conf
chown -R apache:apache /etc/zabbix/web
chown -R zabbix:zabbix /usr/lib/zabbix
###Setting NGINX
vim /etc/nginx/nginx.conf
find the line:
user nginx;
change it to
user apache;
###Unpack gunzip
gunzip zabbix-db-`date +%Y%m%d`.sql.gz > zabbix-db-`date +%Y%m%d`.sql
gunzip zabbix-config-`date +%Y%m%d`.tar.gz >zabbix-config-`date +%Y%m%d`.tar