Zabbix是使用非常广泛的开源监控管理工具。基于Zabbix可以很方便的建立面向操作系统,应用,中间件,数据库等领域的监控、性能数据可视化、报警、维护窗口管理等监控管理工作。 不多说了,分享直接上实战,zabbix 版本稍微旧了点, 比较是实用, 后期在更新。。
安装EPEL源
[root@linux-node1 ~]# yum install epel-release
安装LAMP 环境通过yum方式
[root@linux-node1 ~]# yum install zabbix20 zabbix20-agent zabbix20-server zabbix20-server-mysql zabbix20-web zabbix20-web-mysql net-snmp-devel
启动zabbix 服务,且开机启动
[root@linux-node1 ~]# /etc/init.d/zabbix-server start; /etc/init.d/zabbix-agent start Starting Zabbix server: [ OK ] Starting Zabbix agent: [ OK ] [root@linux-node1 ~]# /etc/init.d/mysqld start; /etc/init.d/httpd start Starting mysqld: [ OK ]
导入表库信息
[root@linux-node1 ~]# mysql -uroot -popenstack --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/schema.sql [root@linux-node1 ~]# mysql -uroot -popenstack --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/images.sql [root@linux-node1 ~]# mysql -uroot -popenstack --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/data.sql
访问http://ip/zabbix ,通过web方式进行安装
出现了时区的问题, 这里修改/etc/php.ini 文件
开发其date.timezone = date.timezone = Asia/Chongqing (大概在946行)
重启服务
[root@linux-node1 ~]# /etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ]
刷新页面,问题解决
点击next 按钮, 出现了以下页面,页面参数有三个失败, 这里需要再次修改/etc/php.ini
将页面上提示的红色参数值进行调整
[root@linux-node1 ~]# grep max_size /etc/php.ini post_max_size = 16M [root@linux-node1 ~]# grep max_exec /etc/php.ini max_execution_time = 300 [root@linux-node1 ~]# grep max_input_time /etc/php.ini ; max_input_time max_input_time = 300
修改完后, 重新加载及刷新页面
问题解决都是OK 状态了
[root@linux-node1 ~]# mysql -uroot -p openstack -e grant all on zabbix.* to ‘zabbix‘@localhost identified by ‘zabbixpasswd‘ (数据默认无登陆密码可以通过此命令执行) [root@linux-node1 ~]# mysql -u root -p openstack Enter password: ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: YES) [root@linux-node1 ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 18 Server version: 5.1.73-log Source distribution Copyright (c) 2000, 2013, 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> use zabbix; Database changed mysql> grant all on zabbix.* to ‘zabbix‘@localhost identified by ‘zabbixpasswd‘ -> ; Query OK, 0 rows affected (0.07 sec) mysql> quit Bye [root@linux-node1 ~]# mysql -uzabbix -pzabbixpasswd Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 19 Server version: 5.1.73-log Source distribution Copyright (c) 2000, 2013, 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> quit Bye [root@linux-node1 ~]#
[root@linux-node1 ~]# /etc/init.d/zabbix-server start Starting Zabbix server: [ OK ] [root@linux-node1 ~]# ps aux |grep zabbix zabbix 3541 0.0 0.1 74672 1100 ? S 05:38 0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf zabbix 3543 0.0 0.1 74672 1100 ? S 05:38 0:01 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf zabbix 3544 0.0 0.1 74672 888 ? S 05:38 0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf zabbix 3545 0.0 0.1 74672 888 ? S 05:38 0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf zabbix 3546 0.0 0.1 74672 888 ? S 05:38 0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf zabbix 3547 0.0 0.1 74684 1076 ? S 05:38 0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf 494 4347 0.0 0.2 116000 2428 ? S 06:05 0:00 /usr/sbin/zabbix_server -c /etc/zabbix_server.conf root 4353 0.0 0.0 103248 848 pts/1 S+ 06:05 0:00 grep zabbix [root@linux-node1 ~]#
点击Finish 即可出现zabbix 的登陆界面
在以上配置的时候注意zabbix数据库密码设置,若配置文件没有定义zabbix 数据库密码, 这里修改
[root@linux-node1 ~]# vim /etc/zabbix/zabbix_server.conf 111 DBPassword=zabbixpasswd [root@linux-node1 ~]# /etc/init.d/zabbix-server restart Shutting down Zabbix server: [ OK ] Starting Zabbix server: [ OK ] [root@linux-node1 ~]# netstat -tulnp |grep zabbix tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 3541/zabbix_agentd tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 4520/zabbix_server tcp 0 0 :::10050 :::* LISTEN 3541/zabbix_agentd tcp 0 0 :::10051 :::* LISTEN 4520/zabbix_server
客户端安装:
[root@linux-node2 yum.repos.d]# yum install zabbix20-agent [root@linux-node2 yum.repos.d]# vim /etc/zabbix_agentd.conf [root@linux-node2 yum.repos.d]# /etc/init.d/zabbix-agent start Starting Zabbix agent: [ OK ] [root@linux-node2 yum.repos.d]# netstat -tnlp|grep zabbix tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 2760/zabbix_agentd tcp 0 0 :::10050 :::* LISTEN 2760/zabbix_agentd [root@linux-node2 yum.repos.d]#
在Server 端进行测试
[root@linux-node1 yum.repos.d]# zabbix_get -s 192.168.229.146 -k "system.hostname" linux-node2.openstack.com [root@linux-node1 yum.repos.d]#
接下来在web页面进行配置了,并且可以修改语言在profile 里设置
本文出自 “每天进步一点点” 博客,请务必保留此出处http://lj119.blog.51cto.com/605062/1874581
原文地址:http://lj119.blog.51cto.com/605062/1874581