发表于 2019-1-20 06:15:20

基于Centos6.5 构建zabbix平台

  Zabbix是使用非常广泛的开源监控管理工具。基于Zabbix可以很方便的建立面向操作系统,应用,中间件,数据库等领域的监控、性能数据可视化、报警、维护窗口管理等监控管理工作。 不多说了,分享直接上实战,zabbix 版本稍微旧了点, 比较是实用, 后期在更新。。

  

  安装EPEL源

# yum install epel-release  安装LAMP 环境通过yum方式
# yum install zabbix20 zabbix20-agent zabbix20-server zabbix20-server-mysql zabbix20-web zabbix20-web-mysql net-snmp-devel  启动zabbix 服务,且开机启动
# /etc/init.d/zabbix-server start; /etc/init.d/zabbix-agent start
Starting Zabbix server:                                    
Starting Zabbix agent:                                    
# /etc/init.d/mysqld start; /etc/init.d/httpd start
Starting mysqld:                                             导入表库信息

# mysql -uroot -popenstack --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/schema.sql
# mysql -uroot -popenstack --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/images.sql
# mysql -uroot -popenstack --default-character-set=utf8 zabbix < /usr/share/zabbix-mysql/data.sql  

  访问http://ip/zabbix,通过web方式进行安装
http://s5.运维网.com/wyfs02/M02/8A/6D/wKioL1gv8bLTuMjKAAN7mg86IZo147.png
  出现了时区的问题, 这里修改/etc/php.ini 文件
  开发其date.timezone = date.timezone = Asia/Chongqing   (大概在946行)
  
  重启服务

# /etc/init.d/httpd restart
Stopping httpd:                                             
Starting httpd:                                                

  刷新页面,问题解决
http://s1.运维网.com/wyfs02/M00/8A/6D/wKioL1gv8iKwTXOkAANLJa1gG5k119.png
  

  点击next 按钮, 出现了以下页面,页面参数有三个失败, 这里需要再次修改/etc/php.ini
  将页面上提示的红色参数值进行调整
http://s5.运维网.com/wyfs02/M01/8A/71/wKiom1gv8mnAsI9rAAHDJE5Bosg874.png
# grep max_size /etc/php.ini
post_max_size = 16M
# grep max_exec /etc/php.ini
max_execution_time = 300
# grep max_input_time /etc/php.ini
; max_input_time
max_input_time = 300  

  修改完后, 重新加载及刷新页面
http://s5.运维网.com/wyfs02/M01/8A/71/wKiom1gv8qGz3GlfAAGeQAxlIFs716.png
  问题解决都是OK 状态了
  

# mysql -uroot -p openstack -e grant all on zabbix.* to 'zabbix'@localhost identified by 'zabbixpasswd'   (数据默认无登陆密码可以通过此命令执行)
# mysql -u root -p openstack
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
# 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
# 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
#http://s4.运维网.com/wyfs02/M01/8A/71/wKiom1gv9MKQiy_yAAGTYrN-Zkw544.png
http://s1.运维网.com/wyfs02/M01/8A/6D/wKioL1gv9MOQgi8OAAGPVtpGEIw103.png

  

  点击下一步
http://s1.运维网.com/wyfs02/M02/8A/71/wKiom1gv9MTBsFJCAAFUUs3_iKA542.png

# /etc/init.d/zabbix-server start
Starting Zabbix server:                                    
# ps aux |grep zabbix
zabbix   35410.00.1746721100 ?      S    05:38   0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf
zabbix   35430.00.1746721100 ?      S    05:38   0:01 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf
zabbix   35440.00.174672   888 ?      S    05:38   0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf
zabbix   35450.00.174672   888 ?      S    05:38   0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf
zabbix   35460.00.174672   888 ?      S    05:38   0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf
zabbix   35470.00.1746841076 ?      S    05:38   0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix_agentd.conf
494      43470.00.2 1160002428 ?      S    06:05   0:00 /usr/sbin/zabbix_server -c /etc/zabbix_server.conf
root       43530.00.0 103248   848 pts/1    S+   06:05   0:00 grep zabbix
#  

http://s1.运维网.com/wyfs02/M02/8A/6D/wKioL1gv9MTxEa_mAAFsChHJhgQ521.png
http://s2.运维网.com/wyfs02/M00/8A/71/wKiom1gv9MWSp2AVAAFmg8FH93A508.png
http://s2.运维网.com/wyfs02/M02/8A/6D/wKioL1gv9MahyI0QAAFY6DfAmf4278.png

  点击Finish 即可出现zabbix 的登陆界面
  

http://s3.运维网.com/wyfs02/M00/8A/6D/wKioL1gv9MfRWvIQAAH5dSd55m8072.png
http://s1.运维网.com/wyfs02/M01/8A/71/wKiom1gv9MiwQLD5AAF6CHiTx9Y048.png
  

  在以上配置的时候注意zabbix数据库密码设置,若配置文件没有定义zabbix 数据库密码, 这里修改
#vim /etc/zabbix/zabbix_server.conf
111 DBPassword=zabbixpasswd
# /etc/init.d/zabbix-server restart
Shutting down Zabbix server:                              
Starting Zabbix server:                                    
# 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  

  
客户端安装:
# yum install zabbix20-agent
# vim /etc/zabbix_agentd.conf
# /etc/init.d/zabbix-agent start
Starting Zabbix agent:                                    
# 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
#  

  

  

  在Server 端进行测试
# zabbix_get -s 192.168.229.146 -k "system.hostname"
linux-node2.openstack.com
#  
接下来在web页面进行配置了,并且可以修改语言在profile 里设置
  
http://s1.运维网.com/wyfs02/M02/8A/71/wKiom1gv9GDSiH1tAAGQAqzrQds227.png
http://s3.运维网.com/wyfs02/M02/8A/71/wKiom1gv9GHBjcHTAAGb6ze5mQ8961.png
http://s3.运维网.com/wyfs02/M02/8A/6D/wKioL1gv9GLiAOQjAALaE0L75Jk796.png
http://s3.运维网.com/wyfs02/M00/8A/71/wKiom1gv9GPT85o3AAFM0k0Farg504.png
http://s3.运维网.com/wyfs02/M00/8A/6D/wKioL1gv9GSRTDjxAAGpAMV-4V0811.png
  


  

  




页: [1]
查看完整版本: 基于Centos6.5 构建zabbix平台