Zabbix Server安装
看到那里有错或者有什么问题的话,求指点
邮箱:losbyday@163.com
上一篇PHP源码安装参见基于LNMP的Zabbbix之PHP源码安装:https://i.cnblogs.com/EditPosts.aspx?postid=5828058
关于zabbix详细:http://www.iyunv.com/thread-179791-1-1.html
Begin
#建立一个用于zabbix的用户
useradd zabbix passwd zabbix
#我的密码123看个人
#到官网找到Zabbix Server源码安装包
wget http://120.52.73.49/tenet.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.0.3/zabbix-3.0.3.tar.gz tar -zxvf zabbix-3.0.3.tar.gz cd zabbix-3.0.3 ./configure --prefix=/usr/local/zabbix/ --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --enable-java make && make install
#MySQL导入SQL语句
mysql -uroot -e"create database zabbix character set utf8 collate utf8_bin;" mysql -uroot -e"grant all privileges on zabbix.* to zabbix@'%' identified by 'losnau';" mysql -uroot -e"flush privileges;"
#按照SQL语句顺序导入SQL:
mysql -uzabbix -plosnau zabbix < /usr/local/setup/zabbix-3.0.3/database/mysql/schema.sql mysql -uzabbix -plosnau zabbix < /usr/local/setup/zabbix-3.0.3/database/mysql/images.sql mysql -uzabbix -plosnau zabbix < /usr/local/setup/zabbix-3.0.3/database/mysql/data.sql
#修改/usr/local/zabbix/etc/zabbix_server.conf
DBName=zabbix #数据库名称 DBUser=zabbix #数据库用户名 DBPassword=losnau #数据库密码 ListenIP=192.168.1.5 #数据库ip地址 AlertScriptsPath=${datadir}/zabbix/alertscripts #zabbix运行脚本存放目录
#修改php.ini ------PHP option
post_max_size 16M max_execution_time 300 max_input_time = 300 # zone Asia/Shanghai
#重启php-fpm服务
ps aux |grep php #查看php-fpm是否开启 #如果开启就 ps aux |grep php-fpm |xargs kill -9 # 关闭啦 cp /usr/local/php/sbin/php-fpm /usr/bin #^_^ php-fmp #启动php-fpm服务
#zabbix提供init.d脚本
cp misc/init.d/tru64/zabbix_* /etc/init.d/
chmod +x /etc/init.d/zabbix_*
#将前端文件拷贝到nginx站点目录下
cd /usr/local/setup/zabbix-3.0.3/frontends #进入zabbix解压缩目录 cp -rf php /www #将解压缩的zabbix里面php文件拷贝到nginx的root目录下
#修改Nginx的配置文件
我的nginx.conf如下
user daemon; worker_processes 1; error_log logs/error.log; pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #access_log logs/access.log main; sendfile on; keepalive_timeout 65; server { listen 80; server_name localhost; root /www; location / { index index.html index.htm index.php; } error_page 404 /404.html; # redirect server error pages to the static page /50x.html error_page 500 502 503 504 /50x.html; location = /50x.html { } #解决open() “/usr/local/nginx/html/favicon.ico” failed (2: No such file or directory) location = /favicon.ico { log_not_found off; access_log off; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { fastcgi_pass unix:/tmp/phpfpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location /zabbix { alias /www/zabbix; } } }