标签:功能 文件 编译 col org copy zabbix代理 lis serve
zabbix介绍 **zabbix主要功能:**
CPU负荷
内存使用
磁盘使用
网络状况
端口监视
日志监视
zabbix配置文件
zabbix配置文件有两种:
服务器端配置文件(/usr/local/etc/zabbix_server.conf)
客户端配置文件(/usr/local/etc/zabbix_server.conf)
zabbix代理配置文件(/usr/local/etc/zabbix_proxy.conf)
部署zabbix
环境 | IP | 要安装的应用 |
---|---|---|
服务器 | 192.168.47.12 | lamp架构,zabbix server,zabbix agent |
客户端 | 192.168.47.11 | zabbix agent |
因为zabbix是用php语言开发的,所以必须先部署lamp架构,使其能够支持运行php网页
zabbix服务端安装
//安装依赖包
[root@yanyinglai3 ~]# yum -y install net-snmp-devel libevent-devel
已加载插件:fastestmirror
[root@yanyinglai3 ~]# cd /usr/src/
[root@yanyinglai3 src]# wget https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.12/zabbix-3.4.12.tar.gz
//解压
[root@yanyinglai3 src]# tar xf zabbix-3.4.12.tar.gz
//创建zabbix用户与组
[root@yanyinglai3 src]# groupadd -r zabbix
[root@yanyinglai3 src]# useradd -r -g zabbix -M -s /sbin/nologin zabbix
//配置zabbix数据库
[root@yanyinglai3 src]# 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 identified by ‘zabbix123!‘;
Query OK, 0 rows affected, 2 warnings (0.09 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.11 sec)
mysql> quit
[root@yanyinglai3 src]# cd /usr/src/zabbix-3.4.12/database/mysql/
[root@yanyinglai3 mysql]# ls
data.sql images.sql schema.sql
[root@yanyinglai3 mysql]# mysql -uzabbix -pzabbix123! zabbix < schema.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@yanyinglai3 mysql]# mysql -uzabbix -pzabbix123! zabbix < images.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
[root@yanyinglai3 mysql]# mysql -uzabbix -pzabbix123! zabbix < data.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
//编译安装zabbix
[root@yanyinglai3 mysql]# cd /usr/src/zabbix-3.4.12
[root@yanyinglai3 zabbix-3.4.12]# ./configure --enable-server > --enable-agent > --with-mysql > --with-net-snmp > --with-libcurl > --with-libxml2
[root@yanyinglai3 zabbix-3.4.12]#make install
//zabbix服务端配置
[root@yanyinglai3 ~]# ls /usr/local/etc/
zabbix_agentd.conf zabbix_server.conf
zabbix_agentd.conf.d zabbix_server.conf.d
//修改服务端配置文件
//设置数据库信息
[root@yanyinglai3 ~]# vim /usr/local/etc/zabbix_server.conf
DBPassword=zabbix123! //设置zabbix数据库连接密码
//启动zabbix_server和zabbix_agentd
[root@yanyinglai3 ~]# zabbix_server
[root@yanyinglai3 ~]# zabbix_agentd
[root@yanyinglai3 ~]# 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
[root@yanyinglai3 ~]# sed -ri ‘s/(post_max_size =).*/\1 16M/g‘ /etc/php.ini
[root@yanyinglai3 ~]# sed -ri ‘s/(max_execution_time =).*/\1 300/g‘ /etc/php.ini
[root@yanyinglai3 ~]# sed -ri ‘s/(max_input_time =).*/\1 300/g‘ /etc/php.ini
[root@yanyinglai3 ~]# sed -i ‘/;date.timezone/a date.timezone = Asia/Shanghai‘ /etc/php.ini
[root@yanyinglai3 ~]# service php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm done
[root@yanyinglai3 ~]# cd /usr/src/zabbix-3.4.12
[root@yanyinglai3 zabbix-3.4.12]# ls
aclocal.m4 conf configure.ac INSTALL man src
AUTHORS config.guess COPYING install-sh misc upgrades
bin config.log database m4 missing
build config.status depcomp Makefile NEWS
ChangeLog config.sub frontends Makefile.am README
compile configure include Makefile.in sass
[root@yanyinglai3 zabbix-3.4.12]# mkdir /usr/local/apache/htdocs/zabbix
[root@yanyinglai3 zabbix-3.4.12]# cp -a frontends/php/* /usr/local/apache/htdocs/zabbix/
[root@yanyinglai3 zabbix-3.4.12]# chown -R apache.apache /usr/local/apache/htdocs
//配置apache虚拟主机
在配置文件末尾添加如下内容:
[root@yanyinglai3 ~]# vim /etc/httpd24/httpd.conf
</IfModule>
<VirtualHost 192.168.47.12:80>
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
<Directory "/usr/local/apache/htdocs/zabbix">
Options none
AllowOverride none
Require all granted
</Directory>
</VirtualHost>
设置zabbix/conf目录的权限,让zabbix有权生成配置文件zabbix.conf.php
[root@yanyinglai3 ~]# chmod 777 /usr/local/apache/htdocs/zabbix/conf
[root@yanyinglai3 ~]# ll -d /usr/local/apache/htdocs/zabbix/conf
drwxrwxrwx. 2 apache apache 81 7月 30 19:41 /usr/local/apache/htdocs/zabbix/conf
重启apache
[root@yanyinglai3 ~]# apachectl -t
Syntax OK
[root@yanyinglai3 ~]# apachectl stop
[root@yanyinglai3 ~]# apachectl start
[root@yanyinglai3 ~]# 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权限
[root@yanyinglai3 ~]# chmod 755 /usr/local/apache/htdocs/zabbix/conf
[root@yanyinglai3 ~]# 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映射
在浏览器上访问域名
标签:功能 文件 编译 col org copy zabbix代理 lis serve
原文地址:http://blog.51cto.com/13910274/2163032