Zabbix-CentOS7下zabbix的安装与配置
Posted qq1207501666
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Zabbix-CentOS7下zabbix的安装与配置相关的知识,希望对你有一定的参考价值。
前述
Zabbix是基于Web界面的分布式系统监控的企业级开源软件。可以监控各种系统与设备,网络参数,保证服务器设备安全运营;提供灵活的通知机制。这里搭建的是LNMP环境下的zabbix
操作
步骤1: 安装mysql
http://www.cnblogs.com/qq1207501666/p/9032693.html
步骤2: 安装php
tar -zxvf php-5.6.36.tar.gz && cd php-5.6.36
./configure --prefix=/local/server/php --with-config-file-path=/local/server/php/etc --with-jpeg-dir --with-png-dir --with-iconv-dir --enable-calendar --with-curl --with-freetype-dir --with-gd --with-gettext --with-kerberos --with-libxml-dir --with-mysql --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-dom --enable-zip --with-libdir=lib64 --with-ldap
报错:
configure: error: jpeglib.h not found.
解决:
yum -y install libjpeg-devel
报错:
configure: error: png.h not found.
解决:
yum -y install libpng-devel
报错:
configure: error: freetype-config not found.
解决:
yum -y install freetype-devel
报错:
configure: error: Cannot find ldap.h
解决:
yum -y install openldap-devel
报错:
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
解决:
yum -y install libxslt-devel
make && make install
cp /local/software/php-5.6.36/php.ini-production /local/server/php/etc/php.ini
cp /local/server/php/etc/php-fpm.conf.default /local/server/php/etc/php-fpm.conf
修改php.ini(zabbix硬性要求) max_execution_time = 300 memory_limit = 128M post_max_size = 16M upload_max_filesize = 2M max_input_time = 300 date.timezone = PRC
修改php-fpm.conf pid = run/php-fpm.pid error_log = log/php-fpm.log log_level = notice
步骤3: 安装nginx
yum -y install pcre-devel
yum -y install openssl-devel
tar -zxvf nginx-1.10.1.tar.gz && cd nginx-1.10.1
./configure --prefix=/local/server/nginx --with-pcre --with-http_ssl_module --with-http_stub_status_module
make && make install
步骤4: 安装zabbix_server
groupadd zabbix
useradd zabbix -g zabbix -s /sbin/nologin
tar -zxvf zabbix-3.4.8.tar.gz && cd zabbix-3.4.8
./configure --prefix=/local/server/zabbix --enable-server --enable-agent --with-net-snmp --with-proxy --with-libcurl --with-libxml2 --with-mysql
报错:
configure: error: no acceptable C compiler found in $PATH
解决:
yum -y install gcc-c++
报错:
configure: error: MySQL library not found
解决:
yum -y install mysql-community-devel
报错:
configure: error: LIBXML2 library not found
解决:
yum -y install libxml2-devel
报错:
configure: error: Invalid Net-SNMP directory - unable to find net-snmp-config
解决:
yum -y install net-snmp-devel
报错:
configure: error: Unable to use libevent (libevent check failed)
解决:
yum -y install libevent-devel
报错:
configure: error: Curl library not found
解决:
yum -y install curl-devel
make && make install
cp -a /local/software/zabbix-3.4.8/misc/init.d/fedora/core/* /etc/init.d/
vim /etc/init.d/zabbix_server.sh
修改:
BASEDIR=/local/server/zabbix
vim /local/server/zabbix/etc/zabbix_server.conf
修改:
DBHost=172.16.100.64
DBName=zabbix
DBUser=zabbix
DBPassword=zhcwadmin
DBPort=3306
AlertScriptsPath=/local/server/zabbix/share/zabbix/alertscripts
/etc/init.d/zabbix_agent start | stop | restart
备注(zabbix客户端的安装)
1.添加组和用户
groupadd zabbix
useradd zabbix -g zabbix -s /sbin/nologin
2.编译
tar -zxvf zabbix-3.4.8.tar.gz && cd zabbix-3.4.8
./configure --prefix=/local/server/zabbix --enable-agent
3.安装
make && make install
4.复制重启脚本
cp -a /local/software/zabbix-3.4.8/misc/init.d/fedora/core/zabbix_agent /etc/init.d/zabbix_agent
5.修改配置
vim /local/server/zabbix/etc/zabbix_agentd.conf
Hostname=本机内网ip
ServerActive=172.16.100.94
Server=172.16.100.94
6.启动、停止、重启
/etc/init.d/zabbix_agent start | stop | restart
以上是关于Zabbix-CentOS7下zabbix的安装与配置的主要内容,如果未能解决你的问题,请参考以下文章
RedHat 7.1 下安装 Zabbix监控程序详解(适合linux初级用户)
Centos 7.0 下安装 Zabbix server 服务器的安装及 监控主机的加入