Zabbix安装
1.Zabbix监控平台部署安装zabbix之前需要LAMP架构,为了快速上手,我们这里采用yum安装LAMP,如果你想尝试,也可以使用源码版LAMP,效果是一样,都是为了解析zabbix php代码。执行如下命令安装LAMP环境:
yum install httpd httpd-devel php php-devel mysql mysql-server mysql-devel php-mysql -y
实战环境:
Server端:192.168.57.135
Agent端:192.168.57.131
下载zabbix版本:
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.0.6/zabbix-2.0.6.tar.gz/downloadtar-xzf downloadmvzabbix-2.0.6/ /data/ wget https://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/3.0.5/zabbix-3.0.5.tar.gz/download1) 在server端和agent执行:yum -y install curlcurl-devel net-snmp net-snmp-devel perl-DBIgroupadd zabbix;useradd -g zabbix zabbix;usermod -s /sbin/nologin zabbix2) Server端如下配置:初始化MySQL,/etc/init.d/mysqld restart ;进入mysql –uroot -p,创建zabbix数据库,执行授权命令:create database zabbix;grant all on zabbix.*to zabbix@localhost identified by '123456';表示mysql -uzabbix –pmysql -hlocalhost -uzabbix –p可以登录,-hlocalhost默认就有# mysql-uzabbix -p然后解压zabbix并导入数据到zabbix数据库。tar zxvfzabbix-2.0.6.tar.gzcd zabbix-2.0.6mysql -uzabbix -p123456zabbix <database/mysql/schema.sqlmysql -uzabbix -p123456zabbix <database/mysql/images.sqlmysql -uzabbix -p123456zabbix < database/mysql/data.sql顺序导入,先导入schema.sql同时导入数据库完毕后,在zabbix-2.0.6源码解压目录执行编译zabbix,命令如下:
./configure--prefix=/usr/local/zabbix/ --enable-server --enable-agent --with-mysql--enable-ipv6 --with-net-snmp --with-libcurl &&make install //--with-libcurl抓取网页ln -s/usr/local/zabbix/sbin/zabbix_* /usr/local/sbin/ //链接zabbix命令直接使用 /usr/local/sbin 安装的软件命令放在这里/usr/bin-系统命令
安装完毕,进入/usr/local/zabbix/etc/下
执行如下命令,zabbix_server.conf内容:# grep -v "#"zabbix_server.conf|grep -v "^$"
LogFile=/tmp/zabbix_server.log
DBName=zabbix
DBUser=rootgrep-v "^#"zabbix_server.conf|grep -v^$ 内容修改为如下:LogFile=/tmp/zabbix_server.logDBHost=localhostDBName=zabbixDBUser=zabbixDBPassword=123456同时拷贝zabbix_server脚本,启动zabbix_server, 默认端口为10051# cd /data/zabbix-2.0.6/cpmisc/init.d/tru64/zabbix_server /etc/init.d/zabbix_server ;chmod o+x/etc/init.d/zabbix_server配置Apache发布zabbix php代码,方法如下:cp -a /root/zabbix-2.0.6/frontends/php/*/var/www/html/sed-i'/date.timezone/i date.timezone = PRC' /etc/php.ini///root/zabbix-2.0.6/frontends/php/*php代码web页面# pwd
/data/zabbix-2.0.6/frontends
# \cp php/* /var/www/html/ -a打开浏览器看到报错:date(): It is not safeto rely on the system's timezone settings. You are *required* to use thedate.timezone setting or the date_default_timezone_set() function. In case youused any of those methods and you are still getting this warning, you mostlikely misspelled the timezone identifier. We selected the timezone 'UTC' fornow, but please set date.timezone to select your timezone.
修改php.ini时区# more /etc/php.inidate.timezone=PRC#systemctl restart httpd重启apache后报错消失 3) 启动所有服务安装zabbix:重启服务端zabbix_server:/etc/init.d/zabbix_server restart/etc/init.d/httpd restart ;/etc/init.d/mysqld restart 即可。重启客户端zabbix_agentd:/etc/init.d/zabbix_agentd restart4) 浏览器访问zabbix:通过浏览器http://192.168.149.128/默认就可以访问zabbix了,如果大家的apache发布目录带有二级目录zabbix,访问需要接zabbix哦。安装出现如下报错肿么办呢?
解决方法:yum installphp-mbstring php-bcmath php-gd php-xmlyum install gd gd-develsed -i'/post_max_size/s/8/16/g;/max_execution_time/s/30/300/g;/max_input_time/s/60/300/g;' /etc/php.ini# sed-i '/post_max_size/s/8/16/g;/max_execution_time/s/30/300/g;/max_input_time/s/60/300/g;'/etc/php.ini然后重启/etc/init.d/httpdrestart 即可。
页:
[1]