一、zabbix简介:
二、web环境部署
防火墙关闭
selinux关闭
源码包路径:/cacti/
安装路径:/usr/local/
rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum list
yum update
http://www.cnblogs.com/zclzhao/p/4936917.html nginx安装
http://www.cnblogs.com/zclzhao/p/4936920.html mysql安装
Php安装:
tar zxvf php-5.5.24.tar.gz
cd php-5.5.24
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc --with-bz2 --with-curl \
--enable-ftp --enable-sockets --disable-ipv6 --with-gd \
--with-mysql=/usr/local/mysql-5.5.18 --with-mysqli=/usr/local/mysql-5.5.18/bin/mysql_config \
--with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql=/usr/local/mysql-5.5.18 \
--with-jpeg-dir=/usr/local --with-png-dir=/usr/local \
--with-freetype-dir=/usr/local --enable-gd-native-ttf \
--with-iconv-dir=/usr/local --enable-mbstring --enable-calendar \
--with-gettext --with-libxml-dir=/usr/local --with-zlib \
--with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql=mysqlnd \
--enable-dom --enable-xml --enable-fpm --with-libdir=lib64 --enable-bcmath
ln -s /usr/local/php/etc/php.ini /etc/php.ini
ln -s php-fpm.conf /etc/php-fpm.conf
cd sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
chmod +x /etc/rc.d/init.d/php-fpm
chkconfig php-fpm on
/etc/init.d/php-fpm start
三、安装zabbix
groupadd zabbix
useradd -g zabbix zabbix
cd zabbix-2.4.7
./configure --prefix=/usr/local/zabbix-2.4.7/ --enable-server --enable-agent --with-mysql=/usr/local/mysql-5.5.18/bin/mysql_config --with-net-snmp --with-libcurl --with-libxml2
Make
Make install
建立zabbix账号
mysql -uroot -p
create database zabbix default charset utf8;
grant all privileges on zabbix.* to zabbix@localhost identified by '123qwe';
quit;
导数据库
mysql -uroot -p123qwe zabbix < /cacti/zabbix-2.4.7/database/mysql/schema.sql
mysql -uroot -p123qwe zabbix < /cacti/zabbix-2.4.7/database/mysql/images.sql
mysql -uroot -p123qwe zabbix < /cacti/zabbix-2.4.7/database/mysql/data.sql
添加启动脚本
cp misc/init.d/tru64/zabbix_server /etc/rc.d/init.d/
cp misc/init.d/tru64/zabbix_agentd /etc/rc.d/init.d/
chmod +x /etc/init.d/zabbix_server
chmod +x /etc/init.d/zabbix_agentd
配置启动文件目录
vi /etc/init.d/zabbix_server
DAEMON=/usr/local/zabbix-2.4.7/sbin/zabbix_server
vi /etc/init.d/zabbix_agentd
DAEMON=DAEMON=/usr/local/zabbix-2.4.7/sbin/zabbix_agentd
pwd
ln -s /usr/local/zabbix-2.4.7/etc/zabbix_server.conf /etc/zabbix/
配置zabbix_server.conf
grep -v ^# /etc/zabbix/zabbix_server.conf |grep -v ^$
ListenPort=10051
LogFile=/tmp/zabbix_server.log
DebugLevel=4
PidFile=/tmp/zabbix_server.pid
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=123qwe
DBSocket=/tmp/mysql.sock
DBPort=3306
StartPollers=15
StartIPMIPollers=15
StartPingers=2
StartDiscoverers=2
StartHTTPPollers=2
配置php.ini
vi /etc/php.ini
post_max_size = 32M
max_execution_time = 300
max_input_time = 300
mkdir /cacti/zabbix(创建web目录)
cp -rf frontends/php/* /cacti/zabbix/ (在zabbix源码包路径拷贝到web目录)
zabbix启动
/etc/init.d/zabbix_server start
有可能报错:/usr/local/zabbix-2.4.7/sbin/zabbix_server: error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
解决方法:
echo "/usr/local/mysql-5.5.18/lib/" >> /etc/ld.so.conf
ldconfig
启动的端口:
netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 5606/zabbix_server
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 4954/php-fpm
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 5434/mysqld
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 5458/nginx
nginx虚拟主机配置:
location / {
root /cacti/zabbix;
index index.html index.htm index.php;
}
location ~ \.php$ {
root /cacti/zabbix;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
web界面操作
浏览器输入:192.168.12.30
单击(next)按钮
单击(next)按钮
单击test connection按钮测试数据库是否正常连接
测试ok,单击next按钮
单击next按钮
提示没有zabbix.conf.php配置文件,点击download configuration file按钮,下载之后上传到服务器/cacti/zabbix/conf/目录