Zabbix4.4 Installation on CentOS 7.5安装zabbix4.4

Zabbix Installation on CentOS 7.5安装zabbix4.4

Environment:

OS: CentOS 7.5

IP addr: 192.168.75.40

Host name: zabbix

download zabbix

wget https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.4.4/zabbix-4.4.4.tar.gz 

install dependency packages

yum install -y wget telnet net-tools python-paramiko gcc gcc-c++ dejavu-sans-fonts python-setuptools python-devel sendmail mailx net-snmp net-snmp-devel net-snmp-utils freetype-devel libpng-devel perl unbound libtasn1-devel p11-kit-devel OpenIPMI unixODBC libevent-devel mysql-devel libxml2-devel libssh2-devel OpenIPMI-devel java-1.8.0-openjdk-devel openldap-devel curl-devel unixODBC-devel 

Compile zabbix

tar -zxvf zabbix-4.4.4.tar.gz
cd zabbix-4.4.4/
mkdir -p /data/zabbix
./configure --prefix=/data/zabbix --enable-server --enable-agent --enable-java --with-mysql --with-libxml2 --with-unixodbc --with-net-snmp --with-ssh2 --with-openipmi --with-ldap --with-libcurl --with-iconv
make && make install

Check zabbix version

/data/zabbix/sbin/zabbix_server -V
zabbix_server (Zabbix) 4.4.4
Revision 3131fdac04 19 December 2019, compilation time: Apr 25 2020 03:21:26

Copyright (C) 2019 Zabbix SIA
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it according to
the license. There is NO WARRANTY, to the extent permitted by law.

Install database

[root@localhost zabbix-4.4.4]# yum install -y mariadb-server
[root@localhost zabbix-4.4.4]# systemctl start mariadb.service
[root@localhost zabbix-4.4.4]# systemctl status mariadb.service
[root@localhost zabbix-4.4.4]# mysql_secure_installation
[root@localhost zabbix-4.4.4]# mysql -uroot -p
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'abc123456';
MariaDB [(none)]> flush privileges;

initialize db

[root@localhost zabbix-4.4.4]# mysql -uzabbix -pabc123456 zabbix < /root/zabbix-4.4.4/database/mysql/schema.sql
[root@localhost zabbix-4.4.4]# mysql -uzabbix -pabc123456 zabbix < /root/zabbix-4.4.4/database/mysql/images.sql
[root@localhost zabbix-4.4.4]# mysql -uzabbix -pabc123456 zabbix < /root/zabbix-4.4.4/database/mysql/data.sql

modify zabbix server config

vim /data/zabbix/etc/zabbix_server.conf
ListenPort=10051
DBHost=localhost
DBPassword=abc123456
DBPort=3306
ListenIP=192.168.75.40

Add zabbix user

groupadd --system zabbix
useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix System" zabbix

Start Zabbix

/data/zabbix/sbin/zabbix_server -c /data/zabbix/etc/zabbix_server.conf
/data/zabbix/sbin/zabbix_agentd -c /data/zabbix/etc/zabbix_agentd.conf
tailf /tmp/zabbix_server.log
tailf /tmp/zabbix_agentd.log
ps aux | grep zabbix
netstat -lantp
# check if any errors in log

Install zabbix web

# add zabbix repo
rpm -ivh http://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
# change repo to aliyun
vim /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
#baseurl=http://repo.zabbix.com/zabbix/4.4/rhel/7/$basearch/
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/$basearch/
enabled=1
#gpgcheck=1
gpgcheck=0

yum install zabbix-web-mysql

Configure zabbix web

vim /etc/php.ini
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
max_input_vars = 10000
always_populate_raw_post_data = -1
date.timezone = Asia/Shanghai

Start zabbix web

systemctl start httpd.service
systemctl status httpd.service

cd zabbix-4.4.4
cp misc/init.d/fedora/core/zabbix_server /etc/rc.d/init.d/zabbix-server

cp misc/init.d/fedora/core/zabbix_agentd /etc/rc.d/init.d/zabbix-agent

chmod +x /etc/rc.d/init.d/zabbix-server
chmod +x /etc/rc.d/init.d/zabbix-agent
chkconfig --add zabbix-server
chkconfig --add zabbix-agent
chkconfig zabbix-server on
chkconfig zabbix-agent on

modify /etc/rc.d/init.d/zabbix-server and /etc/rc.d/init.d/zabbix-agent

vim /etc/rc.d/init.d/zabbix-server
BASEDIR=/data/zabbix/
PIDFILE=/usr/local/zabbix/logs/$BINARY_NAME.pid
vim /etc/rc.d/init.d/zabbix-agent
# change the same above

visit zabbix web

remember to stop firewall && disable selinux

 setenforce 0
 vim /etc/selinux/config
 # change SELINUX=disabled

http://192.168.75.40/zabbix/setup.php

Admin/zabbix

在这里插入图片描述

change php if the home page show zabbix server is not running

vim /etc/zabbix/web/zabbix.conf.php
systemctl restart httpd.service
systemctl restart zabbix-server
systemctl restart zabbix-agent

在这里插入图片描述

Add Linux server to Zabbix

install zabbix agent on Linux

rpm -ivh http://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
yum install epel-release
yum install bash-completion
yum install bash-completion-extras
yum search all zabbix-agent
vim /etc/zabbix/zabbix_agentd.conf
# modify 3 items
Hostname=k8s-master01  # hostname where the agent installed
Server=192.168.75.40  #zabbix server IP
ServerActive=192.168.75.40  # zabbix server ip

Start zabbix-agent

systemctl start zabbix-agent
systemctl enable zabbix-agent
systemctl status zabbix-agent
[root@k8s-master01 ~]# tailf /var/log/zabbix/zabbix_agentd.log 
 30845:20200425:211439.207 **************************
 30845:20200425:211439.207 using configuration file: /etc/zabbix/zabbix_agentd.conf
 30845:20200425:211439.208 agent #0 started [main process]
 30849:20200425:211439.209 agent #4 started [listener #3]
 30848:20200425:211439.211 agent #3 started [listener #2]
 30850:20200425:211439.212 agent #5 started [active checks #1]
 30847:20200425:211439.213 agent #2 started [listener #1]
 30846:20200425:211439.215 agent #1 started [collector]
 30850:20200425:211439.223 no active checks on server [192.168.75.40:10051]: host [k8s-master01] not found
 30850:20200425:211639.319 no active checks on server [192.168.75.40:10051]: host [k8s-master01] not found

Configure host on Zabbix Web

在这里插入图片描述

Setup mail alert

stop postfix and sendmail

systemctl stop sendmail.service
systemctl stop postfix.service
systemctl disable sendmail.service
systemctl disable postfix.service

yum install mailx
vim /etc/mail.rc
# add below lines to the bottom
set from=xxx@163.com
set smtp=smtp.163.com
set smtp-auth-user=xxx@163.com
set smtp-auth-password=abcd1234
set smtp-auth=login

# test mailx on zabbix server
echo "zabbix alert test"|mailx -s "zabbix alert" xxx@163.com

create script of sending mail

# check alert script folder
vim /data/zabbix/etc/zabbix_server.conf
cd /data/zabbix/share/zabbix/alertscripts

vim mail.sh

#!/bin/bash

SEND_TO=$1
SEND_SUBJECT=$2
SEND_CONTENT=$3

echo "$SEND_CONTENT"|mailx -s "$SEND_SUBJECT" $SEND_TO

# verify mail.sh
./mail.sh xxx@163.com "zabbix alert #2" "zabbix alert"

# configure Media types in zabbix web

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值