zabbix安装

安装zabbix 4.0 LTS

1:配置zabbix yum仓库

curl -o zabbix-release-3.0-1.el7.noarch.rpm  https://mirror.tuna.tsinghua.edu.cn/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
rpm -ivh zabbix-release-3.0-1.el7.noarch.rpm

[root@zabbix-server ~]# cat /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=https://mirror.tuna.tsinghua.edu.cn/zabbix/zabbix/3.0/rhel/7/x86_64/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch 
baseurl=https://mirror.tuna.tsinghua.edu.cn/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1

2:安装zabbix服务端和zabbix-web前端

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

3:安装mariadb,创建zabbix库,授权zabbix用户

yum install mariadb-server -y
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation
回车
n
y
y
y
y
mysql
>:create database zabbix character set utf8 collate utf8_bin;
>:grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';

导入zabbix表结构和初始数据
zcat /usr/share/doc/zabbix-server-mysql-3.0.*/create.sql.gz | mysql -uzabbix -p zabbix

检查zabbix库是否导入成功
mysql -uroot  zabbix -e 'show tables'

4:配置启动zabbix-server

vi /etc/zabbix/zabbix_server.conf 
DBHost=localhost 
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

启动zabbix-server
systemctl start zabbix-server 
systemctl enable zabbix-server

检查:
netstat -lntup

5:修改Zabbix前端的PHP配置,并启动httpd

vi /etc/httpd/conf.d/zabbix.conf
php_value date.timezone Asia/Shanghai

systemctl start httpd
systemctl enable httpd

6:前端zabbix-web的安装

浏览器:http://10.0.0.71/zabbix

后期修改zabbix数据库密码的时候,需要修改的配置文件:
/etc/zabbix/web/zabbix.conf.php

http://10.0.0.71/zabbix/zabbix.php
登录的账号密码;
Admin
zabbix

Step 1
In your browser, open Zabbix URL: http:///zabbix
You should see the first screen of the frontend installation wizard.

image.png

Step 2
Make sure that all software prerequisites are met.

image.png

Step 3
Enter details for connecting to the database. Zabbix database must already be created.

image.png

Step 4
Enter Zabbix server details.

image.png

Entering a name for Zabbix server is optional, however, if submitted, it will be displayed in the menu bar and page titles.

Step 5
Review a summary of settings.

image.png

Step 6
Download the configuration file and place it under conf/ in the webserver HTML documents subdirectory where you copied Zabbix PHP files to.

image.png
image.png

Step 7
Finish the installation.

image.png

Step 8
Zabbix frontend is ready! The default user name is Admin, password zabbix.

image.png

Proceed to getting started with Zabbix.

zabbix-agent安装

一、下载agent安装包并配置客户端

https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.11-1.el7.x86_64.rpm
rpm -ivh https://mirror.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.11-1.el7.x86_64.rpm
vim  /etc/zabbix/zabbix-agent.conf
修改zabbix-server的ip
systemctl start  zabbix-agent
systemctl enable  zabbix-agent

二、配置zabbix服务端

image.png
image.png
image.png

重启zabbix-server服务,刷新页面。

image.png

爆红之后如何重启变绿的时间修改:

image.png

zabbix自定义监控项

一、取值和配置agent监控参数

[root@zabbix-server ~]# iostat|awk  'NR==7{print $2}'
4.32
[root@zabbix-server ~]# vim /etc/zabbix/zabbix_agentd.conf 
UserParameter=sda_tps,iostat|awk  'NR==7{print $2}'
[root@zabbix-server ~]# systemctl restart zabbix-agent.service 
[root@zabbix-server ~]# rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-get-4.0.10-1.el7.x86_64.rpm
Retrieving https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-get-4.0.10-1.el7.x86_64.rpm
warning: /var/tmp/rpm-tmp.YvRgEj: Header V4 RSA/SHA512 Signature, key ID a14fe591: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:zabbix-get-4.0.10-1.el7          ################################# [100%]
[root@zabbix-server ~]# zabbix_get -s 127.0.0.1 -k sda_tps
4.31

二、配置服务端自定义项

image.png
image.png
image.png
image.png
image.png

三、自定义zabbix触发器

image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png

四、qq邮箱授权码获取

image.png
image.png
image.png
image.png
image.png

五、zabbix邮件报警配置

image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png

六、zabbix微信脚本报警配置(需注册企业微信账号,并自己编写报警脚本放到指定目录)

image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png

七、zabbix图形中的中文乱码问题

[root@zabbix-server ~]# cd /usr/share/zabbix/assets/fonts/
[root@zabbix-server fonts]# ll
lrwxrwxrwx 1 root root 33 Aug  2 11:18 graphfont.ttf -> /etc/alternatives/zabbix-web-font
到win10中的fonts目录复制想要的字体文件替换当前目录的文件。
image.png

八、安装grafana图形插件服务

wget http://192.168.12.114/grafana-6.3.0-1.x86_64.rpm
wget http://192.168.12.201/zabbix_lib/grafana-5.4.2-1.x86_64.rpm
[root@zabbix-server ~]# yum localinstall grafana-6.3.0-1.x86_64.rpm -y
[root@zabbix-server ~]# systemctl restart grafana-server.service 
[root@zabbix-server ~]# systemctl enable grafana-server.service
Created symlink from /etc/systemd/system/multi-user.target.wants/grafana-server.service to /usr/lib/systemd/system/grafana-server.service.
访问:http://10.0.0.61:3000
用户名:admin
密码:admin
image.png

九、安装grafana图形的zabbix插件

grafana-cli plugins list-remote|grep zabbix  --过滤想要的插件
方法一、
grafana-cli plugins install alexanderzobnin-zabbix-app  --安装插件
方法二、
cd /var/lib/grafana/plugins   --进入插件目录
unzip alexanderzobnin-grafana-zabbix-v3.10.3-1-g362e0a7.zip 
systemctl restart grafana-server.service  --重启服务

浏览器访问测试:

image.png

十、创建zabbix的应用集

image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png
image.png

十一、zabbix创建图片

image.png
image.png
image.png
image.png
image.png
image.png

十二、zabbix创建用户群组和用户并授权

image.png
image.png
image.png
image.png
image.png
image.png
image.png

你可能感兴趣的:(zabbix安装)