公司计划使用zabbix监控所有产品服务器,现需要对zabbix进行测试!
创新互联为您提适合企业的网站设计 让您的网站在搜索引擎具有高度排名,让您的网站具备超强的网络竞争力!结合企业自身,进行网站设计及把握,最后结合企业文化和具体宗旨等,才能创作出一份性化解决方案。从网站策划到网站设计、做网站, 我们的网页设计师为您提供的解决方案。系统采用最小化安装,选包如下:
Base Compatibility libraries Debugging Tools Development tools系统信息如下:
# cat /etc/redhat-release CentOS release 6.8 (Final) # uname -r 2.6.32-642.el6.x86_64 # uname -m x86_64公司产品基本是tomcat环境,zabbix server编译安装需要--with-java参数,jdk环境搭建如下:
mkdir /server/tools mkdir /application #download link tar xf jdk-8u131-linux-x64.tar.gz mv jdk1.8.0_131 /application/ ln -s /application/jdk1.8.0_131/ /application/jdk chown -R root.root /application/jdk vim /etc/profile export JAVA_HOME=/application/jdk export JRE_HOME=/application/jdk/jre export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib source /etc/profile基本安装脚本如下:(注:脚本缺少一些判断语句)
#!/bin/bash #修改yum源,采用阿里云源 function mod_yum(){ if [ -e /etc/yum.repos.d/CentOS-Base.repo ] then mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup&&\ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/CentOS-6.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo fi }#mysql采用5.6.36(zabbix3.2.5需要mysql5.4以上版本) function install_mysql(){ useradd -s /sbin/nologin -M mysql wget http://mirrors.sohu.com/mysql/MySQL-5.6/mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz tar xf mysql-5.6.36-linux-glibc2.5-x86_64.tar.gz mv mysql-5.6.36-linux-glibc2.5-x86_64 /application/mysql-5.6.36 ln -s /application/mysql-5.6.36/ /application/mysql chown -R mysql.mysql /application/mysql/ cd /application/mysql/ rm -f /etc/my.cnf cp support-files/my-default.cnf /etc/my.cnf ./scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data/ --user=mysql sed -i 's#/usr/local/mysql#/application/mysql#g' /application/mysql/bin/mysqld_safe /application/mysql/bin/mysqld_safe & echo 'PATH=/application/mysql/bin:$PATH'>> /etc/profile source /etc/profile cd /server/tools/ mysqladmin -uroot password 123456 }#安装apache,版本2.2.32 function install_httpd(){ cd /server/tools useradd -s /sbin/nologin -M www wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.2.32.tar.gz tar xf httpd-2.2.32.tar.gz cd httpd-2.2.32 yum install zlib zlib-devel -y ./configure --prefix=/application/apache2.2.32 --enable-deflate --enable-expires --enable-headers --enable-modules=most --enable-so --with-mpm=worker --enable-rewrite make make install ln -s /application/apache2.2.32/ /application/apache sed -i 's#User daemon#User www#g' /application/apache/conf/httpd.conf sed -i 's#Group daemon#Group www#g' /application/apache/conf/httpd.conf cd /server/tools }#安装php依赖包 function pre_install_php(){ wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz tar xf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/loca/libiconv make make install yum -y install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel yum -y install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel yum -y install libmcrypt-devel yum -y install mhash yum -y install mcrypt yum -y install openssl openssl-devel ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18 ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18 chmod 755 /usr/lib64/libmysqlclient.so.18 chmod 755 /usr/lib/libmysqlclient.so.18 ldconfig }#安装php,版本5.5.32 function install_php(){ cd /server/tools wget http://mirrors.sohu.com/php/php-5.5.32.tar.gz tar xf php-5.5.32.tar.gz cd php-5.5.32 ./configure \ --prefix=/application/php5.5.32 \ --with-mysql=/application/mysql \ --with-mysqli=/application/mysql/bin/mysql_config \ --with-apxs2=/application/apache/bin/apxs \ --with-pdo-mysql=mysqlnd \ --with-iconv-dir=/usr/local/libiconv \ --with-freetype-dir \ --with-jpeg-dir \ --with-png-dir \ --with-zlib \ --with-libxml-dir=/usr \ --enable-xml \ --disable-rpath \ --with-gettext \ --enable-bcmath \ --enable-shmop \ --enable-sysvsem \ --enable-inline-optimization \ --with-curl \ --enable-mbregex \ --enable-fpm \ --enable-mbstring \ --with-mcrypt \ --with-gd \ --enable-gd-native-ttf \ --with-openssl \ --with-mhash \ --enable-pcntl \ --enable-sockets \ --with-xmlrpc \ --enable-soap \ --enable-short-tags \ --enable-static \ --with-xsl \ --with-fpm-user=www \ --with-fpm-group=www \ --enable-ftp \ --enable-opcache=no make make install ln -s /application/php5.5.32 /application/php cp php.ini-production /application/php/lib/php.ini }#修改apache的httpd.conf文件,使apache支持php,采用php模块方式 function after_php(){ sed -i '320i AddType application/x-httpd-php .php .phtml\nAddType application/x-httpd-php-source .phps' /application/apache/conf/httpd.conf sed -i 's#DirectoryIndex index.html#DirectoryIndex index.php index.html#g' /application/apache/conf/httpd.conf sed -i 's/#ServerName www.example.com:80/ServerName *:80/g' /application/apache/conf/httpd.conf /application/apache/bin/apachectl start }#安装zabbix依赖包 #如果不要安装agent,可以去掉--enable-agent #如果不需要监控设备硬件,可以去掉--with-openipmi function pre_install_zabbix_server(){ cd /server/tools wget https://fossies.org/linux/misc/zabbix-3.2.5.tar.gz tar -xf zabbix-3.2.5.tar.gz cd zabbix-3.2.5 yum -y install curl libcurl-devel net-snmp net-snmp-devel perl-DBI libdbi-dbd-mysql mysql-devel gcc gcc++ make libxml2 libxml2-devel yum -y install libssh3-devel.x86_64 yum -y install OpenIPMI yum -y install OpenIPMI-devel useradd -s /sbin/nologin -M zabbix mysql -uroot -p123456 -e "create database zabbix DEFAULT CHARACTER SET UTF8 COLLATE utf8_general_ci;" mysql -uroot -p123456 -e "grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix';" mysql -uroot -p123456 -e "flush privileges;" mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql mysql -uzabbix -pzabbix zabbix < database/mysql/p_w_picpaths.sql mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql }#安装zabbix function install_zabbix(){ ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-java --with-mysql --with-libxml2 --with-net-snmp --with-ssh3 --with-openipmi --with-libcurl make make install cp -R frontends/php /application/apache/htdocs/ chown -R www.www /application/apache/htdocs/php cp -a misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server sed -i 's#/usr/local#/usr/local/zabbix#g' /etc/init.d/zabbix_server mkdir /var/log/zabbix chown -R zabbix.zabbix /var/log/zabbix sed -i 's#LogFile=/tmp/zabbix_server.log#LogFile=/var/log/zabbix/zabbix_server.log#g' sed -i 's/# DBHost=localhost/DBHost=localhost/g' /usr/local/zabbix/etc/zabbix_server.conf sed -i 's/# DBPassword=/DBPassword=zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf /etc/init.d/zabbix_server start sed -i 's#max_execution_time = 30#max_execution_time = 300#g' /application/php/lib/php.ini sed -i 's#max_input_time = 60#max_input_time = 300#g' /application/php/lib/php.ini sed -i 's#post_max_size = 8M#post_max_size = 16M#g' /application/php/lib/php.ini sed -i 's#;date.timezone =#date.timezone = Asia/Shanghai#g' /application/php/lib/php.ini cat >> /application/apache/conf/httpd.conf <另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。