zabbix的部署
zabbix版本:3.4.6
php、zabbix等rpm
php-bcmath-5.4.45-13.el7.remi.x86_64.rpm
php-mbstring-5.4.45-13.el7.remi.x86_64.rpm
zabbix.3.4.6.tar.gz
mkdir -p /apps/{srv,package,log,webroot}
cd /etc/yum.repo.d/
mkdir backup
mv ./*.repo backup/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum -y install nginx mariadb*
rpm -ivh /apps/package/php-fpm-7.1.10-2.x86_64.rpm
yum -y install libedit-devel libxml2-devel bzip2-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel gmp-devel libmcrypt libmcrypt-devel readline-devel libxslt-devel ImageMagick-devel cyrus-sasl-devel gcc-c++ automake autoconf ImageMagick libmemcached-devel
rpm -ivh /apps/package/php-fpm-7.1.10-2.x86_64.rpm
rpm -ivh /apps/package/zabbix-server-3.4.6-1.x86_64.rpm
yum -y install unixODBC-devel net-snmp-devel OpenIPMI-devel libevent-devel libssh2-devel openldap-devel
rpm -ivh /apps/package/zabbix-server-3.4.6-1.x86_64.rpm
cp -r /apps/srv/zabbix/php /apps/webroot/zabbix
cp /apps/srv/zabbix/init.d/* /etc/init.d/
mysqladmin -uroot -p password hpf123456
cd /apps/srv/zabbix/mysql
mysql -uroot -phpf123
create database zabbix default charset utf8;
use zabbix;
source schema.sql;
source images.sql;
source data.sql;
show tables;
exit
useradd zabbix
chown -R nobody. /apps/webroot/zabbix
mkdir /apps/log/{zabbix,nginx}
chown -R zabbix. /apps/log/zabbix
vim /etc/nginx/conf.d/zabbix.conf
server {
listen 80;
server_name zabbix.tedu.cn;
root /apps/webroot/zabbix;
index index.php;
access_log /apps/log/nginx/zabbix.access.log main;
error_log /apps/log/nginx/zabbix.error.log;
location ~ .php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_connect_timeout 6000;
fastcgi_send_timeout 6000;
fastcgi_read_timeout 6000;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
vim /apps/srv/php-fpm/etc/php.ini
max_execution_time = 300
max_input_time = 300
nginx -t #停止nginx
nginx #啟動nginx
nginx -s reload #重啟nginx
/etc/init.d/php-fpm start
/etc/init.d/zabbix_server start
vim /etc/hosts
127.0.0.1 zabbix.tedu.cn
訪問 http:// zabbix.tedu.cn
[root@room1pc21 zabbix]# vim /apps/srv/zabbix/etc/zabbix_server.conf
DBUser=root
BPassword=hpf123
[root@room1pc21 zabbix]# /apps/srv/zabbix/sbin/zabbix_server -c /apps/srv/zabbix/etc/zabbix_server.conf
設置監控本機:
#vim /etc/zabbix/zabbix_agentd.conf
30 LogFile=/tmp/zabbix_agentd.log
91 Server=127.0.0.1
132 ServerActive=127.0.0.1:10051
:x
#systemctl status zabbix-agent
#/etc/init.d/zabbix_agentd start###這樣不行的話應該是源碼編譯的時候沒添加agent功能 另外安裝要用上面的方法
zabbix的部署