2019.10.31 Zabbix monitoring host environment initialization and add

First, the test environment preparation

CentOS: 192.168.200.111 server.zabbix.com

CentOS: 192.168.200.112 agent.zabbix.com

Windows10:192.168.200.110    windows10

111:

hostname server.zabbix.com

bash

vim / etc / hostname added:

server.zabbix.com

vim / etc / hosts to add:

192.168.200.111 server.zabbix.com
192.168.200.112 agent.zabbix.com
192.168.200.110 windows10

scp /etc/hosts 192.168.200.112:/etc

112:

hostname agent.zabbix.com

bash

vim / etc / sysconfig / network added:

HOSTNAME=agent.zabbix.com

Ensure that the first host access to the Internet: the ping www.baidu.com

Two virtual machines off the firewall and security mechanisms:

systemctl stop firewalld
setenforce 0
iptables -F

Two, Server-side

1, configure yum Ali cloud sources

cd /etc/yum.repos.d/
wget http://mirrors.aliyun.com/repo/Centos-7.repo

[root@server yum.repos.d]# ls
a Centos-7.repo CentOS-Media.repo

 yum -y install httpd mariadb-server mariadb mariadb-devel php php-mbstring php-mysql php-bcmath php-gd php-xmlrpc php-ldap php-xml libevent libevent-devel net-snmp net-snmp-devel libxml2 libxml2-devel ntpdate(共19个软件包)

 s1a.time.edu.cn ntpdate               / server time synchronization time of Tsinghua University

2, start the corresponding service LAMP

cd
systemctl start mariadb
systemctl enable mariadb
systemctl start httpd
systemctl enable httpd

mysqladmin -u root password 123

3, ready java environment

Javac Java comes not so deleted

rm -rf /usr/bin/java

The jdk-8u191-linux-x64.tar.gz upload and unzip

tar xf jdk-8u191-linux-x64.tar.gz 

mv jdk1.8.0_191/ /usr/local/java

Modify vim / etc / profile

export JAVA_HOME=/usr/local/java
export PATH=$PATH:$JAVA_HOME/bin

source /etc/profile

java -version

javac -version

4, source installation zabbix

The zabbix-3.4.11.tar.gz upload and unzip

 tar xf zabbix-3.4.11.tar.gz -C /usr/src/

 cd /usr/src/zabbix-3.4.11/

The following first installation package

yum -y install gcc gcc-c++ make curl-devel

./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --enable-java && make -j2 && make install

5, Mariadb database authorization

 cd

mysql -uroot -p123

MariaDB [(none)]> create database zabbix character set utf8;

MariaDB [(none)]> grant all on zabbix.* to zabbix@localhost identified by 'zabbix';

MariaDB [(none)]> grant all on zabbix.* to zabbix@'192.168.200.111' identified by 'zabbix';

MariaDB [(none)]> flush privileges;

MariaDB [(none)]> exit

Unzip into the path:

cd /usr/src/zabbix-3.4.11/

mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql
mysql -uzabbix -pzabbix zabbix < database/mysql/images.sql
mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql

Log in to check:

mysql -uroot -p123

show databases;

use zabbix;

Tables Show;           / row 140

5, create user and authorization procedures prevent zabbix permission error

useradd -M -s /sbin/nologin zabbix
cd /usr/local/
chown -R zabbix:zabbix zabbix/
cd ./zabbix/
pwd
mkdir logs
chown zabbix:zabbix logs/
cp -p etc/zabbix_server.conf{,.bak}
cp -p etc/zabbix_agentd.conf{,.bak}

6, modify the configuration file zabbix

cd /usr/local/zabbix/etc/

vim zabbix_server.conf      file contents:

LogFile=/usr/local/zabbix/logs/zabbix_server.log
PidFile=/tmp/zabbix_server.pid
DBHost=192.168.200.111
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBSocket=/var/lib/mysql/mysql.sock
Include=/usr/local/zabbix/etc/zabbix_server.conf.d/*.conf

vim zabbix_agentd.conf

PidFile=/tmp/zabbix_agentd.pid
Server=127.0.0.1,192.168.200.111
ServerActive=192.168.200.111
Hostname=server.zabbix.com
LogFile=/usr/local/zabbix/logs/zabbix_agentd.log
Include=/usr/local/zabbix/etc/zabbix_agentd.conf.d/*.conf

7, apache and php configuration

mv /usr/src/zabbix-3.4.11/frontends/php/ /var/www/html/zabbix
chown -R apache:apache /var/www/html/zabbix/
vim /etc/php.ini

878:date.timezone = Asia/Shanghai

384:max_execution_time = 300

394:max_input_time = 300

672:post_max_size = 32M

405:memory_limit = 128M

854: Extension = bcmath.so (add your own manual)

8, web mounting zabbix (web interface)

Access 192.168.200.111/zabbix

 

Guess you like

Origin www.cnblogs.com/990624lty-jhc/p/11773985.html