install zabbix 3 (LTS) in centos 7 with mariadb

# install install zabbix 3 (LTS) in centos 7
yum install mariadb-server mariadb -y
systemctl enable mariadb
systemctl start mariadb

# install httpd
yum install httpd -y
systemctl enable httpd
systemctl start httpd

# install zabbix-server, zabbix-agent
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
yum install zabbix-server-mysql zabbix-web-mysql -y
yum install zabbix-agent -y

# create db for zabbix
mysql -uroot -p
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>';
mysql> quit;

# set zabbix php web frontend
vi /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Taipei

# set db info
vi /etc/zabbix/zabbix_server.conf
DBPassword=<password>

# zabbix db init
zcat /usr/share/doc/zabbix-server-mysql-3*/create.sql.gz | mysql -u zabbix -D zabbix -p

# start zabbix
systemctl enable zabbix-server
systemctl enable zabbix-agent
systemctl start zabbix-server
systemctl start zabbix-agent


# add setting for selinux
setsebool -P httpd_can_connect_zabbix on
setsebool -P zabbix_can_network on

# zabbix setup in webgui
http://zabbix_server_ipaddress/zabbix/
after this.
default username/password for zabbix is Admin/zabbix


# webgui appear >> zabbix server is not running: the information displayed may not be current. (port 10051 not listen)
systemctl restart zabbix-server
systemctl restart zabbix-agent

yum install policycoreutils-python -y
audit2why < /var/log/audit/audit.log
cd /etc/selinux/targeted/modules/
audit2allow -m local -l -i /var/log/audit/audit.log > local.te
ref: local.te will look like
> module local 1.0;

require {
type zabbix_t;
type zabbix_agent_t;
class process setrlimit;
}

#============= zabbix_agent_t ==============
allow zabbix_agent_t self:process setrlimit;

#============= zabbix_t ==============
allow zabbix_t self:process setrlimit;


checkmodule -M -m -o local.mod local.te
semodule_package -o local.pp -m local.mod
semodule -i local.pp

systemctl restart zabbix-server
systemctl restart zabbix-agent



zabbix auto redirect
=========
cd /var/www/html
vi index.html
<meta http-equiv="refresh" content="0; url=http://zabbix_domain_name/zabbix" />


## another way to add selinux settings.
> cd /etc/selinux/targeted/modules
audit2allow -M zabbix_agent -l -i /var/log/audit/audit.log
semodule -i zabbix_agent.pp


留言

熱門文章