zabbix搭建
centos 5.9- Final+zabbix
系统环境
操作系统
centos 5.9- Final
IP地址
10.0.1.240
zabbix版本
zabbix-2.4.6
LAMP环境搭建
mysql
yum -y install mod_auth_mysql MySQL-python apr-util-mysql freeradius2-mysql libdbi-dbd-mysql mysql-bench mysql-connector-odbc64 mysql-connector-odbc mysql-test perl-DBD-MySQL php-pdo rsyslog rsyslog-mysql
chkconfig mysqld on
httpd
yum -y install mod_ssl system-config-httpd httpd httpd-manual
chkconfig httpd on
php
yum -y install php53 php53-bcmath php53-cli php53-common php53-dba php53-devel php53-gd php53-imap php53-intl php53-ldap php53-mbstring php53-mysql php53-odbc php53-pdo php53-process php53-pspell php53-snmp php53-soap php53-xml php53-xmlrpc
测试
编写php测试脚本
vim /var/www/html/phpinfo.php
<?php
phpinfo();
?>
本机测试
curl http://127.0.0.1
网页测试
zabbix安装配置
zabbix安装
tar xzf /tmp/zabbix-2.4.6.tar.gz -C /usr/src/
groupadd zabbix
useradd -g zabbix -s /sbin/nologin -M zabbix
yum -y install libxml2-devel
yum -y install net-snmp net-snmp-devel net-snmp-libs
yum -y install unixODBC unixODBC-devel
yum -y install OpenIPMI OpenIPMI-devel
yum -y install curl-devel
yum -y install java-1.7.0-openjdk java-1.7.0-openjdk-devel java-1.7.0-openjdk-src java-1.7.0-openjdk-javadoc
#JAVA
export JAVA_HOME=/usr/lib/jvm/java-1.7.0
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
cd /usr/src/zabbix-2.4.6/
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --enable-java --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-openipmi --with-unixodbc
make && make install
mysql配置
mysql
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix_1.240';
mysql> flush privileges;
mysql> quit
导入zabbix数据库
mysql -uzabbix -p zabbix < database/mysql/schema.sql
mysql -uzabbix -p zabbix < database/mysql/images.sql
mysql -uzabbix -p zabbix < database/mysql/data.sql
zabbix_server.conf配置
vim /usr/local/zabbix/etc/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix_1.240
php.ini配置
vim /etc/php.ini
max_execution_time 300
memory_limit 128M
post_max_size 16M
upload_max_filesize 2M
max_input_time 300
date.timezone Asia/Shanghai
web访问设置
cp -r frontends/php/* /var/www/html/
zabbix第三方插件
zatree
下载地址
https://github.com/spide4k/zatree
安装
cd /var/www/
mv html html-bk
cp -fr /usr/src/zatree-master/zabbix-2.4.5/zatree-zabbix-2.4.5/* html/
cp html-bk/conf/zabbix.conf.php html/conf/
vim html/zatree/zabbix_config.php
$zabbix_api_config=array(
'api_url'=>'api_jsonrpc.php',
'user'=>'Admin',
'password'=>'zabbix',
'graph_url'=>'zabbix_chart.php',
'http_user'=>'',
'http_password'=>''
);
vim /var/www/html/zatree/graph.php
删除如下文字
vim /var/www/html/zatree/echart_zabbix.php
删除如下文字
vim /var/www/html/zatree/peckvalue_zabbix.php
删除如下文字