1、Zabbix安裝
下載zabbix server源碼包
wget https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.4.1/zabbix-4.4.1.tar.gz
安裝依賴
yum install wget telnet net-tools python-paramiko gcc gcc-c++ dejavu-sans-fonts python-setuptools python-devel sendmail mailx net-snmp net-snmp-devel net-snmp-utils freetype-devel libpng-devel perl unbound libtasn1-devel p11-kit-devel OpenIPMI unixODBC libevent-devel mysql-devel libxml2-devel libssh2-devel OpenIPMI-devel java-1.8.0-openjdk-devel openldap-devel curl-devel unixODBC-devel
解壓并編譯安裝
tar -zxvf zabbix-4.4.1.tar.gz
cd zabbix-4.4.1/
建立編譯安裝目錄
mkdir -p /data/zabbix
./configure --prefix=/data/zabbix --enable-server --enable-agent --enable-java --with-mysql --with-libxml2 --with-unixodbc --with-net-snmp --with-ssh2 --with-openipmi --with-ldap --with-libcurl --with-iconv
make
make install
查看安裝版本
/data/zabbix/sbin/zabbix_server -V
數(shù)據(jù)庫安裝
yum install mariadb-server
systemctl start mariadb.service
systemctl status mariadb.service
mysql_secure_installation
創(chuàng)建數(shù)據(jù)庫
mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by 'abc123456.';
flush privileges;
導(dǎo)入數(shù)據(jù)結(jié)構(gòu)
mysql -uzabbix -pabc123456. zabbix < /root/zabbix-4.4.1/database/mysql/schema.sql
mysql -uzabbix -pabc123456. zabbix < /root/zabbix-4.4.1/database/mysql/images.sql
mysql -uzabbix -pabc123456. zabbix < /root/zabbix-4.4.1/database/mysql/data.sql
修改zabbix server配置
vim /data/zabbix/etc/zabbix_server.conf
增加用戶
groupadd --system zabbix
useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix System" zabbix
啟動服務(wù)
/data/zabbix/sbin/zabbix_server -c /data/zabbix/etc/zabbix_server.conf
/data/zabbix/sbin/zabbix_agentd -c /data/zabbix/etc/zabbix_agentd.conf
tailf /tmp/zabbix_server.log
tailf /tmp/zabbix_agentd.log
ps aux | grep zabbix
增加Zabbix鏡像源
rpm -ivh http://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm
安裝Zabbix Frontend
yum install zabbix-web-mysql
配置Zabbix frontend
vim /etc/php.ini
max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
max_input_vars = 10000
always_populate_raw_post_data = -1
date.timezone = Asia/Shanghai
啟動httpd
systemctl start httpd.service
systemctl status httpd.service
cd zabbix-4.4.1
cp misc/init.d/fedora/core/zabbix_server /etc/rc.d/init.d/zabbix-server
cp misc/init.d/fedora/core/zabbix_agentd /etc/rc.d/init.d/zabbix-agent
chmod +x /etc/rc.d/init.d/zabbix-server
chmod +x /etc/rc.d/init.d/zabbix-agent
chkconfig --add zabbix-server
chkconfig --add zabbix-agent
chkconfig zabbix-server on
chkconfig zabbix-agent on
vi /etc/rc.d/init.d/zabbix-agent 和zabbix-server
編輯客戶端配置文件
BASEDIR=/data/zabbix/
zabbix安裝目錄
PIDFILE=/usr/local/zabbix/logs/$BINARY_NAME.pid #pid文件路徑
(可以使用默認(rèn))
:wq! #保存退出
Admin
zabbix
2、grafana安裝
wget https://dl.grafana.com/oss/release/grafana-6.4.4-1.x86_64.rpm
yum localinstall grafana-6.4.4-1.x86_64.rpm
systemctl daemon-reload
systemctl start grafana-server
systemctl status grafana-server
配置支持zabbix
安裝 zabbix 插件(grafana-zabbix)
grafana-cli plugins install alexanderzobnin-zabbix-app
systemctl restart grafana-server
啟用插件
進入 Plugins 界面,選擇 “Zabbix”
開始面板(左上角圖標(biāo)) -> Plugins -> Apps -> Zabbix
添加 zabbix 數(shù)據(jù)源
進入 “添加數(shù)據(jù)源” 界面
開始面板(左上角圖標(biāo)) -> Data Sources -> Add data source
配置 Zabbix 數(shù)據(jù)源
配置完后,保存退出,配置的內(nèi)容如下:
重要參數(shù)有:
Type: Zabbix
Url: http://zabbix服務(wù)器/zabbix/api_jsonrpc.php
Access: direct
(Zabbix API details)
Username: Admin(默認(rèn))
Password: zabbix(默認(rèn))
驗證
之后,我們從 開始面板 -> Zabbix 中,便可看到 Zabbix 相關(guān)的監(jiān)控數(shù)據(jù)。
監(jiān)控客戶端
安裝Zabbix Agent
yum install zabbix-agent
systemctl start zabbix-agent.service