Home | 簡體中文 | 繁體中文 | 雜文 | 知乎專欄 | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 視頻教程 | 打賞(Donations) | About
知乎專欄多維度架構 微信號 netkiller-ebook | QQ群:128659835 請註明“讀者”

第 94 章 Zabbix

目錄

94.1. Installing and Configuring Zabbix
94.1.1. Ubuntu
94.1.2. CentOS Zabbix 2.4
94.1.3. Zabbix 3.x CentOS 7
94.2. web ui
94.2.1. 警告腳本
94.3. zabbix-java-gateway - Zabbix java gateway
94.4. zabbix-agent
94.4.1. Ubuntu
94.4.2. CentOS 7
94.4.3. zabbix_agentd 命令
94.4.4. Nginx status 監控
94.4.5. redis
94.4.6. MongoDB
94.4.6.1. 創建 Mongo 監控用戶
94.4.6.2. Zabbix agentd 配置
94.4.6.3. Zabbix server 測試
94.4.7. PHP-FPM
94.4.7.1. 啟用 php-fpm status 功能
94.4.7.2. 配置 nginx
94.4.7.3. 配置 Zabbix 代理
94.4.7.4. php-fpm 監控參數
94.4.8. Elasticsearch
94.4.8.1. 安裝採集腳本
94.4.8.2. 配置Zabbix代理
94.4.9. Postfix
94.4.9.1. 安裝採集腳本
94.4.9.2. userparameter_postfix.conf
94.4.10. TCP stats
94.4.10.1. 採集腳本
94.4.11. 應用依賴檢查
94.4.12. Oracle
94.4.12.1. 採集腳本
94.4.12.2.

94.1. Installing and Configuring Zabbix

94.1.1. Ubuntu

neo@monitor:~$ apt-cache search zabbix
zabbix-agent - network monitoring solution - agent
zabbix-frontend-php - network monitoring solution - PHP front-end
zabbix-proxy-mysql - network monitoring solution - proxy (using MySQL)
zabbix-proxy-pgsql - network monitoring solution - proxy (using PostgreSQL)
zabbix-server-mysql - network monitoring solution - server (using MySQL)
zabbix-server-pgsql - network monitoring solution - server (using PostgreSQL)
			
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost' IDENTIFIED BY 'chen' WITH GRANT OPTION;
FLUSH PRIVILEGES;
			
sudo apt-get install zabbix-server-mysql zabbix-frontend-php
			

如果上述過程中遇到一些問題,可以手工安裝資料庫

			
$ sudo mysql -uroot -p -e"create database zabbix;"
$ sudo mysql -uroot -p -e"grant all privileges on zabbix.* to zabbix@localhost identified by 'enter-password-here';"
$ mysql -uzabbix -p zabbix < /usr/share/zabbix-server/mysql.sql
$ mysql -uzabbix -p zabbix < /usr/share/zabbix-server/data.sql
$ sudo dpkg-reconfigure zabbix-server-mysql
			
			
			
cat >> /etc/services <<EOF

zabbix-agent    10050/tcp                       #Zabbix Agent
zabbix-agent    10050/udp                       #Zabbix Agent
zabbix-trapper  10051/tcp                       #Zabbix Trapper
zabbix-trapper  10051/udp                       #Zabbix Trapper
EOF
			
			

94.1.2. CentOS Zabbix 2.4

			
yum localinstall -y http://repo.zabbix.com/zabbix/2.4/rhel/7/x86_64/zabbix-release-2.4-1.el7.noarch.rpm

yum install -y zabbix-server-mysql zabbix-web-mysql

cd /usr/share/doc/zabbix-server-mysql-2.4.0/create/

mysql -uzabbix -p zabbix < schema.sql
mysql -uzabbix -p zabbix < images.sql
mysql -uzabbix -p zabbix < data.sql

cp /etc/zabbix/zabbix_server.conf{,.original}
vim /etc/zabbix/zabbix_server.conf <<EOF > /dev/null 2>&1
:%s/# DBPassword=/DBPassword=your_password/
:wq
EOF

systemctl start zabbix-server
systemctl restart httpd
			
			

94.1.3. Zabbix 3.x CentOS 7

安裝腳本

			
#!/bin/bash
##################################################
# Author: Neo <netkiller@msn.com>
# Website http://netkiller.github.io
##################################################
yum localinstall -y http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

yum install -y zabbix-server-mysql zabbix-web-mysql

# CREATE DATABASE `zabbix` /*!40100 COLLATE 'utf8_general_ci' */

zcat /usr/share/doc/zabbix-server-mysql-3.2.1/create.sql.gz | mysql -uzabbix -p zabbix

cp /etc/zabbix/zabbix_server.conf{,.original}
vim /etc/zabbix/zabbix_server.conf <<EOF > /dev/null 2>&1
:%s/# DBPassword=/DBPassword=your_password/
:wq
EOF

systemctl enable httpd
systemctl enable zabbix-server

systemctl start zabbix-server
systemctl restart httpd
			
			

配置php.ini檔案 date.timezone = Asia/Hong_Kong

下一步

檢查PHP模組與配置,如果未提示錯誤信息點擊下一步按鈕

填寫數據主機名,用戶與密碼,然後下一步

Zabbix Server 直接點擊下一步

確認填寫信息,如果不正確可以返回重新填寫,確認安裝點擊下一步

完成安裝

登陸Zabbix 預設用戶名admin 密碼 zabbix ,請務必登陸後修改密碼