zabbix监控流程图php
安装zabbixmysql
[root@qingyun-01 ~]# rpm -i http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm 警告:/var/tmp/rpm-tmp.8EUWZ1: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY #官网有附带教程
[root@qingyun-01 ~]# yum install -y zabbix-agent zabbix-get zabbix-server-mysql zabbix-web zabbix-web-mysql
#启动mysql [root@qingyun-01 mysql]# /etc/init.d/mysqld start
vim /etc/my.cnf //须要增长配置
character_set_server = utf8ios
[root@qingyun-01 mysql]# systemctl restart mysql mysql> create database zabbix character set utf8; Query OK, 1 row affected (0.00 sec)
mysql> grant all on zabbix.* to 'zabbix'@'127.0.0.1' identified by 'qingyunzabbix'; Query OK, 0 rows affected (0.02 sec) #让zabbix web 服务能够链接数据库
#进入该目录 [root@qingyun-01 mysql]# cd /usr/share/doc/zabbix-server-mysql-3.2.11/ #压缩包须要解压一下 [root@qingyun-01 zabbix-server-mysql-3.2.11]# ls AUTHORS ChangeLog COPYING create.sql.gz NEWS README [root@qingyun-01 zabbix-server-mysql-3.2.11]# gzip -d create.sql.gz [root@qingyun-01 zabbix-server-mysql-3.2.11]# ls AUTHORS ChangeLog COPYING create.sql NEWS README #导入库里面 [root@qingyun-01 zabbix-server-mysql-3.2.11]# mysql -uroot zabbix < create.sql
[root@qingyun-01 zabbix-server-mysql-3.2.11]# systemctl start zabbix-server #检查zabbix服务 [root@qingyun-01 zabbix-server-mysql-3.2.11]# ps aux |grep zabbix zabbix 2267 0.0 0.3 254580 3496 ? S 16:41 0:00 /usr/sbin/zabbix_server -c /etc/zabbix/zabbi_server.conf root 2270 0.0 0.0 112676 984 pts/0 R+ 16:41 0:00 grep --color=auto zabbix #若是以前安装过Nginx,须要先检查是否启动 [root@qingyun-01 zabbix-server-mysql-3.2.11]# ps aux | grep nginx root 2272 0.0 0.0 112676 980 pts/0 R+ 16:41 0:00 grep --color=auto nginx #启动httpd 并 ps [root@qingyun-01 zabbix-server-mysql-3.2.11]# systemctl start httpd [root@qingyun-01 zabbix-server-mysql-3.2.11]# ps aux |grep httpd root 2279 0.3 1.5 394412 15456 ? Ss 16:42 0:00 /usr/sbin/httpd -DFOREGROUND apache 2287 0.0 0.7 394544 7692 ? S 16:42 0:00 /usr/sbin/httpd -DFOREGROUND apache 2288 0.0 0.7 394544 7692 ? S 16:42 0:00 /usr/sbin/httpd -DFOREGROUND apache 2289 0.0 0.7 394544 7692 ? S 16:42 0:00 /usr/sbin/httpd -DFOREGROUND apache 2290 0.0 0.7 394544 7692 ? S 16:42 0:00 /usr/sbin/httpd -DFOREGROUND apache 2291 0.0 0.7 394544 7692 ? S 16:42 0:00 /usr/sbin/httpd -DFOREGROUND root 2293 0.0 0.0 112676 984 pts/0 R+ 16:42 0:00 grep --color=auto httpd #查看是否监听80端口 [root@qingyun-01 zabbix-server-mysql-3.2.11]# netstat -lntp 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:22 0.0.0.0:* LISTEN 934/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1018/master tcp6 0 0 :::80 :::* LISTEN 2279/httpd tcp6 0 0 :::22 :::* LISTEN 934/sshd tcp6 0 0 ::1:25 :::* LISTEN 1018/master tcp6 0 0 :::3306 :::* LISTEN 1845/mysqld
[root@qingyun-01 zabbix-server-mysql-3.2.11]# systemctl enable httpd Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. [root@qingyun-01 zabbix-server-mysql-3.2.11]# systemctl enable zabbix-server Created symlink from /etc/systemd/system/multi-user.target.wants/zabbix-server.service to /usr/lib/systemd/system/zabbix-server.service. #若是安装过Nginx 须要停掉 [root@qingyun-01 zabbix-server-mysql-3.2.11]# systemctl disable nginx
#经过查看监听端口,发现没有监听端口 #须要查看日志排查问题 [root@qingyun-01 ~]# less /var/log/zabbix/zabbix_server.log
#编辑配置文件以后,须要重启服务,加载配置文件 [root@qingyun-01 ~]# systemctl restart zabbix-server [root@qingyun-01 ~]# ps aux |grep zabbix
[root@qingyun-01 ~]# netstat -lntp |grep zabbix tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 2375/zabbix_server tcp6 0 0 :::10051 :::* LISTEN 2375/zabbix_server
#设置时区 [root@qingyun-01 ~]# vim /etc/php.ini #编辑好配置文件后,重启httpd [root@qingyun-01 ~]# systemctl restart httpd #重启完成后,刷新将不报错
用户名admin 密码zabbixnginx
备注:修改完密码后,能够设置成中文显示。web
zabbix客户端安装sql
#下载yum源 [root@qingyun-02 ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm 获取http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm 警告:/var/tmp/rpm-tmp.JZlW14: 头V4 RSA/SHA512 Signature, 密钥 ID a14fe591: NOKEY 准备中... ################################# [100%] 正在升级/安装... 1:zabbix-release-3.2-1.el7 ################################# [100%] #安装 [root@qingyun-02 ~]# yum install -y zabbix-agent #编辑配置文件 [root@qingyun-02 ~]# vim /etc/zabbix/zabbix_agentd.conf
内容以下
Server 配置被动模式
配置监控中心的ip
ServerActive 配置主动模式
设置客户端名称数据库
[root@qingyun-02 ~]# systemctl start zabbix-agent [root@qingyun-02 ~]# ps aux |grep zabbix zabbix 1180 0.0 0.1 80664 1264 ? S 17:54 0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbi_agentd.conf zabbix 1181 0.0 0.1 80664 1300 ? S 17:54 0:00 /usr/sbin/zabbix_agentd: collector [idle 1 sec] zabbix 1182 0.0 0.1 80664 1848 ? S 17:54 0:00 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection] zabbix 1183 0.0 0.1 80664 1848 ? S 17:54 0:00 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection] zabbix 1184 0.0 0.1 80664 1848 ? S 17:54 0:00 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection] zabbix 1185 0.0 0.2 80796 2196 ? S 17:54 0:00 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec] root 1187 0.0 0.0 112676 984 pts/0 R+ 17:54 0:00 grep --color=auto zabbix [root@qingyun-02 ~]# netstat -lntp 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:80 0.0.0.0:* LISTEN 932/nginx: master p tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 917/sshd tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1010/master tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 1180/zabbix_agentd tcp6 0 0 :::22 :::* LISTEN 917/sshd tcp6 0 0 ::1:25 :::* LISTEN 1010/master tcp6 0 0 :::10050 :::* LISTEN 1180/zabbix_agentd
#登陆数据库 mysql> use zabbix Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> desc users; +----------------+---------------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+---------------------+------+-----+---------+-------+ | userid | bigint(20) unsigned | NO | PRI | NULL | | | alias | varchar(100) | NO | UNI | | | | name | varchar(100) | NO | | | | | surname | varchar(100) | NO | | | | | passwd | char(32) | NO | | | | | url | varchar(255) | NO | | | | | autologin | int(11) | NO | | 0 | | | autologout | int(11) | NO | | 900 | | | lang | varchar(5) | NO | | en_GB | | | refresh | int(11) | NO | | 30 | | | type | int(11) | NO | | 1 | | | theme | varchar(128) | NO | | default | | | attempt_failed | int(11) | NO | | 0 | | | attempt_ip | varchar(39) | NO | | | | | attempt_clock | int(11) | NO | | 0 | | | rows_per_page | int(11) | NO | | 50 | | +----------------+---------------------+------+-----+---------+-------+ 16 rows in set (0.03 sec)
#修改密码的命令 mysql> update users set passwd=md5('qingyun1') where alias= 'Admin'; Query OK, 1 row affected (0.01 sec) Rows matched: 1 Changed: 1 Warnings: 0 mysql> select * from users; +--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+--------------+---------------+---------------+ | userid | alias | name | surname | passwd | url | autologin | autologout | lang | refresh | type | theme | attempt_failed | attempt_ip | attempt_clock | rows_per_page | +--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+--------------+---------------+---------------+ | 1 | Admin | Zabbix | Administrator | 4e5a9284849f3af9ece4a2892b97dabb | | 1 | 0 | en_GB | 30 | 3 | default | 6 | 192.168.21.1 | 1517391222 | 50 | | 2 | guest | | | d41d8cd98f00b204e9800998ecf8427e | | 0 | 900 | en_GB | 30 | 1 | default | 0 | | 0 | 50 | +--------+-------+--------+---------------+----------------------------------+-----+-----------+------------+-------+---------+------+---------+----------------+--------------+---------------+---------------+ 2 rows in set (0.00 sec)