一、简介
KVM+虚拟机的基于LNMP平台zabbix3.0的监控系统。能通过企业微信实现服务器状态的告警功能!
二、环境
服务器:DELL 710 32G RIDA 5
系统:Linux 3.10.0-862.el7.x86_64
基于KVM的虚拟机 系统:Linux 3.10.0-862.el7.x86_64
内存:6G
硬盘:80G
三、准备LNMP平台
3.1 yum install nginx -y
配置一台虚拟主机并新建好相应目录及测试页(index.php);
~]# vim /etc/nginx/conf.d/vhost.conf
server {
listen 80;
server_name www.testzabbix.com;
root /Centos/web;
# index index.html index.php index.htm;
location ~ \.php$ {
root /Centos/web;
fastcgi_buffer_size 128k;
fastcgi_buffers 32 32k;
fastcgi_pass 192.168.1.186:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /Centos/web/$fastcgi_script_name;
include fastcgi_params;
}
}
systemctl enable nginx
systemctl start nginx
3.2 yum install mariadb-server
vim /etc/my.cnf.d/server.cnf
[mysqld]
skip_name_resolve = ON
innodb_file_per_table = ON
初始化数据库
zabbix数据库的授权:
create database zabbix;
use zabbix;
grant all on zabbix.* to 'zabuser'@'192.168.1.%' identified by 'tica123';
grant all on zabbix.* to 'zabuser'@'localhost' identified by 'tica123';
systemctl enable mariadb
systemctl start mariadb
3.3 yum install php-fpm php-mysql php-mbstring php-gd php-bcmath php-ldap php-xml -y
cp /usr/share/doc/php-fpm-5.4.16/php-fpm.conf.default /etc/php-fpm.d/www.conf
vim /etc/php-fpm.d/www.conf
listen = 192.168.1.186:9000
listen.allowed_clients = 127.0.0.1,192.168.1.186
user = nginx
group = nginx
pm.status_path = /status
ping.path = /ping
ping.response = pong
新建session会话目录并改nginx的属主及属组
mkdir /var/lib/php/session
setfacl -m u:nginx:rwx session
systemctl start php-fpm
systemctl enable php-fpm
--------------------------------------------------------------------------------------------LNMP平台完成。
测试