您的位置:首页 > 运维架构 > Linux

centos7安装zabbix3.4.1

2017-09-12 23:31 225 查看

linux 监控简介:

cacti、nagios、zabbix、smokeping、open-falcon等等
cacti、smokeping偏向于基础监控,成图非常漂亮,偏重网络设备
cacti、nagios、zabbix服务端监控中心,需要php环境支持,其中zabbix和cacti都需要mysql作为数据存储,nagios不用存储历史数据,注重服务或者监控项的状态,zabbix会获取服务或者监控项目的数据,会把数据记录到数据库里,从而可以成图
open-falcon为小米公司开发,开源后受到诸多大公司和运维工程师的追捧,适合大企业,滴滴、360、新浪微博、京东等大公司在使用这款监控软件,值得研究
zabbix-proxy 可选组件,它可以代替zabbix-server的功能,减轻server的压力

安装:

版本:centos7 + zabbix 3.4.1

1,下载 3.4.1

rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm[/code]服务端安装 
yum install zabbix-server-mysql zabbix-web-mysql
下面两个根据需要安装

代理安装
yum install zabbix-proxy-mysql
客户端安装
yum install zabbix-agent

安装mariadb数据库:

yum install mariadb mariadb-server -y
systemctl start mariadb

创建zabbix数据库Creating database

shell> mysql
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> quit;

初始化数据

Now import initial schema and data for the server with MySQL:
[root@localhost ~]# zcat /usr/share/doc/zabbix-server-mysql-3.4.1/create.sql.gz |mysql -uzabbix -p zabbix
Enter password:

配置数据库为zabbixserver

Configure database for Zabbix server/proxyEdit zabbix_server.conf or zabbix_proxy.conf to use the created database. For example:
vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

启动zabbix Starting Zabbix server process

systemctl start zabbix-server
systemctl enable zabbix-server

如果没有关闭selinux 启动会失败

配置php

PHP configuration for Zabbix frontend
vim /etc/httpd/conf.d/zabbix.conf.
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 always_populate_raw_post_data -1
php_value date.timezone Asia/shanghai

如果selinux 未关闭,需要设置selinux使其支持httpd

SELinux configuration设置http可以连接zabbix
setsebool -P httpd_can_connect_zabbix on
setsebool -P httpd_can_network_connect_db on
systemctl start httpd

2,网页安装

In your browser, open Zabbix URL: http:///zabbix 输入ip/zabbix 进行安装根据网页提示进行安装。
安装完成。

3,修改Admin 密码

进入mysql命令行,选择zabbix库
mysql -uroot -p zabbix
update users set passwd=md5(‘newpasswd’) where alias=‘Admin’;
这样就更改了Admin用户的密

设置支持中文,解决乱码问题

设置为中文后,zabbix图形的中文文字会显示小方框这是因为在zabbix的字体库中没有中文字体,需要从windows上借用一个过来
vim /usr/share/zabbix/include/defines.inc.php
搜索ZBX_FONTPATH它定义的路径是“fonts”,它是一个相对路径,绝对路径为/usr/share/zabbix/fonts,而字体文件为“ZBX_GRAPH_FONT_NAME”所定义的“graphfont”,它是一个文件,绝对路径为
/usr/share/zabbix/fonts/graphfontwindows字体路径为“C:\Windows\Fonts\”,找到“simfang.ttf”(其实就是那个仿宋简体),先把它复制到桌面上,然后上传到linux的/usr/share/zabbix/fonts/,并且改名为graphfont.ttf重启相应服务即可。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  zabbix centos7