|
1、操作环境
CentOS release 6.4 (Final)
Kernel \r on an \m
[root@xo ~]# uname -r
2.6.32-358.el6.x86_64
[root@xo ~]# uname -m
x86_64
2、下载阿里epel源并安装epel源
[root@xo ~]# wget
http://mirrors.aliyun.com/epel/epel-release-latest-6.noarch.rpm
[root@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环境
[root@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
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文件。
[root@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配置文件连接数据库的用户名库名以及密码等
[root@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
[root@xo zabbix]# /etc/init.d/zabbix-server restart
Shutting down Zabbix server: [FAILED]
Starting Zabbix server: [ OK ]
[root@xo conf]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@xo ~]# /etc/init.d/mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ] 8、安装zabbix,浏览器输入 http://ip/zabbix,根据相应的提示修改以及php.ini文件即可
|
|
|