1. 程式人生 > >centos7安裝zabbix3.4.1

centos7安裝zabbix3.4.1

zabbix3.4.1 centos7

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

服務端安裝
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 [email protected] identified by ‘zabbix‘;
mysql> quit;

初始化數據

Now import initial schema and data for the server with MySQL:

[[email protected] ~]# 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/proxy

Edit 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/graphfont

windows字體路徑為“C:\Windows\Fonts\”,找到“simfang.ttf”(其實就是那個仿宋簡體),先把它復制到桌面上,然後上傳到linux的/usr/share/zabbix/fonts/,並且改名為graphfont.ttf

重啟相應服務即可。

本文出自 “12117893” 博客,請務必保留此出處http://12127893.blog.51cto.com/12117893/1964786

centos7安裝zabbix3.4.1