监控服务zabbix部署(server端)
zabbix服务端安装 //安装依赖包# yum -y install net-snmp-devel libevent-devel
已加载插件:fastestmirror
#cd /usr/src/
# wget https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.12/zabbix-3.4.12.tar.gz
//解压
# tar xf zabbix-3.4.12.tar.gz
//创建zabbix用户与组
#groupadd -r zabbix
#useradd -r -g zabbix -M -s /sbin/nologin zabbix
//配置zabbix数据库
# mysql -uroot -p
Enter password:
mysql> create database zabbix character set utf8 collate utf8_bin;
Query OK, 1 row affected (0.05 sec)
mysql>grant all privileges on zabbix.* to zabbix@localhost> Query OK, 0 rows affected, 2 warnings (0.09 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.11 sec)
mysql> quit
#cd /usr/src/zabbix-3.4.12/database/mysql/
# ls
data.sqlimages.sqlschema.sql
#mysql -uzabbix -pzabbix123! zabbix < schema.sql
mysql: Using a password on the command line interface can be insecure.
#mysql -uzabbix -pzabbix123! zabbix < images.sql
mysql: Using a password on the command line interface can be insecure.
#mysql -uzabbix -pzabbix123! zabbix < data.sql
mysql: Using a password on the command line interface can be insecure.
//编译安装zabbix
# cd /usr/src/zabbix-3.4.12
# ./configure --enable-server \
> --enable-agent \
> --with-mysql \
> --with-net-snmp \
> --with-libcurl \
> --with-libxml2
#make install
//zabbix服务端配置
# ls /usr/local/etc/
zabbix_agentd.conf zabbix_server.conf
zabbix_agentd.conf.dzabbix_server.conf.d
//修改服务端配置文件
//设置数据库信息
# vim /usr/local/etc/zabbix_server.conf
DBPassword=zabbix123! //设置zabbix数据库连接密码
//启动zabbix_server和zabbix_agentd
# zabbix_server
#zabbix_agentd
# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 *:10050 *:*
LISTEN 0 128 *:10051 *:*
LISTEN 0 128 127.0.0.1:9000 *:*
LISTEN 0 128 :::80 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 80 :::3306 :::*
//zabbix web 界面安装前配置
//修改/etc/php.ini的配置并重启php-fpm
#sed -ri 's/(post_max_size =).*/\1 16M/g' /etc/php.ini
# sed -ri 's/(max_execution_time =).*/\1 300/g' /etc/php.ini
# sed -ri 's/(max_input_time =).*/\1 300/g' /etc/php.ini
#sed -i '/;date.timezone/a date.timezone = Asia/Shanghai' /etc/php.ini
#service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpmdone
#cd /usr/src/zabbix-3.4.12
# ls
aclocal.m4conf configure.acINSTALL man src
AUTHORS config.guess COPYING install-sh misc upgrades
bin config.log database m4 missing
build config.statusdepcomp Makefile NEWS
ChangeLog config.sub frontends Makefile.amREADME
compile configure include Makefile.insass
#mkdir /usr/local/apache/htdocs/zabbix
#cp -a frontends/php/* /usr/local/apache/htdocs/zabbix/
# chown -R apache.apache /usr/local/apache/htdocs
//配置apache虚拟主机
在配置文件末尾添加如下内容:
# vim /etc/httpd24/httpd.conf
ServerName zabbix.yanyinglai.com
DocumentRoot "/usr/local/apache/htdocs/zabbix"
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache/htdocs/zabbix/$1
Options none
AllowOverride none
Require all granted
设置zabbix/conf目录的权限,让zabbix有权生成配置文件zabbix.conf.php
# chmod 777 /usr/local/apache/htdocs/zabbix/conf
#ll -d /usr/local/apache/htdocs/zabbix/conf
drwxrwxrwx. 2 apache apache 81 7月30 19:41 /usr/local/apache/htdocs/zabbix/conf
重启apache
# apachectl -t
Syntax OK
# apachectl stop
#apachectlstart
# ss -nalt
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 *:22 *:*
LISTEN 0 100 127.0.0.1:25 *:*
LISTEN 0 128 *:10050 *:*
LISTEN 0 128 *:10051 *:*
LISTEN 0 128 127.0.0.1:9000 *:*
LISTEN 0 128 :::80 :::*
LISTEN 0 128 :::22 :::*
LISTEN 0 100 ::1:25 :::*
LISTEN 0 80 :::3306 :::*
安装zabbix web 界面
·恢复zabbix/conf的755权限
# chmod 755 /usr/local/apache/htdocs/zabbix/conf
#ll/usr/local/apache/htdocs/zabbix/conf -d
drwxr-xr-x. 2 apache apache 81 7月30 19:41 /usr/local/apache/htdocs/zabbix/conf
修改/etc/hosts 文件,添加域名与ip映射
在浏览器上访问域名
页:
[1]