Ubuntu下Zabbix服务器监控工具部署
一 安装
安装Apache、Mysql、Php、zabbix
sudo apt-get update
sudo apt-get install apache2 mysql-server libapache2-mod-php5 php5-gd php5-mysql php5-common zabbix-server-mysql zabbix-frontend-php
二 服务端配置
2.1 配置数据库连接
sudo vim /etc/zabbix/zabbix_server.conf修改相关
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
#非必需,但推荐
StartDiscoverers=5
2.2 创建mysql账号
mysql -u root -p
mysql> create user 'zabbix'@'localhost' identified by 'zabbix';
mysql> create database zabbix;
mysql> grant all privileges on zabbix.* to 'zabbix'@'localhost';
mysql> flush privileges;
mysql> exit;
2.3 导入初始化数据
cd /usr/share/zabbix-server-mysql/
sudo gunzip *.gz
mysql -u zabbix -p zabbix < schema.sql
mysql -u zabbix -p zabbix < images.sql
mysql -u zabbix -p zabbix < data.sql
2.4 修改 PHP 参数
sudo vim /etc/php5/apache2/php.ini修改项:
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = "Asia/Shanghai"
2.5 配置网页
sudo cp /usr/share/doc/zabbix-frontend-php/examples/zabbix.conf.php.example /etc/zabbix/zabbix.conf.php
sudo vim /etc/zabbix/zabbix.conf.php修改项
$DB['DATABASE'] = 'zabbix';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = 'zabbix'2.6 配置apache
sudo cp /usr/share/doc/zabbix-frontend-php/examples/apache.conf /etc/apache2/conf-available/zabbix.conf
sudo a2enconf zabbix.conf
sudo a2enmod alias
sudo service apache2 restart
2.7 配置 zabbix server 启动
sudo vim /etc/default/zabbix-server修改项:
START=yes启动:
sudo service zabbix-server start
2.8 本机监控
sudo apt-get install zabbix-agent
sudo service zabbix-agent restart
2.9 访问
http://xxx.xxx.xxx.xxx/zabbix缺省的账户:
Username = admin
Password = zabbix
三 客户端配置
sudo apt-get install zabbix-agent修改配置
sudo vim /etc/zabbix/zabbix_agentd.conf调整项
Server=127.0.0.1 #修改为 zabbix server 服务器的IP,如果有网关或被监控机为虚拟机也加上母机的IP
ServerActive=127.0.0.1 #修改为 zabbix server 服务器的IP
Hostname=Zabbix server #修改为网页里面添加的Hostname,需要保持一致。简易脚本:
sudo -Hs
#ubuntu 12.04,14.04不需要加
#echo "deb http://ppa.launchpad.net/9v-shaun-42/zabbix22/ubuntu precise main" > /etc/apt/sources.list.d/zabbix.list
apt-get update
apt-get install zabbix-agent
echo "Server=192.168.3.52,192.168.3.10" > /etc/zabbix/zabbix_agentd.conf.d/server.conf
echo "ServerActive=192.168.3.52" >> /etc/zabbix/zabbix_agentd.conf.d/server.conf
echo "Hostname=`/sbin/ifconfig eth0|sed -n '/inet addr/s/^[^:]*:\([0-9.]\{7,15\}\) .*/\1/p'`" >> /etc/zabbix/zabbix_agentd.conf.d/server.conf
/etc/init.d/zabbix-agent restart四 CentOS下的客户端安装
//安装方法
rpm -ivh
yum install zabbix-agent
//启动
service zabbix-agent start
//开机启动
chkconfig zabbix-agent on
//配置方法
vi /etc/zabbix/zabbix_agentd.conf
一些Zabbix相关教程集合:
Ubuntu 14.04下Zabbix2.4.5 源码编译安装 http://www.linuxidc.com/Linux/2015-05/117657.htm
安装部署分布式监控系统Zabbix 2.06 http://www.linuxidc.com/Linux/2013-07/86942.htm
《安装部署分布式监控系统Zabbix 2.06》 http://www.linuxidc.com/Linux/2013-07/86942.htm
CentOS 6.3下Zabbix安装部署 http://www.linuxidc.com/Linux/2013-05/83786.htm
Zabbix分布式监控系统实践 http://www.linuxidc.com/Linux/2013-06/85758.htm
CentOS 6.3下Zabbix监控apache server-status http://www.linuxidc.com/Linux/2013-05/84740.htm
CentOS 6.3下Zabbix监控MySQL数据库参数 http://www.linuxidc.com/Linux/2013-05/84800.htm
64位CentOS 6.2下安装Zabbix 2.0.6 http://www.linuxidc.com/Linux/2014-11/109541.htm