2322312 发表于 2016-11-21 12:49:53

基于Centos6.5 构建zaabix平台

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


安装EPEL源


1
# yum install epel-release




安装LAMP 环境通过yum方式

1
# yum install zabbix20 zabbix20-agent zabbix20-server zabbix20-server-mysql zabbix20-web zabbix20-web-mysql net-snmp-devel




启动zabbix 服务,且开机启动

1
2
3
4
5
# /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:                                          




导入表库信息


1
2
3
# 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方式进行安装

出现了时区的问题, 这里修改/etc/php.ini 文件
开发其date.timezone = date.timezone = Asia/Chongqing   (大概在946行)

重启服务


1
2
3
# /etc/init.d/httpd restart
Stopping httpd:                                             
Starting httpd:                                             





刷新页面,问题解决


点击next 按钮, 出现了以下页面,页面参数有三个失败, 这里需要再次修改/etc/php.ini
将页面上提示的红色参数值进行调整


1
2
3
4
5
6
7
# 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





修改完后, 重新加载及刷新页面

问题解决都是OK 状态了



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# 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
#









点击下一步



1
2
3
4
5
6
7
8
9
10
11
12
# /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
#









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




在以上配置的时候注意zabbix数据库密码设置,若配置文件没有定义zabbix 数据库密码, 这里修改

1
2
3
4
5
6
7
8
9
10
11
12
#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






客户端安装:

1
2
3
4
5
6
7
8
# 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 端进行测试

1
2
3
# zabbix_get -s 192.168.229.146 -k "system.hostname"
linux-node2.openstack.com
#





接下来在web页面进行配置了,并且可以修改语言在profile 里设置








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