顯示頁面舊版反向連結Fold/unfold all回到頁頂 本頁是唯讀的,您可以看到原始碼,但不能更動它。您如果覺得它不應被鎖上,請詢問管理員。 ====== 安裝 Zabbix 監控系統 ====== * CentOS 6.8 x86_64 / CentOS 5.11 x86_64 * 預計安裝 * 一台 zabbix-server + agent * 多台 zabbix-proxy + agent * 多台 zabbix-agent <note> * CentOS 5 x86_64 - <code sh>rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/5/x86_64/zabbix-release-2.4-1.el5.noarch.rpm</code> * CentOS 6 x86_64 - <code sh>rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-1.el6.noarch.rpm</code> </note> ===== Server 安裝程序 ===== * 安裝相關套件<code sh> yum install zabbix-server-mysql zabbix-web-mysql </code> * 在 MySQL 建立相關 DB Schema<code sh> shell> mysql -uroot -p<password> mysql> create database zabbix character set utf8 collate utf8_bin; mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '<password>'; mysql> quit; </code> * 匯入 Zabbix DB Schema<code sh> shell> mysql -uzabbix -p<password> zabbix < /usr/share/doc/zabbix-server-mysql-2.4.5/create/schema.sql # stop here if you are creating database for Zabbix proxy shell> mysql -uzabbix -p<password> zabbix < /usr/share/doc/zabbix-server-mysql-2.4.5/create/images.sql shell> mysql -uzabbix -p<password> zabbix < /usr/share/doc/zabbix-server-mysql-2.4.5/create/data.sql </code> * 啟動 zabbix-server<code sh> vi /etc/zabbix/zabbix_server.conf </code><file> DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=<password> </file><code sh> service zabbix-server start chkconfig zabbix-server on </code> * 編輯 php 相關設定<code sh> vi /etc/httpd/conf.d/zabbix.conf </code><file> 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 date.timezone ASIA/Taipei </file><code sh> service httpd restart </code> * 透過網頁登入 Exp. * http://140.92.143.57/zabbix/ * 預設帳號與密碼 : Admin/zabbix <note> * 當登入後發現一直出現 \\ **"Zabbix server is not running: the information displayed may not be current"** \\ 可透過調整 selinux 解決<code sh> getsebool httpd_can_network_connect </code><file> httpd_can_network_connect --> off </file><code sh> setsebool -P httpd_can_network_connect on </code> </note> * 開啟 iptables 讓外部 zabbix-agent 可以回報<code sh> vi /etc/sysconfig/iptables </code><file> : :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT : -A INPUT -m state --state NEW -m tcp -p tcp --dport 10051 -j ACCEPT : </file><code sh> service iptables restart </code> * zabbix-server 相關重要檔案路徑如下: * log - /var/log/zabbix/zabbix_server.log * conf - /etc/zabbix/zabbix_server.conf <note> **當使用的 DB 並不安裝在本機內** * 修改 /etc/zabbix/zabbix_server.conf<file> : DBHost=**192.168.11.xxx** DBUser=zabbix DBPassword=**zabbix_password** #DBSocket=/var/lib/mysql/mysql.sock DBPort=3306 : </file> * 修改 /usr/share/zabbix/conf/zabbix.conf.php<file> : $DB["TYPE"] = 'MYSQL'; $DB["SERVER"] = '**192.168.11.xxx**'; $DB["PORT"] = '3306'; $DB["DATABASE"] = 'zabbix'; $DB["USER"] = 'zabbix'; $DB["PASSWORD"] = '**zabbix_password**'; : </file> </note> ===== Proxy 安裝程序 ===== * 安裝相關套件<code sh> yum install -y sqlite zabbix-proxy-sqlite3 mkdir /var/lib/sqlite vi /etc/zabbix/zabbix_proxy.conf </code><file> : #DBName=zabbix_proxy DBName=/var/lib/sqlite/zabbix.db : #Server=127.0.0.1 Server=zabbix.ichiayi.com : #Hostname=Zabbix proxy Hostname=Zabbix Everplast Proxy : </file><code sh> chown -R zabbix:zabbix /var/lib/sqlite/ service zabbix-proxy start chkconfig zabbix-proxy on </code> <note> * 如果啟動無法建立 sqlitedb 時, 請檢查是否是 selinux 的限制問題 * 可以先將 /etc/selinux/config 內設定 SELINUX=disabled </note> ===== Agent 安裝程序 ===== ==== CentOS Agent ==== * 安裝相關套件<code sh> yum install zabbix-agent </code> * 設定相關參數<code sh> vi /etc/zabbix/zabbix_agentd.conf </code><file> : Server=140.92.143.57 : ServerActive=140.92.143.57 : Hostname=percona-xc2 : </file><code sh> service zabbix-agent start chkconfig zabbix-agent on </code> * 開啟 iptables 讓外部 zabbix-server 可以詢問<code sh> vi /etc/sysconfig/iptables </code><file> : :OUTPUT ACCEPT [0:0] -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT : -A INPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT : </file><code sh> service iptables restart </code> * zabbix-agent 相關重要檔案路徑如下: * log - /var/log/zabbix/zabbix_agentd.log * conf - /etc/zabbix/zabbix_agent.conf ==== Windows Agent ==== * 下載 Windows Agent 程式 http://www.zabbix.com/downloads/2.4.4/zabbix_agents_2.4.4.win.zip * 解開後將 bin 目錄內依照 Windows 屬於 32bits (win32) 或 64bits (win64) 複製到 c:\zabbix * Exp. 64bits Windows 複製後會看到類似以下的目錄檔案<file> C:\ZABBIX │ zabbix_agentd.exe │ zabbix_get.exe │ zabbix_sender.exe │ └─dev zabbix_sender.dll zabbix_sender.lib </file> * 以 Administrator 身份執行 cmd 來產生相關的設定檔與建立 Windows Service * 產生 zabbix_agentd.conf 設定檔<code sh> echo LogFile=c:\\zabbix\\zabbix_agentd.log > c:\zabbix\zabbix_agentd.conf echo Server=zabbix.server.name.or.ip >> c:\zabbix\zabbix_agentd.conf echo ServerActive=zabbix.server.name.or.ip >> c:\zabbix\zabbix_agentd.conf echo Hostname=Windows_Server_or_PC_name >> c:\zabbix\zabbix_agentd.conf </code> * 註冊 Zabbix Agent 為 Windows 服務<code sh> c:\zabbix\zabbix_agentd.exe --config c:\zabbix\zabbix_agentd.conf --install </code> * 啟動 Zabbix Agent 服務<code sh> net start "Zabbix Agent" </code> * 開機自動啟動 Zabbix Agent 服務 (注意 start= 後面有一個空格)<code sh> sc config "Zabbix Agent" start= auto </code> * 到控制台手動操作防火牆設定, 允許 C:\zabbix\zabbix_agentd.exe 通過防火牆, 或開放 TCP 10050 port * 啟動之後可以觀察 c:\zabbix\zabbix_agentd.log 內的紀錄 * 如果 Server IP 或 Hostname 要修改 可以直接使用記事本更改 c:\zabbix\zabbix_agentd.conf 修改後需要到控制台->服務 重新啟動 Zabbix Agent 才會生效 ===== 相關 Agent 的安裝設定 ===== <quote> {{indexmenu>tech/zabbix#1|js navbar nocookie tsort rsort}} </quote> ===== 參考網址 ===== * https://www.zabbix.com/documentation/2.4/manual/installation/install_from_packages#red_hat_enterprise_linux_centos * https://www.zabbix.com/documentation/2.4/manual/appendix/install/db_scripts * https://www.zabbix.com/forum/showthread.php?t=47375 * http://jamyy.us.to/blog/2012/07/3920.html {{tag>monitor install zabbix}} <html><a href="http://www.diamonds2cash.com/diamond-buyer/">diamond buyers</a></html> tech/zabbix.txt 上一次變更: 2021/01/16 14:51由 jonathan