cnetos7配置zabbix3.2.7和grafana4.4.1

  1. 切换至root账户
    sudo bash
  2. 关闭防火墙并关闭开机启动
systemctl stop firewalld.service
systemctl disable firewalld.service
  1. 关闭SELinux安全机制
    (1). 临时关闭
    setenforce 0
    (2). 永久关闭
    vim /etc/selinux/config
    设置SELINUX=enforcing为SELINUX=disabled

4搭建zabbix所需要的lamp环境
安装阿里云yum配置文件

rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
//安装最新版相应配置例如:
# rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm

安装zabbix-server、zabbix-agent、mariadb

yum install zabbix-server zabbix-get zabbix-agent zabbix-web zabbix-server-mysql zabbix-web-mysql mariadb-server mariadb -y

修改php时区:

sed -i 's@# php_value date.timezone Europe/Riga@php_value date.timezone Asia/Shanghai@g' /etc/httpd/conf.d/zabbix.conf

创建zabbix数据库:
启动mariadb,并创建zabbix数据库。

 systemctl enable mariadb
 systemctl start mariadb
[root@guard ~]# sed -i 's@# php_value date.timezone Europe/Riga@php_value date.timezone Asia/Shanghai@g' /etc/httpd/conf.d/zabbix.conf
[root@guard ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@guard ~]# systemctl start mariadb
[root@guard ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.52-MariaDB MariaDB Server

Copyright (c) 2000, 2016, 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 character set uft8 collate utf8_bin;
ERROR 1115 (42000): Unknown character set: 'uft8'
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)

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

MariaDB [(none)]> exit;
Bye
[root@guard ~]# 

导入数据:

[root@guard ~]# cd /usr/share/doc/zabbix-server-mysql-3.2.7/
[root@guard zabbix-server-mysql-3.2.7]# zcat create.sql.gz|mysql -uzabbix -pzabbix zabbix

修改zabbix数据库密码

[root@guard zabbix-server-mysql-3.2.7]# sed -i '116a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf

启动zabbix和httpd:

systemctl start zabbix-server 
systemctl start zabbix-agent 
systemctl start httpd

设置Apache开机启动(默认开放80端口):

systemctl enable httpd
systemctl start httpd

修改Zabbix Server配置文件
vi /etc/zabbix/zabbix_server.conf
新增如下内容:
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
启动Zabbix Server,并配置开机启动:

    systemctl enable zabbix-server

    systemctl start zabbix-server

重启Apache:systemctl restart httpd
如有报错:[root@guard zabbix-server-mysql-3.2.7]# systemctl restart zabbix-server
Job for zabbix-server.service failed because a configured resource limit was exceeded. See "systemctl status zabbix-server.service" and "journalctl -xe" for details.
继续进行下一步:
vi /etc/php.ini
末尾加入:

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

浏览器输入:http://10.3.6.45/zabbix/setup.php

cnetos7配置zabbix3.2.7和grafana4.4.1_第1张图片
image.png

下一步即可:

cnetos7配置zabbix3.2.7和grafana4.4.1_第2张图片
如果提示如下错误,直接重启即可

剩下的改字体等,都和 上一篇配置zabbix2的时候一样;
也可以用这种方法:
修改中文字体,防止监控图乱码:
在控制面板中找到一个字体,例如黑体

cnetos7配置zabbix3.2.7和grafana4.4.1_第3张图片
image.png

上传到/usr/share/zabbix/fonts
可以用lrzsz工具上传。把大写字体改为小写mv SIMHEI.TTF simhei.ttf
修改defines.inc.php
sed -i 's#graphfont#simhei#g' /usr/share/zabbix/include/defines.inc.php
配置grafana
官网:
[root@guard ~]# systemctl start grafana-server.service
[root@guard ~]# systemctl enable grafana-server.service

你可能感兴趣的:(cnetos7配置zabbix3.2.7和grafana4.4.1)