安装zabbix
1. 准备好lamp架构(安装好mysql,php)
2.在数据库中授权:
MariaDB [(none)]> create database zabbix charset utf8;
Query OK, 1 row affected (0.33 sec)
MariaDB [(none)]> grant all on zabbix.* to 'zbxuser'@'172.16.%.%' identified by 'zbxpass';
Query OK, 0 rows affected (0.43 sec)
MariaDB [(none)]> grant all on zabbix.* to 'zbxuser'@'node2.stu21.com' identified by 'zbxpass';
Query OK, 0 rows affected, 1 warning (0.00 sec)
[root@node2 ~]# cd zabbix-2.4/
[root@node2 zabbix-2.4]#
[root@node2 zabbix-2.4]# ls
zabbix-2.4.0-1.el6.x86_64.rpm
zabbix-agent-2.4.0-1.el6.x86_64.rpm
zabbix-get-2.4.0-1.el6.x86_64.rpm
zabbix-java-gateway-2.4.0-1.el6.x86_64.rpm
zabbix-proxy-2.4.0-1.el6.x86_64.rpm
zabbix-proxy-mysql-2.4.0-1.el6.x86_64.rpm
zabbix-proxy-pgsql-2.4.0-1.el6.x86_64.rpm
zabbix-proxy-sqlite3-2.4.0-1.el6.x86_64.rpm
zabbix-release-2.4-1.el6.noarch.rpm
zabbix-sender-2.4.0-1.el6.x86_64.rpm
zabbix-server-2.4.0-1.el6.x86_64.rpm
zabbix-server-mysql-2.4.0-1.el6.x86_64.rpm
zabbix-server-pgsql-2.4.0-1.el6.x86_64.rpm
zabbix-web-2.4.0-1.el6.noarch.rpm
zabbix-web-japanese-2.4.0-1.el6.noarch.rpm
zabbix-web-mysql-2.4.0-1.el6.noarch.rpm
zabbix-web-pgsql-2.4.0-1.el6.noarch.rpm
[root@node2 zabbix-2.4]# yum install zabbix-server-2.4.0-1.el6.x86_64.rpm zabbix-server-mysql-2.4.0-1.el6.x86_64.rpm zabbix-get-2.4.0-1.el6.x86_64.rpm zabbix-2.4.0-1.el6.x86_64.rpm zabbix-web-2.4.0-1.el6.noarch.rpm zabbix-web-mysql-2.4.0-1.el6.noarch.rpm zabbix-agent-2.4.0-1.el6.x86_64.rpm zabbix-sender-2.4.0-1.el6.x86_64.rpm
[root@node2 ~]# cd /usr/share/doc/zabbix-server-mysql-2.4.0/
[root@node2 zabbix-server-mysql-2.4.0]# ls
create upgrades
[root@node2 zabbix-server-mysql-2.4.0]# cd create/
[root@node2 create]# ls
data.sql images.sql schema.sql
#按照从后到前的顺序依次倒入数据库 zabbix中
[root@node2 create]# mysql zabbix < schema.sql
[root@node2 create]# mysql zabbix < images.sql
[root@node2 create]# mysql zabbix < data.sql
[root@node2 ~]# cd /etc/zabbix/
[root@node2 zabbix]# ls
web zabbix_agentd.conf zabbix_agentd.d zabbix_server.conf
#修改 zabbix_server.conf配置
[root@node2 ~]# service zabbix-server restart
Shutting down Zabbix server: [ OK ]
Starting Zabbix server: [ OK ]
[root@node2 ~]# ss -tnl
在浏览器上
此时我们还要修改php的时区
因为我的php是通过yum 安装的
[root@node2 ~]# vim /etc/php.ini
找到timezone
访问
zabbix 的监控界面:
接下配置一下zabbix 监控自己
如果授权外来主机允许哪些地址获取数据的,直接在后面再外来主机的ip地址
注意:hostname必须全球唯一,最好dns解析,来确定
[root@node2 ~]# service zabbix-agent start
Starting Zabbix agent: [ OK ]
[root@node2 ~]# ss -tnl
再次访问
此时我们点击status的disabled
如果我们想监控其它节点,该如何做啦?
假如监控节点 node3,我们需要在节点node3部署agent, 然后再zabbix 监控界面上 create host
[root@node3 ~]# cd zabbix-2.4/
[root@node3 zabbix-2.4]# ls
zabbix-2.4.0-1.el6.x86_64.rpm zabbix-proxy-pgsql-2.4.0-1.el6.x86_64.rpm zabbix-server-pgsql-2.4.0-1.el6.x86_64.rpm
zabbix-agent-2.4.0-1.el6.x86_64.rpm zabbix-proxy-sqlite3-2.4.0-1.el6.x86_64.rpm zabbix-web-2.4.0-1.el6.noarch.rpm
zabbix-get-2.4.0-1.el6.x86_64.rpm zabbix-release-2.4-1.el6.noarch.rpm zabbix-web-japanese-2.4.0-1.el6.noarch.rpm
zabbix-java-gateway-2.4.0-1.el6.x86_64.rpm zabbix-sender-2.4.0-1.el6.x86_64.rpm zabbix-web-mysql-2.4.0-1.el6.noarch.rpm
zabbix-proxy-2.4.0-1.el6.x86_64.rpm zabbix-server-2.4.0-1.el6.x86_64.rpm zabbix-web-pgsql-2.4.0-1.el6.noarch.rpm
zabbix-proxy-mysql-2.4.0-1.el6.x86_64.rpm zabbix-server-mysql-2.4.0-1.el6.x86_64.rpm
[root@node3 zabbix-2.4]# yum install zabbix-2.4.0-1.el6.x86_64.rpm zabbix-agent-2.4.0-1.el6.x86_64.rpm zabbix-sender-2.4.0-1.el6.x86_64.rpm
[root@node3 zabbix-2.4]# cd /etc/zabbix/
[root@node3 zabbix]# ls
zabbix_agentd.conf zabbix_agentd.d
[root@node3 zabbix]# vim zabbix_agentd.conf
此时的Server地址只能是主服务器,因为我们通过主节点node2来监控从节点node3
[root@node3 ~]# service zabbix-agent start
Starting Zabbix agent: [ OK ]
#确保iptables规则 没有把10050端口枪毙
[root@node3 ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
[root@node3 ~]# ss -tnl