CentOS 7.6 build LAMP deployment Zabbix monitoring environment

First, install the LAMP environment 

1, install apache

-y install httpd yum 

httpd service boot self start: systemctl enable httpd

start httpd service: systemctl start httpd

open 80 ports: iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT

View port number: iptables -L -n
yum -y install wget

1.1.MySQL installation

Mysql download the repo source:

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

Installation mysql-community-release-el7-5.noarch.rpm package

rpm -ivh mysql-community-release-el7-5.noarch.rpm

Install MYSQL

sudo yum install -y  mysql-server

Restart the service:

systemctl restart mysql 或
systemctl restart mysql.service

Log in and change your password:

mysql -u root
mysql > use mysql;
mysql > update user set password=password(‘123456‘) where user=‘root‘;
mysql > flush privileges;
mysql > exit;

Php installation environment

yum -y install php
rpm -ql php

 The php and mysql associate

yum install -y php php-mysql
rpm -ql php-mysql

 Installation of common PHP module

yum install -y php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel php-bcmath
Into the test file:
cd / var / www / html
echo '<?php phpinfo();?>' >index.php

Restart apache server

 systemctl restart httpd

Zabbix installation repository

rpm -i https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
Bay  install Zabbix server, client, agent
yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
Creating the initial database:
# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to 'zabbix'@'%' identified by 'zabbix';
mysql> source create.sql; mysql
> quit;
Zabbix configuration database server
vim /etc/zabbix/zabbix_server.conf

 

 Edit the file /etc/httpd/conf.d/zabbix.conf, uncommented and set the correct time zone for you.

vim /etc/httpd/conf.d/zabbix.conf

在:# php_value date.timezone Europe/Riga

 加:php_value date.timezone Asia/Shanghai

 After you install normal zabbix, after logging zabbix monitoring error zabbix server is not running: the information displayed may not be current

The following scenarios are likely to cause this error,

1. selinux is closed. Be sure to close the open selinux will cause a series of problems, even zabbix the discovery function can not be used normally

Close SELinux method:
Temporary closure: setenforce 0

Permanent closure: vi / etc / selinux / config

Note:
setenforce 1 becomes enforcing mode setting SELinux
setenforce 0 becomes permissive mode setting SELinux 
Increase in the startup parameters lilo or grub of: selinux = 0, can also turn off selinux

Turn off the firewall

Temporary closure: systemctl stop firewalld.service

Permanent closure: systemctl disable firewalld.service

1. Installation Agent (disposed on the target host monitoring)

rpm -i https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

Installation method and installation as zabbix

yum install zabbix-agent zabbix-sender -y

Modify agent profiles

vim /etc/zabbix/zabbix_agentd.conf
vim /etc/zabbix/zabbix_agentd.conf

PidFile=/var/run/zabbix/zabbix_agentd.pid

LogFile=/var/log/zabbix/zabbix_agentd.log

LogFileSize=0

Server = 192.168.2.76  monitoring servers which host

ListenIP=0.0.0.0

Home Agents = 3

ServerActive = 127.0.0.1 monitored servers which host

Hostname = node1 monitored host name

Start agent service

systemctl start zabbix-agent

Then the monitor included in the manual zabbix web interface Host Host

I remember being monitored host is down: selinux.

Guess you like

Origin www.linuxidc.com/Linux/2019-06/158984.htm