Zabbix 监控部署
环境参数:
192.168.88.67 rhel7 部署Zabbix Server
192.168.88.68 rhel7 部署Zabbix Agent
1.配置好yum源(一键脚本)
[root@Zabbix_Server yum.repos.d]# cat yum.sh
#!bin/bash #authir:peng #date:2022.11.2 yum clean all 1> /dev/null 2>&1 && yum makecache &> /dev/null if [ $? -ne 0 ];then cd /etc/yum.repos.d cat >local.repo<<EOF [local] name=local baseurl=file:///mnt enabled=1 gpgcheck=0 EOF mount /dev/cdrom /mnt &>/dev/null sed -i -e '/iso9660/d' /etc/fstab echo "/dev/cdrom /mnt iso9660 defaults 0 0" >> /etc/fstab yum clean all &>/dev/null && yum makecache &>/dev/null fi fpath="/etc/yum.repos.d/aliyun.repo" if [ -e $fpath ]; then echo "阿里源已经存在"; else touch /etc/yum.repos.d/aliyun.repo cat >/etc/yum.repos.d/aliyun.repo <<EOF [aliyun-os] name=aliyun-os baseurl=https://mirrors.aliyun.com/centos/7/os/x86_64/ enabled=1 gpgcheck=0 [aliyun-epel] name=aliyun-epel baseurl=https://mirrors.aliyun.com/epel/7/x86_64/ enabled=1 gpgcheck=0 [aliyun-extra] name=aliyun-extra baseurl=https://mirrors.aliyun.com/centos/7/extras/x86_64/ enabled=1 gpgcheck=0 EOF yum clean all && yum makecache echo "阿里源安装完毕"; fi
2.修改各自的主机名
#hostnamectl set-hostname Zabbix_Server && bash #hostnamectl set-hostname Zabbix_Agent && bash
3.校正时间
两台机器都需要,如果时间准确可以省略 #cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
4.在Zabbix_Server端搭建LNMP架构
(1)上传关于LNMP的源码包
[root@zabbix_server src]# rz 总用量 87232 -rw-r--r-- 1 root root 89323321 10月 14 15:05 LNMP.zip [root@zabbix_server src]#unzip LNMP.zip [root@zabbix_server src]# ls cmake-2.8.11.2.tar.gz jpegsrc.v9a.tar.gz libpng-1.6.12.tar.gz mysql-5.6.19.tar.gz pcre-8.35.tar.gz tiff-4.0.3.tar.gz Discuz_X3.2_SC_GBK.zip libgd-2.1.0.tar.gz libvpx-v1.3.0.tar.bz2 nginx-1.6.0.tar.gz php-5.5.14.tar.gz yasm-1.2.0.tar.gz freetype-2.5.3.tar.gz libmcrypt-2.5.8.tar.gz LNMP.zip openssl-1.0.1h.tar.gz t1lib-5.1.2.tar.gz zlib-1.2.8.tar.gz
(2)安装软件包(确保yum源的充足)
[root@zabbix_server src]# yum install -y apr* autoconf automake bison bzip2 bzip2* compat* cpp curl curl-devel fontconfig fontconfig-devel freetype freetype* freetype-devel gcc* gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng libpng-devel libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool* libgomp libxml2 libxml2-devel libXpm* libtiff libtiff* make mpfr ncurses* ntp openssl openssl-devel patch pcre pcre-devel perl php-common php-gd policycoreutils telnet t1lib t1lib* nasm nasm* wget zlib zlib-devel 在安装过程中通过阿里源下载安装可能会出现报错,需要暂时把阿里源关闭,利用本地源下载即可以 [root@zabbix_server src]#cd /etc/yum.repos.d/ [root@zabbix_server yum.repos.d]#mv aliyun.repo aliyun.repo.bak 再重新执行安装命令就可以了
(3)安装CMake编译工具
[root@zabbix_server yum.repos.d]# cd /usr/local/src/ [root@Zabbix_Server src]# tar xvf cmake-2.8.11.2.tar.gz [root@Zabbix_Server src]# cd cmake-2.8.11.2 [root@Zabbix_Server cmake-2.8.11.2]# ./configure [root@Zabbix_Server cmake-2.8.11.2]# make [root@Zabbix_Server cmake-2.8.11.2]# make install
(4)配置nginx
[root@Zabbix_Server cmake-2.8.11.2]# useradd nginx -s /sbin/nologin #创建一个nginx用户 [root@Zabbix_Server cmake-2.8.11.2]# cd /usr/local/src [root@Zabbix_Server src]# tar xvf nginx-1.6.0.tar.gz [root@Zabbix_Server src]# cd nginx-1.6.0 [root@Zabbix_Server nginx-1.6.0]# ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_sub_module --with-http_ssl_module --with-pcre [root@Zabbix_Server nginx-1.6.0]# make && make install [root@Zabbix_Server nginx-1.6.0]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf #启动nginx [root@zabbix_server nginx-1.6.0]# netstat -pantul |grep 80 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 14870/nginx: master
(5)配置mysql数据库
[root@Zabbix_Server nginx-1.6.0]#cd /usr/local/src [root@Zabbix_Server src]# useradd mysql -s /sbin/nologin #创建一个mysql用户 [root@Zabbix_Server src]# mkdir -p /usr/local/mysql/var #创建数据库服务程序和真实数据的目录 [root@Zabbix_Server src]# chown -Rf mysql:mysql /usr/local/mysql #修改该目录的所有者和所属组身份修改为mysql [root@Zabbix_Server src]# tar xvf mysql-5.6.19.tar.gz [root@Zabbix_Server src]# cd mysql-5.6.19 [root@Zabbix_Server mysql-5.6.19]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/var -DSYSCONFDIR=/etc -DCMAKE_INSTALL_PREFIX 参数用于定义数据库服务程序的保存目录,-DMYSQL_DATADIR 参数用于定义真实数据库文件的目录,-DSYSCONFDIR 则是定义 MySQL 数据库配置文件的保存目录 [root@Zabbix_Server mysql-5.6.19]# make && make install [root@Zabbix_Server mysql-5.6.19]# rm -rf /etc/my.cnf #删除旧得配置文件 [root@Zabbix_Server mysql-5.6.19]# cd /usr/local/mysql [root@Zabbix_Server mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var #生成系统数据库文件 生成出新的 MySQL 服务配置文件 [root@Zabbix_Server mysql]# ln -s my.cnf /etc/my.cnf [root@Zabbix_Server mysql]# cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld #复制开机程序文件 [root@Zabbix_Server mysql]# chmod 755 /etc/rc.d/init.d/mysqld [root@zabbix_server mysql]# vim /etc/rc.d/init.d/mysqld 46 basedir=/usr/local/mysql 47 datadir=/usr/local/mysql/var [root@Zabbix_Server mysql]# service mysqld start Unit mysqld.service could not be found. Starting MySQL. SUCCESS! [root@Zabbix_Server mysql]# chkconfig mysqld on #加入到开机启动项中 [root@Zabbix_Server mysql]# vim /etc/profile 74 export PATH=$PATH:/usr/local/mysql/bin [root@Zabbix_Server mysql]# source /etc/profile [root@Zabbix_Server mysql]# mkdir /var/lib/mysql #手动方式链接一些程序文件和函数库文件 [root@Zabbix_Server mysql]# ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql [root@Zabbix_Server mysql]# ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock [root@Zabbix_Server mysql]# ln -s /usr/local/mysql/include/mysql /usr/include/mysql [root@zabbix_server include]# mysql_secure_installation #数据库初始化 [root@zabbix_server include]# mysql -uroot -p #尝试登录数据库 mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | +--------------------+ 3 rows in set (0.01 sec)
(6) 配置PHP
解决PHP的程序包和其他软件的依赖关系,安装依赖包
1.yasm源码包 [root@Zabbix_Server ~]# cd /usr/local/src [root@Zabbix_Server src]# tar xvf yasm-1.2.0.tar.gz [root@Zabbix_Server src]# cd yasm-1.2.0 [root@Zabbix_Server yasm-1.2.0]# ./configure [root@Zabbix_Server yasm-1.2.0]# make && make install 2.libmcrypt源码包 [root@Zabbix_Server yasm-1.2.0]# cd .. [root@Zabbix_Server src]# tar xvf libmcrypt-2.5.8.tar.gz [root@Zabbix_Server src]# cd libmcrypt-2.5.8 [root@Zabbix_Server libmcrypt-2.5.8]# ./configure [root@Zabbix_Server libmcrypt-2.5.8]# make && make install 3.libvpx源码包 [root@Zabbix_Server libmcrypt-2.5.8]# cd .. [root@Zabbix_Server src]# tar xvf libvpx-v1.3.0.tar.bz2 [root@Zabbix_Server src]# cd libvpx-v1.3.0 [root@Zabbix_Server libvpx-v1.3.0]# ./configure --prefix=/usr/local/libvpx --enable-shared --enable-vp9 [root@Zabbix_Server libvpx-v1.3.0]# make [root@Zabbix_Server libvpx-v1.3.0]# make install 4.tiff源码包 [root@Zabbix_Server libvpx-v1.3.0]# cd .. [root@Zabbix_Server src]# tar xvf tiff-4.0.3.tar.gz [root@Zabbix_Server src]# cd tiff-4.0.3 [root@Zabbix_Server tiff-4.0.3]# ./configure --prefix=/usr/local/tiff --enable-shared [root@Zabbix_Server tiff-4.0.3]# make && make install 5.libpng源码包 [root@Zabbix_Server tiff-4.0.3]# cd .. [root@Zabbix_Server src]# tar xvf libpng-1.6.12.tar.gz [root@Zabbix_Server src]# cd libpng-1.6.12 [root@Zabbix_Server libpng-1.6.12]# ./configure --prefix=/usr/local/libpng --enable-shared [root@Zabbix_Server libpng-1.6.12]# make && make install 6.freetype源码包 [root@Zabbix_Server libpng-1.6.12]# cd .. [root@Zabbix_Server src]# tar xvf freetype-2.5.3.tar.gz [root@Zabbix_Server src]# cd freetype-2.5.3 [root@Zabbix_Server freetype-2.5.3]# ./configure --prefix=/usr/local/freetype --enable-shared [root@Zabbix_Server freetype-2.5.3]# make [root@Zabbix_Server freetype-2.5.3]# make install 7.jpeg源码包 [root@Zabbix_Server freetype-2.5.3]# cd .. [root@Zabbix_Server src]# tar xvf jpegsrc.v9a.tar.gz [root@Zabbix_Server src]# cd jpeg-9a [root@Zabbix_Server jpeg-9a]# ./configure --prefix=/usr/local/jpeg --enable-shared [root@Zabbix_Server jpeg-9a]# make && make install 8.libgd源码包 [root@Zabbix_Server jpeg-9a]# cd .. [root@Zabbix_Server src]# tar xvf libgd-2.1.0.tar.gz [root@Zabbix_Server src]# cd libgd-2.1.0 [root@Zabbix_Server libgd-2.1.0]# ./configure --prefix=/usr/local/libgd --enable-shared --with-jpeg=/usr/local/jpeg --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype --with-fontconfig=/usr/local/freetype --with-xpm=/usr/ --with-tiff=/usr/local/tiff --with-vpx=/usr/local/libvpx [root@Zabbix_Server libgd-2.1.0]# make [root@Zabbix_Server libgd-2.1.0]# make install 9.t1lib源码包 [root@Zabbix_Server libgd-2.1.0]# cd .. [root@Zabbix_Server src]# tar xvf t1lib-5.1.2.tar.gz [root@Zabbix_Server src]# cd t1lib-5.1.2 [root@Zabbix_Server t1lib-5.1.2]# ./configure --prefix=/usr/local/t1lib --enable-shared [root@Zabbix_Server t1lib-5.1.2]# make [root@Zabbix_Server t1lib-5.1.2]# make install [root@Zabbix_Server t1lib-5.1.2]# ln -s /usr/lib64/libltdl.so /usr/lib/libltdl.so [root@Zabbix_Server t1lib-5.1.2]# cp -frp /usr/lib64/libXpm.so* /usr/lib/ [root@Zabbix_Server t1lib-5.1.2]# cd .. [root@Zabbix_Server src]# tar xvf php-5.5.14.tar.gz [root@Zabbix_Server src]# cd php-5.5.14 #定义一个名为LD_LIBRARY_PATH的全局环境变量,该环境变量的作用是帮助系统找到指定的动态链接库文件,这些文件是编译php服务源码包的必须元素之一。 [root@Zabbix_Server php-5.5.14]# export LD_LIBRARY_PATH=/usr/local/libgd/lib #编译php服务源码包时,除了定义要安装到的目录以外,还需要依次定义配置php服务程序配置文件的保存目录、MySQL数据库服务程序所在目录、MySQL数据库服务程序配置文件所在目录,以及libpng、jpeg、freetype、libvpx、zlib、t1lib等服务程序的安装目录路径,并通过参数启动php服务程序的诸多默认功能 [root@Zabbix_Server php-5.5.14]# ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql=/usr/local/mysql --with-gd --with-png-dir=/usr/local/libpng --with-jpeg-dir=/usr/local/jpeg --with-freetype-dir=/usr/local/freetype --with-xpm-dir=/usr/ --with-vpx-dir=/usr/local/libvpx/ --with-zlib-dir=/usr/local/zlib --with-t1lib=/usr/local/t1lib --with-iconv --enable-libxml --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-opcache --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --enable-ctype [root@Zabbix_Server php-5.5.14]# make [root@Zabbix_Server php-5.5.14]# make install [root@Zabbix_Server php-5.5.14]# rm -rf /etc/php.ini #删除默认文件 [root@Zabbix_Server php-5.5.14]# ln -s /usr/local/php/etc/php.ini /etc/php.ini [root@Zabbix_Server php-5.5.14]# cp php.ini-production /usr/local/php/etc/php.ini [root@Zabbix_Server php-5.5.14]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf [root@Zabbix_Server php-5.5.14]# ln -s /usr/local/php/etc/php-fpm.conf /etc/php-fpm.conf [root@Zabbix_Server php-5.5.14]# vim /usr/local/php/etc/php-fpm.conf 25 pid = run/php-fpm.pid 148 user = nginx 149 group = nginx [root@Zabbix_Server php-5.5.14]# cp /usr/local/src/php-5.5.14/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm [root@Zabbix_Server php-5.5.14]# chmod 755 /etc/rc.d/init.d/php-fpm [root@Zabbix_Server php-5.5.14]# chkconfig php-fpm on #增加开机自启 [root@Zabbix_Server php-5.5.14]# vim /usr/local/php/etc/php.ini #关闭一些影响安全得功能 305 disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_ status,ini_alter,ini_alter,ini_restor e,dl,openlog,syslog,readlink,symlink,popepassthru,stream_soc ket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,g etservbyname,getservby port,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid, posix_getgid,po six_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_get pgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_ getpwuid,posix_getrlimit,posix_getsid,posix_ getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_ setpgi d,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname [root@zabbix_server php-5.5.14]# vim /usr/local/nginx/conf/nginx.conf 2 user nginx nginx; 45 index index.html index.htm index.php; 71 location ~ \.php$ { 72 root html; 73 fastcgi_pass 127.0.0.1:9000; 74 fastcgi_index index.php; 75 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 76 include fastcgi_params; 77 } [root@Zabbix_Server php-5.5.14]# systemctl restart php-fpm [root@Zabbix_Server php-5.5.14]# /usr/local/nginx/sbin/nginx -s reload [root@Zabbix_Server php-5.5.14]#cd /usr/local/nginx/html [root@zabbix_server html]# vim index.php <?php phpinfo(); ?> 在浏览器输入:192.168.88.67/index.php
LNMP架构搭建成功!!!!!
5.部署Zabbix_Server
(1)创建Zabbix数据库
[root@zabbix_server html]# mysql -uroot -p mysql> create database zabbix character set utf8; Query OK, 1 row affected (0.00 sec) mysql> grant all on zabbix.* to zabbix@Zabbix_Server identified by 'zabbix'; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> exit Bye
(2)上传zabbix源码包并且导入数据库
[root@Zabbix_Server ~]# cd /usr/local/src/ [root@Zabbix_Server src]# rz [root@Zabbix_Server src]# ls | grep zabbix zabbix-3.4.3.tar.gz [root@Zabbix_Server src]# tar xvf zabbix-3.4.3.tar.gz [root@Zabbix_Server src]# cd zabbix-3.4.3 [root@Zabbix_Server zabbix-3.4.3]# mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql [root@Zabbix_Server zabbix-3.4.3]# mysql -uzabbix -pzabbix zabbix < database/mysql/images.sql [root@Zabbix_Server zabbix-3.4.3]# mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql [root@Zabbix_Server zabbix-3.4.3]# groupadd zabbix [root@Zabbix_Server zabbix-3.4.3]# useradd -s /sbin/nologin -g zabbix zabbix #创建zabbix用户 [root@Zabbix_Server zabbix-3.4.3]# yum install -y mysql-devel net-snmp-devel libevent libevent-devel
(3)安装libevent-devel 并且预编译安装zabbix
[root@zabbix_server zabbix-3.4.3]# rz [root@zabbix_server zabbix-3.4.3]# rpm -ivh libevent-devel-2.0.21-4.el7.x86_64.rpm 警告:libevent-devel-2.0.21-4.el7.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY 准备中... ################################# [100%] 软件包 libevent-devel-2.0.21-4.el7.x86_64 已经安装 [root@zabbix_server zabbix-3.4.3]#./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl [root@Zabbix_Server zabbix-3.4.3]# make install
(4)修改配置文件
[root@zabbix_server zabbix-3.4.3]# vim /usr/local/zabbix/etc/zabbix_server.conf DBHost=zabbix_server DBName=zabbix DBUser=zabbix DBPassword=zabbix 把本身作为监控对象 [root@Zabbix_Server zabbix-3.4.3]# vim /usr/local/zabbix/etc/zabbix_agentd.conf Server=127.0.0.1 ServerActive=127.0.0.1 Hostname=zabbix_server UnsafeUserParameters=1 [root@Zabbix_Server zabbix-3.4.3]# /usr/local/zabbix/sbin/zabbix_server #启动zabbix [root@Zabbix_Server zabbix-3.4.3]# netstat -pantu | grep zabbix tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 37025/zabbix_server 可以通过自定义脚本来实现zabbix开机自启 [root@Zabbix_Server zabbix-3.4.3]# cd /usr/local/src/zabbix-3.4.3/misc/init.d [root@Zabbix_Server init.d]# cp fedora/core/* /etc/rc.d/init.d [root@Zabbix_Server init.d]# vim /etc/init.d/zabbix_server BASEDIR=/usr/local/zabbix # 找到此行,并修改 [root@Zabbix_Server init.d]# vim /etc/init.d/zabbix_agentd BASEDIR=/usr/local/zabbix # 找到此行,并修改 [root@Zabbix_Server init.d]# /etc/init.d/zabbix_server start Starting zabbix_server (via systemctl): [ OK ] [root@Zabbix_Server init.d]# /etc/init.d/zabbix_agentd start Starting zabbix_agentd (via systemctl): [ OK ] [root@Zabbix_Server init.d]# netstat -pantu | grep zabbix tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 37191/zabbix_agentd tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 37025/zabbix_server [root@Zabbix_Server init.d]# chkconfig zabbix_server on [root@Zabbix_Server init.d]# chkconfig zabbix_agentd on [root@Zabbix_Server init.d]# rm -rf /usr/local/nginx/html/*.html #编辑 php 页面控制文件 [root@Zabbix_Server init.d]# cp -r /usr/local/src/zabbix-3.4.3/frontends/php/* /usr/local/nginx/html
(5)重新加载配置,在网页安装zabbix
[root@Zabbix_Server init.d]# /usr/local/nginx/sbin/nginx -s reload [root@Zabbix_Server init.d]# /etc/init.d/php-fpm restart [root@Zabbix_Server init.d]# /etc/init.d/zabbix_server restart 在浏览器打开对应的ip进行安装
(6)有参数不符合要求,修改php参数
[root@Zabbix_Server ~]# vim /usr/local/php/etc/php.ini post_max_size = 16M # 修改 max_execution_time = 300 # 修改 max_input_time = 300 # 修改 date.timezone = Asia/Shanghai # 此行有注释,取消注释并修改 always_populate_raw_post_data = -1 # 此行有注释,取消注释并修改 [root@Zabbix_Server ~]# cd /usr/local/src/php-5.5.14/ext/ldap/ [root@Zabbix_Server ldap]# /usr/local/php/bin/phpize [root@Zabbix_Server ldap]# yum install openldap-devel openldap -y [root@Zabbix_Server ldap]# rsync -avz /usr/lib64/libldap* /usr/lib/ [root@Zabbix_Server ldap]# ./configure --with-php-config=/usr/local/php/bin/php-config --with-ldap [root@Zabbix_Server ldap]# make && make install [root@Zabbix_Server ldap]# vim /usr/local/php/etc/php.ini # 添加:extension=ldap.so [root@Zabbix_Server ldap]# /etc/init.d/php-fpm restart
安装过程中可能提示缺少一个php文件
缺少一个php文件 rz上传就可以了 [root@Zabbix_Server ldap]# cd /usr/local/nginx/html/conf [root@Zabbix_Server conf]# rz rz waiting to receive. zmodem trl+C ȡ 100% 415 bytes 415 bytes/s 00:00:01 0 Errors [root@Zabbix_Server conf]# ls maintenance.inc.php zabbix.conf.php zabbix.conf.php.example # 上传的文件为 zabbix.conf.php 刷新页面,如果显示成功安装 Zabbix,点击 Finish,完成安装! Username: admin Password: zabbix
(5)中文乱码问题
[root@Zabbix_Server conf]# cd /usr/local/nginx/html/fonts/ [root@Zabbix_Server fonts]# ls DejaVuSans.ttf [root@Zabbix_Server fonts]# rz rz waiting to receive. zmodem trl+C ȡ 100% 17787 KB 17787 KB/s 00:00:01 0 Errors [root@Zabbix_Server fonts]# ls DejaVuSans.ttf simsun.ttc [root@Zabbix_Server fonts]# mv DejaVuSans.ttf DejaVuSans.ttf.bak [root@Zabbix_Server fonts]# mv simsun.ttc DejaVuSans.ttf [root@Zabbix_Server fonts]# ls DejaVuSans.ttf DejaVuSans.ttf.bak
5.在Zabbix_Agent端配置远程主机
(1)源码安装源码安装 Zabbix_Agent
[root@Zabbix_Agent ~]# yum install -y curl curl-devel net-snmp net-snmp-devel perl-DBI gcc* [root@Zabbix_Agent ~]# useradd -M -s /sbin/nologin zabbix [root@Zabbix_Agent ~]# cd /usr/local/src [root@Zabbix_Agent src]# rz [root@Zabbix_Agent src]# tar xvf zabbix-3.4.3.tar.gz [root@Zabbix_Agent src]# cd zabbix-3.4.3 [root@Zabbix_Agent zabbix-3.4.3]# ./configure --prefix=/usr/local/zabbix --enable-agent [root@Zabbix_Agent zabbix-3.4.3]# make install [root@Zabbix_Agent zabbix-3.4.3]# /usr/local/zabbix/sbin/zabbix_agentd
(2)修改系统启动脚本来启动agent
[root@Zabbix_Agent zabbix-3.4.3]# cp /usr/local/src/zabbix-3.4.3/misc/init.d/fedora/core5/zabbix_agentd /etc/init.d/ [root@Zabbix_Agent zabbix-3.4.3]# vim /etc/init.d/zabbix_agentd ZABBIX_BIN="/usr/local/zabbix/sbin/zabbix_agentd" # 修改此行 [root@Zabbix_Agent zabbix-3.4.3]# chkconfig --add zabbix_agentd [root@Zabbix_Agent zabbix-3.4.3]# chkconfig zabbix_agentd on
(3)修改配置文件
[root@Zabbix_Agent zabbix-3.4.3]# vim /usr/local/zabbix/etc/zabbix_agentd.conf Server=192.168.88.67 ServerActive=192.168.88.67 Hostname=Zabbix_Agent UnsafeUserParameters=1 [root@Zabbix_Agent zabbix-3.4.3]# /etc/init.d/zabbix_agentd restart #重启
然后到服务端添加对应的主机以及选定linux模板,等待几分钟,就可以看到新的主机成功加入。