|
1、操作环境
1
2
3
4
5
6
| CentOS release 6.4 (Final)
Kernel \r on an \m
[iyunv@xo ~]# uname -r
2.6.32-358.el6.x86_64
[iyunv@xo ~]# uname -m
x86_64
|
2、下载阿里epel源并安装epel源
1
2
3
4
| [iyunv@xo ~]# rpm -ivh epel-release-latest-6.noarch.rpm
warning: epel-release-latest-6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:epel-release ########################################### [100%]
|
3、安装zabbix环境
1
| [iyunv@xo doc]# yum install zabbix22-server-mysql.x86_64 zabbix22-web-mysql.noarch zabbix22-server.noarch zabbix22-dbfiles-mysql.noarch zabbix-get zabbix22.x86_64 zabbix22-agent.x86_64 zabbix22-web.noarch mysql-server httpd -y
|
4、启动mysql并创建zabbix用户和密码及库,字符集设置utf8
1
2
3
4
5
6
| mysql> create database zabbix character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
|
5、使用zabbix用户登录mysql,并导入相关sql文件。
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
| [iyunv@xo zabbix-mysql]# mysql -uzabbix -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.73 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
| zabbix |
+--------------------+
3 rows in set (0.00 sec)
mysql> use zabbix
Database changed
mysql> source /usr/share/zabbix-mysql/schema.sql
mysql> source /usr/share/zabbix-mysql/images.sql
mysql> source /usr/share/zabbix-mysql/data.sql
mysql> use zabbix;
Database changed
mysql> show tables;
+-----------------------+
| Tables_in_zabbix |
+-----------------------+
| acknowledges |
| actions |
| alerts |
| application_template |
| applications |
| auditlog |
| auditlog_details |
| autoreg_host |
| conditions |
| config |
| dbversion |
| dchecks |
| dhosts |
| drules |
| dservices |
| escalations |
| events |
| expressions |
| functions |
| globalmacro |
| globalvars |
| graph_discovery |
| graph_theme |
| graphs |
| graphs_items |
| group_discovery |
| group_prototype |
| groups |
| history |
| history_log |
| history_str |
| history_str_sync |
| history_sync |
| history_text |
| history_uint |
| history_uint_sync |
| host_discovery |
| host_inventory |
| hostmacro |
| hosts |
| hosts_groups |
| hosts_templates |
| housekeeper |
| httpstep |
| httpstepitem |
| httptest |
| httptestitem |
| icon_map |
| icon_mapping |
| ids |
| images |
| interface |
| interface_discovery |
| item_discovery |
| items |
| items_applications |
| maintenances |
| maintenances_groups |
| maintenances_hosts |
| maintenances_windows |
| mappings |
| media |
| media_type |
| node_cksum |
| nodes |
| opcommand |
| opcommand_grp |
| opcommand_hst |
| opconditions |
| operations |
| opgroup |
| opmessage |
| opmessage_grp |
| opmessage_usr |
| optemplate |
| profiles |
| proxy_autoreg_host |
| proxy_dhistory |
| proxy_history |
| regexps |
| rights |
| screens |
| screens_items |
| scripts |
| service_alarms |
| services |
| services_links |
| services_times |
| sessions |
| slides |
| slideshows |
| sysmap_element_url |
| sysmap_url |
| sysmaps |
| sysmaps_elements |
| sysmaps_link_triggers |
| sysmaps_links |
| timeperiods |
| trends |
| trends_uint |
| trigger_depends |
| trigger_discovery |
| triggers |
| user_history |
| users |
| users_groups |
| usrgrp |
| valuemaps |
+-----------------------+
108 rows in set (0.00 sec)
|
6、修改zabbix-server配置文件连接数据库的用户名库名以及密码等
1
2
3
4
5
6
7
8
9
10
11
| [iyunv@xo ~]# grep '^[a-Z]' /etc/zabbix_server.conf
LogFile=/var/log/zabbixsrv/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbixsrv/zabbix_server.pid
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
DBSocket=/var/lib/mysql/mysql.sock
AlertScriptsPath=/var/lib/zabbixsrv/alertscripts
ExternalScripts=/var/lib/zabbixsrv/externalscripts
TmpDir=/var/lib/zabbixsrv/tmp
|
7、启动httpd zabbix-server mysql
1
2
3
4
5
6
7
8
9
| [iyunv@xo zabbix]# /etc/init.d/zabbix-server restart
Shutting down Zabbix server: [FAILED]
Starting Zabbix server: [ OK ]
[iyunv@xo conf]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[iyunv@xo ~]# /etc/init.d/mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
|
8、安装zabbix,浏览器输入 http://ip/zabbix,根据相应的提示修改以及php.ini文件即可
|
|
|