您好,登录后才能下订单哦!
本篇内容介绍了“zabbix服务器端安装及配置”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
zabbix版本选择LTS的3.0版本、server端OS版本为RHEL 6.5
配置zabbix仓库,进行yum安装zabbix
~]# cd /etc/yum.repos.d/ yum.repos.d]# vim zabbix.repo [zabbix] name=zabbix repo baseurl=http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/ enabled=1 gpgcheck=0
安装mysql,进行配置修改并启动
~]# yum install mysql-server -y ~]# vim /etc/my.cnf [mysqld] datadir=/home/mysqldata socket=/var/lib/mysql/mysql.sock user=mysql # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid skip_name_resolve=on innodb_file_per_table=on ~]# service mysqld start
创建zabbix库,并授权链接
[root@wuzabbix mysqldata]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 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> CREATE DATABASE zabbix CHARSET 'utf8'; Query OK, 1 row affected (0.00 sec) mysql> GRANT ALL ON zabbix.* TO zbxuser@'127.0.0.1' IDENTIFIED BY '*'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL ON zabbix.* TO zbxuser@'10.%.%.%' IDENTIFIED BY '*'; Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)
安装zabbix相关组件并进行zabbix库初始化
~]# yum install zabbix-server-mysql zabbix-web zabbix-agent zabbix-web-mysql zabbix-sender zabbix-get 查看zabbix-mysql相关内容 ~]# rpm -ql zabbix-server-mysql /etc/init.d/zabbix-server /etc/logrotate.d/zabbix-server /etc/zabbix/zabbix_server.conf /usr/lib/zabbix/alertscripts /usr/lib/zabbix/externalscripts /usr/sbin/zabbix_server_mysql /usr/share/doc/zabbix-server-mysql-3.0.9 /usr/share/doc/zabbix-server-mysql-3.0.9/AUTHORS /usr/share/doc/zabbix-server-mysql-3.0.9/COPYING /usr/share/doc/zabbix-server-mysql-3.0.9/ChangeLog /usr/share/doc/zabbix-server-mysql-3.0.9/NEWS /usr/share/doc/zabbix-server-mysql-3.0.9/README /usr/share/doc/zabbix-server-mysql-3.0.9/create.sql.gz /usr/share/man/man8/zabbix_server.8.gz /var/log/zabbix /var/run/zabbix
zabbix库初始化操作
[root@wuzabbix zabbix]# cd /usr/share/doc/zabbix-server-mysql-3.0.9/ [root@wuzabbix zabbix-server-mysql-3.0.9]# gzip -d create.sql.gz [root@wuzabbix zabbix-server-mysql-3.0.9]# ll total 3752 -rw-r--r-- 1 root root 98 Apr 20 20:05 AUTHORS -rw-r--r-- 1 root root 718465 Apr 20 20:05 ChangeLog -rw-r--r-- 1 root root 17990 Apr 20 20:05 COPYING -rw-r--r-- 1 root root 3086105 Apr 24 01:57 create.sql -rw-r--r-- 1 root root 52 Apr 20 20:05 NEWS -rw-r--r-- 1 root root 188 Apr 20 20:05 README [root@wuzabbix zabbix-server-mysql-3.0.9]# mysql -h227.0.0.1 -uzbxuser -p *** < create.sql Enter password: [root@wuzabbix zabbix-server-mysql-3.0.9]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 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> use zabbix Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql> SHOW tables; +----------------------------+ | Tables_in_zabbix | +----------------------------+ | acknowledges | | actions| | alerts | | application_discovery | | application_prototype | | 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_text | | history_uint | | host_discovery | | host_inventory | | hostmacro | | hosts | | hosts_groups | | hosts_templates| | housekeeper| | httpstep | | httpstepitem | | httptest | | httptestitem | | icon_map | | icon_mapping | | ids| | p_w_picpaths | | interface | | interface_discovery| | item_application_prototype | | item_condition | | item_discovery | | items | | items_applications | | maintenances | | maintenances_groups| | maintenances_hosts | | maintenances_windows | | mappings | | media | | media_type | | opcommand | | opcommand_grp | | opcommand_hst | | opconditions | | operations | | opgroup| | opinventory| | opmessage | | opmessage_grp | | opmessage_usr | | optemplate | | profiles | | proxy_autoreg_host | | proxy_dhistory | | proxy_history | | regexps| | rights | | screen_user| | screen_usrgrp | | screens| | screens_items | | scripts| | service_alarms | | services | | services_links | | services_times | | sessions | | slides | | slideshow_user | | slideshow_usrgrp | | slideshows | | sysmap_element_url | | sysmap_url | | sysmap_user| | sysmap_usrgrp | | sysmaps| | sysmaps_elements | | sysmaps_link_triggers | | sysmaps_links | | timeperiods| | trends | | trends_uint| | trigger_depends| | trigger_discovery | | triggers | | users | | users_groups | | usrgrp | | valuemaps | +----------------------------+ 113 rows in set (0.00 sec)
启动zabbix-server进程
进程 /etc/init.d/zabbix-server 配置文件说明: /etc/zabbix/zabbix_server.conf 指令有四类: ############ GENERAL PARAMETERS ################# ############ ADVANCED PARAMETERS ################ ####### LOADABLE MODULES ####### ####### TLS-RELATED PARAMETERS ####### 配置文档修改如下: ListenPort=10051 SourceIP= LogType=file LogFile=/var/log/zabbix/zabbix_server.log LogFileSize=1024 #日志切换 PidFile=/var/run/zabbix/zabbix_server.pid DBHost=127.0.0.1 DBName=zabbix DBUser=zbxuser DBPassword=***** DBSocket=/var/lib/mysql/mysql.sock #根据mysql具体配置设置 启动zabbix服务 [root@wuzabbix ~]# service zabbix-server start Starting Zabbix server:[ OK ] [root@wuzabbix ~]# service zabbix-server status zabbix_server (pid 10995) is running...
由于zabbix-web对php版本有最低配置,首先对php相关组件进行处理
升级PHP 配置webtatic源 ~]# rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm 卸载旧版本php ~]# yum erase php php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mcrypt php-mbstring php-devel php-pecl-memcached php-pecl-memcache php-common php-pdo php-cli php-fpm libmemcached 安装新版本php ~]# yum install httpd php56w php56w-mysql php56w-gd php56w-imap php56w-ldap php56w-odbc php56w-pear php56w-xml php56w-xmlrpc php56w-mcrypt php56w-mbstring php56w-devel php56w-pecl-memcached php56w-common php56w-pdo php56w-cli php56w-pecl-memcache php56w-bcmath php56w-fpm
配置php的时区指定
~]# vim /etc/php.ini date.timezone = Asia/Shanghai post_max_size = 32M max_execution_time = 300 max_input_time = 300 always_populate_raw_post_data = -1
启动web server
service httpd start
创建zabbix的web资源,并授予相关权限
~]# mkdir /var/www/html/zabbix ~]# cd /usr/share/zabbix/ ~]# cp -a . /var/www/html/zabbix/ ~]# chown -R apache:apache /var/www/html/zabbix
配置结束后将相关服务添加至开启自启动(httpd,mysqld,zabbix-server,zabbix-agent)
chkconfig httpd on chkconfig mysqld on chkconfig zabbix-server on chkconfig zabbix-agentd on service zabbix-server restart
备注,启动http时有一个报错,修改相应权限后正常
[Mon May 22 15:39:53 2017] [error] [client 10.55.56.86] PHP Warning: require_once(/etc/zabbix/web/maintenance.inc.php): failed to open stream: Permission denied in /var/www/html/zabbix/include/classes/core/ZBase.php on line 269 ]# chmod -R 755 /etc/zabbix/web
配置完成后便可进入web进行配置,访问URL:http://server/zabbix
手动download并拷贝过去
初始账号及密码:
admin
zabbix
“zabbix服务器端安装及配置”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。