1. 程式人生 > >aws上部署zabbix3.4

aws上部署zabbix3.4

agentd rac 技術 默認 out mit sha bus fail

三臺機器

10.0.0.149  AmazonLinux2.0  zabbix-server zabbix-agent
10.0.1.61   CentOS6.9       zabbix-agent
10.0.1.119  CentOS6.9       zabbix-agent

1、安裝zabbix-server和web管理界面。

# cd /etc/yum.repos.d/
# vim zabbix.repo
[zabbix]
name=zabbix3.4
baseurl=http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/
gpgcheck=0

# vim epel.repo
[epel]
name=epel-release
baseurl=https://dl.fedoraproject.org/pub/epel/7/x86_64/
gpgcheck=0

# yum install -y zabbix-server-mysql zabbix-web-mysql

2、安裝配置數據庫並啟動zabbix-server。

# yum install -y mariadb-server mariadb mariadb-devel
# systemctl start mariadb.service
# systemctl enable mariadb.service

# mysql_secure_installation
# mysql -uroot -p
> create database zabbix character set utf8 collate utf8_bin;
> grant all privileges on zabbix.* to zabbix@localhost identified by ‘PASS‘;
> quit;

# cd /usr/share/doc/zabbix-server-mysql-3.4.7/
# zcat create.sql.gz | mysql -uroot zabbix -p

# vim /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=Monkey6l8

# systemctl start zabbix-server.service
# systemctl enable zabbix-server.service

3、httpd會被依賴安裝。修改php時區,並啟動httpd。

# vim /etc/php.ini
[Date]
date.timezone = Asia/Shanghai

# vim /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
# php_value date.timezone Europe/Riga
php_value date.timezone Asia/Shanghai

# systemctl start httpd.service
# systemctl enable httpd.service

4、設置域名。配置nginx。

在dns上加一條CNAME指向LB即可。

# cd /etc/nginx/vhosts/
# vim zabbix-aws.oupeng.com.conf
upstream zabbix-aws-oupeng-com {
    server 10.0.0.149:80 weight=10 max_fails=3 fail_timeout=10;
}

server {
    listen 80;
    server_name zabbix-aws.oupeng.com;

    location / {
        proxy_pass http://zabbix-aws-oupeng-com;
        include proxy.conf;
        break;
    }

    access_log /data/log/nginx/zabbix-aws.oupeng.com.access.log main;
    error_log /data/log/nginx/zabbix-aws.oupeng.com.error.log;
}

5、訪問web界面,完成初始化。

默認用戶密碼為 Admin/zabbix。需要註意的是,這裏的用戶名區分大小寫。

6、安裝zabbix-agent。

# yum install -y zabbix-agent

# systemctl start zabbix-agent.service
# systemctl enable zabbix-agent.service

在另外兩臺機器上安裝客戶端。由於系統版本不同,這裏要單獨添加repo。

# cd /etc/yum.repos.d/
# vim zabbix.repo
[zabbix]
name=zabbix3.4
baseurl=http://repo.zabbix.com/zabbix/3.4/rhel/6/x86_64/
gpgcheck=0

# yum install -y zabbix-agent

修改監聽地址。

# vim zabbix_agentd.conf
Server=10.0.0.149

# service zabbix-agent start
# chkconfig zabbix-agent on

7、到這裏,基礎安裝就完成了。在web上添加三臺主機就可以開始設置監控了。
技術分享圖片
技術分享圖片

aws上部署zabbix3.4