zabbix3.2.6的安装

Linux下常用的系统监控软件有NagiosCactiZabbixMonit等,这些开源的软件,可以帮助我们更好的管理机器,在第一时间内发现,并警告系统维护人员,告警方式多样化(包括邮件,短信,qq,企业微信,电话等。)

 首先,我们先来介绍下Zabblx

.Zabbix简介   

       zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。

       zabbixzabbix server与可选组件zabbix agent两大部分组成。

       zabbix agent需要安装在被监视的目标服务器上,它主要完成对硬件信息或与操作系统有关的内存,CPU等信息的收集。

Zabbix主要功能:

          CPU负荷, 内存使用,磁盘使用网络状况, 端口监视, 日志监视,发出告警等。

官方也提供了安装资料:https://www.zabbix.com/documentation/3.2/manual/

准备工作:

1,准备lamp或者lnmp环境,以及时间的同步。

2,主机名,ip 写进hosts记录

3,防火墙开启10050.10051.80端口

4,关闭selinux

5,安装好gcc(yum -y install gcc*)

一、安装php

#rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm

#yum install php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap

修改配置文件

#vim /etc/php.ini

 375 max_execution_time = 300

 385 max_input_time = 300

 663 post_max_size = 32M

 705 always_populate_raw_post_data = -1

 889 date.timezone = Asia/Shanghai

安装后需要检测提前修改属性

二、安装MySQL

MySQL建议使用5.6版本,CentOs6默认为5.1,不建议使用,性能偏低

#rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm

#yum install -y mysql-server mysql-devel

修改配置文件

#vim /etc/my.cnf

[mysqld]

innodb_file_per_table    --------独立表空间

# service mysqld start

#mysql_secure_installation       -------MySQL安全配置向导

Enter current password for root (enter for none):       ----初次运行直接回车

OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL

root user without the proper authorisation.

Set root password? [Y/n]               ------是否设置root密码,输入y回车或直接回车

New password:                      ------设置密码zabbix

Re-enter new password:              ------确认密码zabbix

Password updated successfully!

Reloading privilege tables..

 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone

to log into MySQL without having to have a user account created for

them.  This is intended only for testing, and to make the installation

go a bit smoother.  You should remove them before moving into a

production environment.

Remove anonymous users? [Y/n]     -------是否删除匿名用户,生产环境建议删除,直接回车

 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This

ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]   ------是否禁止root远程登录,根据自己的需求选择

 ... Success!

By default, MySQL comes with a database named 'test' that anyone can

access.  This is also intended only for testing, and should be removed

before moving into a production environment.

Remove test database and access to it? [Y/n]   -----是否删除test数据库,直接回车

 - Dropping test database...

ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist

 ... Failed!  Not critical, keep moving...

 - Removing privileges on test database...

 ... Success!

Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.

Reload privilege tables now? [Y/n]  -----是否重新加载授权表,直接回车

 ... Success!

All done!  If you've completed all of the above steps, your MySQL

installation should now be secure.

Thanks for using MySQL!

Cleaning up...

登录MySQL用户

#mysql -uroot -pzabbix

mysql> create database zabbix character set utf8 collate utf8_bin;

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';

mysql> flush privileges;

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| zabbix             |

+--------------------+

4 rows in set (0.00 sec)

mysql> quit

Bye

三、安装Zabbix

#yum install httpd  libxml2 libxml2-devel net-snmp-devel libcurl-devel

创建zabbix用户和组

#groupadd  -g 201  zabbix

#useradd  -g zabbix  -u 201 -m zabbix

下载zabbix-3.2.6安装包

#wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.6/zabbix-3.2.6.tar.gz

#tar zxvf zabbix-3.2.6.tar.gz -C /usr/src/

#cd /usr/src/zabbix-3.2.6/

#/usr/bin/mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql

#/usr/bin/mysql -uzabbix -pzabbix zabbix < database/mysql/images.sql

#/usr/bin/mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql

#./configure --prefix=/usr/local/zabbix --sysconfdir=/etc/zabbix/ --enable-server --enable-agent --with-net-snmp --with-libcurl --with-mysql --with-libxml2

#make &&make install

修改zabbix_server配置

#vim /etc/zabbix/zabbix_server.conf

77 DBHost=localhost

88 DBName=zabbix

103 DBUser=zabbix

111 DBPassword=zabbix

299 ListenIP=127.0.0.1,192.168.0.103      -----zabbix server ip地址

#ln -s /usr/local/zabbix/sbin/* /usr/sbin/

#cp misc/init.d/fedora/core/zabbix_* /etc/init.d/

#chmod +x /etc/init.d/zabbix_*

#sed -i "s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g" /etc/init.d/zabbix_server    ----写入系统服务

配置WEB

chown -R zabbix.zabbix /usr/local/zabbix

#vim /etc/httpd/conf/httpd.conf

ServerName 127.0.0.1

ServerName 192.168.0.103

DocumentRoot "/var/www/html"

#mkdir -p /var/www/html/zabbix

#cp -r frontends/php/* /var/www/html/zabbix

#chown -R apache.apache /var/www/html/zabbix/

#/etc/init.d/httpd restart

#chkconfig zabbix_server on

#/etc/init.d/zabbix_server start

用浏览器访问http://192.168.0.103/zabbix,并按照提示安装:

 zabbix3.2.6的安装_第1张图片

zabbix3.2.6的安装_第2张图片

zabbix3.2.6的安装_第3张图片

zabbix3.2.6的安装_第4张图片

zabbix3.2.6的安装_第5张图片

zabbix3.2.6的安装_第6张图片

Zabbix用户默认是:Admin,密码:zabbix

 zabbix3.2.6的安装_第7张图片

配置zabbix客户端

Linux服务器客户端的安装

下载zabbix安装包,可以直接使用服务端包

#wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.6/zabbix-3.2.6.tar.gz

#groupadd  -g 201  zabbix

#useradd  -g zabbix  -u 201 -m zabbix

#tar zxvf zabbix-3.2.6.tar.gz -C /usr/src/

#cd /usr/src/zabbix-3.2.6/

#./configure --prefix=/usr/local/zabbix-agent --enable-agent

#make &&make install

#ln -s /usr/local/zabbix-agent/sbin/ /usr/sbin/

#cp misc/init.d/fedora/core/zabbix_agentd  /etc/init.d/

#chmod +x /etc/init.d/zabbix_*

#sed -i "s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix@g" /etc/init.d/zabbix_agentd

#/etc/init.d/zabbix_agentd restart

#chkconfig zabbix-agent on

你可能感兴趣的:(zabbix)