安装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
sudo vim /etc/zabbix/zabbix_server.conf
修改相关
DBName=zabbix DBUser=zabbix DBPassword=zabbix #非必需,但推荐 StartDiscoverers=5
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;
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
sudo vim /etc/php5/apache2/php.ini
修改项:
post_max_size = 16M max_execution_time = 300 max_input_time = 300 date.timezone = "Asia/Shanghai"
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
sudo vim /etc/default/zabbix-server
修改项:
START=yes
启动:
sudo service zabbix-server start
sudo apt-get install zabbix-agent sudo service zabbix-agent restart
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