標籤:服務端 linux 監控
一、服務端部署
# 安裝擴充源,再安裝服務依賴包[[email protected] ~]# yum install -y httpd mysql mysql-libs php php-mysql mysql-server php-bcmath php-gd php-mbstring# 安裝zabbix資料包[[email protected] ~]# yum install -y zabbix22 zabbix22-agent zabbix22-server zabbix22-server-mysql zabbix22-web zabbix22-web-mysql net-snmp-devel# 分別啟動一下服務[[email protected] ~]# /etc/init.d/zabbix-server startStarting Zabbix server: [確定][[email protected] ~]# /etc/init.d/zabbix-agent startStarting Zabbix agent: [確定][[email protected] ~]# /etc/init.d/httpd start正在啟動 httpd: [確定]# mysql配置修改字元集[[email protected] ~]# vim /etc/my.cnf[mysql]default-character-set = utf8[mysqld]character_set_server = utf8[[email protected] ~]# /etc/init.d/mysqld start正在啟動 mysqld: [確定]# 建立資料庫,匯入資料[[email protected] ~]# mysql -uroot -e "create database zabbix"[[email protected] ~]# mysql -uroot -e "grant all on zabbix.* to ‘root‘@‘localhost‘ identified by ‘zabbix‘"[[email protected] ~]# mysql -uroot -p --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/schema.sqlEnter password:[[email protected] ~]# mysql -uroot -p --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/images.sqlEnter password:[[email protected] ~]# mysql -uroot -p --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/data.sqlEnter password:
通過瀏覽器訪問,進入zabbix安裝首頁,點擊下一步
650) this.width=650;" style="width:600px;height:392px;" src="http://s3.51cto.com/wyfs02/M01/6E/92/wKioL1WAM43wZqzTAAPWJ0GFK0E239.jpg" title="z1.jpg" alt="wKioL1WAM43wZqzTAAPWJ0GFK0E239.jpg" border="0" height="392" hspace="0" vspace="0" width="600" />
這裡出現了一些fail選項,我們需要對主機的php配置進行調試
650) this.width=650;" style="width:600px;height:458px;" src="http://s3.51cto.com/wyfs02/M01/6E/96/wKiom1WAMmLiyCAZAAQ5RDLa82E719.jpg" title="z2.jpg" alt="wKiom1WAMmLiyCAZAAQ5RDLa82E719.jpg" border="0" height="458" hspace="0" vspace="0" width="600" />
[[email protected] ~]# vim /etc/php.inipost_max_size = 8M 修改為 post_max_size = 16Mmax_execution_time = 30 修改為 max_execution_time = 300max_input_time = 60 修改為 max_input_time = 300;date.timezone = 修改為 date.timezone = ‘Asia/Chongqing‘[[email protected] ~]# /etc/init.d/httpd restart停止 httpd: [確定]正在啟動 httpd: [確定]
點擊retry,全部OK了,點擊next
650) this.width=650;" style="width:600px;height:458px;" src="http://s3.51cto.com/wyfs02/M01/6E/93/wKioL1WAOgjBttnRAAQRHd_3kNU220.jpg" title="z3.jpg" alt="wKioL1WAOgjBttnRAAQRHd_3kNU220.jpg" border="0" height="458" hspace="0" vspace="0" width="600" />
進行資料庫資訊配置
650) this.width=650;" style="width:600px;height:458px;" src="http://s3.51cto.com/wyfs02/M02/6E/93/wKioL1WAOr2xSSuEAAOf9IyCGjs882.jpg" title="z4.jpg" alt="wKioL1WAOr2xSSuEAAOf9IyCGjs882.jpg" border="0" height="458" hspace="0" vspace="0" width="600" />
點擊Test connection ,測試OK,點擊下一步
650) this.width=650;" style="width:600px;height:458px;" src="http://s3.51cto.com/wyfs02/M00/6E/97/wKiom1WAOlrRPHVQAAOl3hyCce8016.jpg" title="z5.jpg" alt="wKiom1WAOlrRPHVQAAOl3hyCce8016.jpg" border="0" height="458" hspace="0" vspace="0" width="600" />
輸入主機IP地址和連接埠號碼(預設值),安裝的名字(可選),點擊next
650) this.width=650;" style="width:600px;height:458px;" src="http://s3.51cto.com/wyfs02/M00/6E/97/wKiom1WAO4qQm87OAAMzB2jFV48555.jpg" title="z6.jpg" alt="wKiom1WAO4qQm87OAAMzB2jFV48555.jpg" border="0" height="458" hspace="0" vspace="0" width="600" />
最後資訊確認,點擊next
650) this.width=650;" style="width:600px;height:458px;" src="http://s3.51cto.com/wyfs02/M01/6E/97/wKiom1WAPEjRTD0xAAOTsMHtDvU215.jpg" title="z7.jpg" alt="wKiom1WAPEjRTD0xAAOTsMHtDvU215.jpg" border="0" height="458" hspace="0" vspace="0" width="600" />
安裝完成,點擊finish
650) this.width=650;" style="width:600px;height:458px;" src="http://s3.51cto.com/wyfs02/M00/6E/93/wKioL1WAPjTDQVMlAAL8JEQKhyw497.jpg" title="z8.jpg" alt="wKioL1WAPjTDQVMlAAL8JEQKhyw497.jpg" border="0" height="458" hspace="0" vspace="0" width="600" />
安裝完成,進入登陸介面,預設賬戶admin,密碼zabbix
650) this.width=650;" style="width:600px;height:458px;" src="http://s3.51cto.com/wyfs02/M01/6E/97/wKiom1WAPNfD92V0AALfpXKBK5Q763.jpg" title="z9.jpg" alt="wKiom1WAPNfD92V0AALfpXKBK5Q763.jpg" border="0" height="458" hspace="0" vspace="0" width="600" />
第一次登陸完畢之後,會提示警告,我們需要進行修改
650) this.width=650;" style="width:600px;height:531px;" src="http://s3.51cto.com/wyfs02/M02/6E/97/wKiom1WAPaCBFlCyAAVbvbTuo4c101.jpg" title="z10.jpg" alt="wKiom1WAPaCBFlCyAAVbvbTuo4c101.jpg" border="0" height="531" hspace="0" vspace="0" width="600" />
# 修改zabbix伺服器主配置[[email protected] ~]# vim /etc/zabbix/zabbix_server.confDBUser=rootDBPassword=zabbix[[email protected] ~]# /etc/init.d/zabbix-server startStarting Zabbix server: [確定]
再看zabbix主介面,我們發現沒有錯誤了
650) this.width=650;" style="width:600px;height:531px;" src="http://s3.51cto.com/wyfs02/M02/6E/93/wKioL1WAQLyw4XCqAAUPXAe2WNk001.jpg" title="z11.jpg" alt="wKioL1WAQLyw4XCqAAUPXAe2WNk001.jpg" border="0" height="531" hspace="0" vspace="0" width="600" />
二、如何添加主機,去監控主機
# 在被監控的主機上安裝和配置zabbix用戶端[[email protected] ~]# yum install -y zabbix22-agent[[email protected] ~]# vim /etc/zabbix_agentd.conf# 配置監控伺服器的IP地址Server=192.168.1.134# 啟動用戶端服務[[email protected] ~]# /etc/init.d/zabbix-agentd startStarting Zabbix agent: [確定]
一、添加主機名稱和主機地址,點擊save
650) this.width=650;" style="width:600px;height:536px;" src="http://s3.51cto.com/wyfs02/M02/6E/AC/wKiom1WCQ2aTlxH1AATSdHqcBAw086.jpg" title="z1.jpg" alt="wKiom1WCQ2aTlxH1AATSdHqcBAw086.jpg" border="0" height="536" hspace="0" vspace="0" width="600" />
二、儲存完畢,主機中就增加了一個剛才添加的主機
650) this.width=650;" style="width:600px;height:82px;" src="http://s3.51cto.com/wyfs02/M00/6E/A8/wKioL1WCRVTCm5pQAAE9Qiwi6_A060.jpg" title="z2.jpg" alt="wKioL1WCRVTCm5pQAAE9Qiwi6_A060.jpg" border="0" height="82" hspace="0" vspace="0" width="600" />
三、添加主機模板
點擊Templates,在Link new templates中輸入linux關鍵詞,顯示相關模板列表,選擇Template OS Linux,再點擊save
650) this.width=650;" style="width:600px;height:536px;" src="http://s3.51cto.com/wyfs02/M02/6E/AC/wKiom1WCRMfSQLgzAAPTL7HcZn8704.jpg" title="z3.jpg" alt="wKiom1WCRMfSQLgzAAPTL7HcZn8704.jpg" border="0" height="536" hspace="0" vspace="0" width="600" />
本文出自 “Topspeed_King” 部落格,請務必保留此出處http://mylinuxlife.blog.51cto.com/4706737/1664010
Linux搭建Zabbix監控服務