- cacti、nagios、zabbix、smokeping、open-falcon等;
- cacti、smokeping偏向基礎監控,成圖很是漂亮;
- cacti、nagios、zabbix服務端監控中心,須要PHP環境支持,其中zabbix和cacti都須要mysql做爲數據存儲,nagios不用存儲歷史數據,注重服務或者監控項的狀態,zabbix會獲取服務或者監控項目的數據,會把數據記錄到數據庫裏,從而能夠成圖;
- open-falcon爲小米公司開發,開源後受到諸多大公司和運維工程師的追捧,適合大企業,滴滴、360、新浪微博、京東等大公司在使用這款監控軟件,值得研究;
- C/S架構,基於C++開發,監控中心支持web界面配置和管理;
- 單server節點能夠支持上萬臺客戶端;
- 最新版本3.4 ,官網文檔https://www.zabbix.com/manuals
Zabbix整個體系架構中有幾個主要角色:php
- zabbix-server:核心,監控中心,接收客戶端上報信息,負責配置、統計、操做數據;
- 數據存儲:存放數據,好比mysql;
- web界面:也叫web UI ,在web界面下操做配置是zabbix簡單易用的主要緣由;
- zabbix-proxy:可選組件,它能夠代替zabbix-server的功能,減輕server的壓力;
- zabbix-agent:客戶端軟件,負責採集各個監控服務或項目的數據,並上報。
[root@zlinux-01 ~]# wget repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm //下載Zabbix的yum擴展源 [root@zlinux-01 ~]# rpm -ivh zabbix-release-3.2-1.el7.noarch.rpm //安裝擴展源 [root@zlinux-01 ~]# yum install -y zabbix-agent zabbix-get zabbix-server-mysql zabbix-web zabbix-web-mysql //安裝相關安裝包 #會連帶安裝httpd和php #若是mysql以前沒有裝的話,須要根據lamp那一章的mysql安裝方法安裝msyql [root@zlinux-01 ~]# ps aux | grep mysql //查看mysql服務是否啓動,沒有就啓動下
[root@zlinux-01 ~]# vim /etc/my.cnf //在[mysqld]下添加如下一行 character_set_server = utf8 [root@zlinux-01 ~]# systemctl restart mysql //重啓mysql [root@zlinux-01 ~]# mysql -uroot -pzlinux123456 Warning: Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 Server version: 5.6.36-log MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database zabbix character set utf8; //建立zabbix庫,字符集utf8 Query OK, 1 row affected (0.00 sec) mysql> grant all on zabbix.* to 'zabbix'@'127.0.0.1' identified by 'zlinux123456'; //建立zabbix用戶,爲了zabbix鏈接數據庫 Query OK, 0 rows affected (0.00 sec) mysql> quit Bye #導入zabbix數據庫 [root@zlinux-01 ~]# cd /usr/share/doc/zabbix-server-mysql-3.2.11/ [root@zlinux-01 zabbix-server-mysql-3.2.11]# ls AUTHORS ChangeLog COPYING create.sql.gz NEWS README [root@zlinux-01 zabbix-server-mysql-3.2.11]# gzip -d create.sql.gz [root@zlinux-01 zabbix-server-mysql-3.2.11]# mysql -uroot -pzlinux123456 zabbix < create.sql #修改zabbix-server配置文件 [root@zlinux-01 ~]# vim /etc/zabbix/zabbix_server.conf //加入如下內容 DBHost=127.0.0.1 DBPassword=zlinux123456
[root@zlinux-01 ~]# systemctl stop nginx //先中止掉Nginx服務由於佔用了80,或者Nginx作下代理配置,可參考前文 [root@zlinux-01 ~]# systemctl start httpd //啓動httpd [root@zlinux-01 ~]# ps aux | grep httpd root 3472 0.0 0.8 394324 15480 ? Ss 15:20 0:00 /usr/sbin/httpd -DFOREGROUND apache 3474 0.0 0.4 394460 7680 ? S 15:20 0:00 /usr/sbin/httpd -DFOREGROUND apache 3475 0.0 0.4 394460 7680 ? S 15:20 0:00 /usr/sbin/httpd -DFOREGROUND apache 3476 0.0 0.4 394460 7680 ? S 15:20 0:00 /usr/sbin/httpd -DFOREGROUND apache 3477 0.0 0.4 394460 7680 ? S 15:20 0:00 /usr/sbin/httpd -DFOREGROUND apache 3478 0.0 0.4 394460 7680 ? S 15:20 0:00 /usr/sbin/httpd -DFOREGROUND [root@zlinux-01 ~]# systemctl start zabbix-server //啓動zabbix服務 [root@zlinux-01 ~]# ps aux | grep zabbix //查看zabbix相關,成功的狀況下有不少條服務 [root@zlinux-01 ~]# netstat -lntp //80,3306,11051三個端口 Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:45930 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd tcp 0 0 0.0.0.0:20048 0.0.0.0:* LISTEN 995/rpc.mountd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 839/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1703/master tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 3393/zabbix_server tcp 0 0 0.0.0.0:42343 0.0.0.0:* LISTEN 824/rpc.statd tcp6 0 0 :::3306 :::* LISTEN 3330/mysqld tcp6 0 0 :::111 :::* LISTEN 1/systemd tcp6 0 0 :::80 :::* LISTEN 3472/httpd tcp6 0 0 :::38704 :::* LISTEN - tcp6 0 0 :::20048 :::* LISTEN 995/rpc.mountd tcp6 0 0 :::22 :::* LISTEN 839/sshd tcp6 0 0 :::40375 :::* LISTEN 824/rpc.statd tcp6 0 0 ::1:25 :::* LISTEN 1703/master tcp6 0 0 :::2049 :::* LISTEN - tcp6 0 0 :::10051 :::* LISTEN 3393/zabbix_server
步驟1:
步驟2:
要解決此問題,須要編輯phph.ini或者Zabbix的httpd配置:mysql
[root@zlinux-01 ~]# vim /etc/httpd/conf.d/zabbix.conf //在最後增長下面一行 php_value date.timezone Asia/Shanghai [root@zlinux-01 ~]# systemctl restart httpd //重啓
步驟3:刷新下瀏覽器,繼續下一步
步驟4:
步驟5:登陸管理後臺首先更改密碼,默認帳戶:admin,密碼:zabbixlinux
[root@zlinux-04 ~]# http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm [root@zlinux-04 ~]# rpm -ivh zabbix-release-3.2-1.el7.noarch.rpm [root@zlinux-04 ~]# yum install -y zabbix-agent [root@zlinux-04 ~]# vim /etc/zabbix/zabbix_agentd.conf //修改如下內容 Server=192.168.242.128 //定義服務端IP(被動模式) Server=192.168.242.128 //定義服務點IP(主動模式) Hostname=zlinux-01 //自定義主機名 [root@zlinux-04 ~]# systemctl start zabbix-agent //啓動 [root@zlinux-04 ~]# netstat -lnp | grep zabbix //zabbix-agent監聽10050端口 tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 2436/zabbix_agentd tcp6 0 0 :::10050 :::* LISTEN 2436/zabbix_agentd