首页 > 其他 > 详细

zabbix部署

时间:2019-11-03 23:04:17      阅读:110      评论:0      收藏:0      [点我收藏+]

 

系统环境为CentOS7.

网络配置

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=75cb6d32-d068-4edf-b67e-7d860e94404b
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.1.227
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=114.114.114.114
DNS2=8.8.8.8

[root@localhost ~]# systemctl restart network.service

关闭防火墙,开机禁止起动防火墙

[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

关闭selinux

[root@localhost ~]# vi /etc/selinux/config

SELINUX=disabled

重启系统

准备安装zabbix

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# yum -y install wget

[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

              wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

[root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.bak
[root@localhost yum.repos.d]# mv CentOS7-Base-163.repo CentOS7-Base.repo

[root@localhost yum.repos.d]# yum clean all

[root@localhost yum.repos.d]# yum makecache

安装工具软件

[root@localhost yum.repos.d]# yum -y install lrzsz

安装http,mariadb,php

[root@localhost ~]# yum -y install mariadb mariadb-server httpd php php-mysql

[root@localhost ~]# systemctl start httpd.service
[root@localhost ~]# systemctl enable httpd.service

[root@localhost ~]# systemctl start mariadb.service
[root@localhost ~]# systemctl enable mariadb.service

[root@localhost ~]# mysql_secure_installation    #初始化数据库。

Enter current password for root (enter for none): 

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!

Remove anonymous users? [Y/n] y
... Success!

Disallow root login remotely? [Y/n] y
... Success!

Remove test database and access to it? [Y/n] n
... skipping.

Reload privilege tables now? [Y/n] y
... Success!

Cleaning up...

安装zabbix程序

[root@localhost yum.repos.d]# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm

[root@localhost yum.repos.d]# rpm -import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[root@localhost ~]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent

数据库配置

[root@localhost ~]# mysql -u root -p
Enter password:     #123456
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 5.5.64-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

MariaDB [(none)]> create database zabbix default character set utf8 collate utf8_bin
-> ;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix‘
-> ;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

读入数据库

[root@localhost ~]# cd /usr/share/doc/zabbix-server-mysql-3.4.15/
[root@localhost zabbix-server-mysql-3.4.15]# ls
AUTHORS ChangeLog COPYING create.sql.gz NEWS README

[root@localhost zabbix-server-mysql-3.4.15]# zcat create.sql.gz |mysql -uroot -p zabbix
Enter password:

启动zabbix服务

[root@localhost ~]# vi /etc/zabbix/zabbix_server.conf

91 DBHost=localhost

 100 DBName=zabbix

116 DBSchema=zabbix

 124 DBPassword=zabbix

[root@localhost ~]# systemctl start zabbix-server

[root@localhost ~]# systemctl enable zabbix-server.service

编辑zabbix前端php配置

[root@localhost ~]# vi /etc/httpd/conf

<IfModule mod_php5.c>
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value max_input_vars 10000
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/Shanghai
</IfModule>

调整时间同步

[root@localhost ~]# yum -y install ntp

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 127.127.1.0
fudge 127.127.1.0 stratum 10

[root@localhost ~]# systemctl restart ntpd.service
[root@localhost ~]# systemctl enable ntpd.service

重启httpd服务

[root@localhost html]# systemctl restart httpd.service

 

浏览器访问:192.168.1.227/zabbix

技术分享图片

 

 

点击Next step

技术分享图片

 

 

 点击Next step

技术分享图片

 

 用户名为:Admin。密码:zabbix。

技术分享图片

 

 点击adminstration,点users,点admin

技术分享图片

 

 添加本机为监控对象

[root@localhost html]# vi /etc/zabbix/zabbix_agentd.conf 

Server=192.168.1.227    #服务器IP地址

ServerActive=192.168.1.227

Hostname=192.168.1.207

[root@localhost html]# systemctl restart zabbix-agent

[root@localhost html]# systemctl enable zabbix-agent

 网页端创建本机被监控

配置-->主机-->创建主机

技术分享图片

 

 技术分享图片

 

 

模板选择

配置-->主机-->创建主机-->模板

技术分享图片

 

 技术分享图片

 

 点击监控中--->图型

 技术分享图片

 如果中文显示有乱码,可以导入windows字体

技术分享图片

 

 [root@localhost ~]# mv AdobeHeitiStd-Regular.otf AdobeHeitiStd-Regular.ttf

 [root@localhost ~]# mv AdobeHeitiStd-Regular.ttf /usr/share/zabbix/fonts/

[root@localhost ~]# chmod 777 /usr/share/zabbix/fonts/AdobeHeitiStd-Regular.ttf 

[root@localhost ~]# cd /usr/share/zabbix/include/
[root@localhost include]# vi defines.inc.php

define(‘ZBX_GRAPH_FONT_NAME‘,           ‘AdobeHeitiStd-Regular‘); // font file name

 重新刷新就好了。

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

zabbix部署

原文:https://www.cnblogs.com/liujunjun/p/11789479.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!