1.环境描述:
redhat 6.5
zabbix 2.4.5
172.30.0.195
yum install pcre*
yum install openssl*
yum -y install net-snmp-devel curl-devel
yum -y install automake autoconf libtool make
yum -y install gcc gcc-c++ glibc
yum -y install libmcrypt-devel mhash-devel libxslt-devel \
libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel \
zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel \
ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel \
krb5 krb5-devel libidn libidn-devel openssl openssl-devel
wget http://cn2.php.net/distributions/php-5.5.25.tar.gz
tar zxvf php-5.5.25.tar.gz
./configure --prefix=/usr/local/php-5.5.0 --with-config-file-path=/usr/local/php-5.5.25/etc --with-bz2 --with-curl --enable-ftp --enable-sockets --disable-ipv6 --with-gd --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
make && make install
注意到编译参数位置--with-config-file-path=/usr/local/php-5.5.5/etc
复制一下php.ini到指定位置
cp /usr/local/php-5.5.0/php.ini /usr/local/php-5.5.0/etc/php.ini
修改参数:
vim /usr/local/php-5.5.0/etc/php.ini //修改以下地方
date.timezone =Asia/Shanghai
post_max_size =32M
max_execution_time =300
max_input_time =300
/usr/local/php-5.5.0/sbin/php-fpm
修改php-fpm.conf中配置 没有则增加
catch_workers_output = yes
error_log = /data/logs/nginx/php-fpm.log
修改php.ini中配置,没有则增加
log_errors = On
error_reporting=E_ALL&~E_NOTICE
error_log = /data/logs/nginx/php_errors.log
cd /u01/soft/php-5.5.25/ext/bcmath
/usr/local/php-5.5.0/bin/phpize
./configure --with-php-config=/usr/local/php-5.5.0/bin/php-config
make && make install
vi /usr/local/php-5.5.0/etc/php.ini 添加
extension=bcmath.so
yum install ngnix
在/etc/nginx/nginx.conf默认配置文件中,在http代码块中添加以下代码:
server{
listen 88;
root /data/site/zabbix-server.com;
index index.html index.htm index.php;
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
access_log /data/logs/nginx/zabbix-server.com.access.log;
}
service ngnix start
rpm -ivh MySQL-server-advanced-5.6.22-1.el6.x86_64.rpm MySQL-client-advanced-5.6.22-1.el6.x86_64.rpm MySQL-devel-advanced-5.6.22-1.el6.x86_64.rpm
在安装完毕后会有一段提示,root默认密码存储在哪个文件里,可以查看。
more /root/.mysql_secret
然后使用默认密码连接mysql并修改当前root密码
mysql> set password=password('abc123');
mysql> create database zabbix character set utf8;
Query OK, 1 row affected (0.06 sec)
mysql> grant all on zabbix.* to zabbix@localhost identified by 'redhat';
Query OK, 0 rows affected (0.05 sec)
wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.5/zabbix-2.4.5.tar.gz
tar zxvf zabbix-2.4.5.tar.gz
./configure --prefix=/usr/local/zabbix --enable-server --enable-proxy --enable-agent --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl
make && make install
[root@mongodb-mms mysql]# ls
data.sql images.sql schema.sql
[root@mongodb-mms mysql]# pwd
/u01/soft/zabbix-2.4.5/database/mysql
[root@mongodb-mms mysql]# mysql -uzabbix -p'redhat' zabbix < schema.sql
Warning: Using a password on the command line interface can be insecure.
[root@mongodb-mms mysql]# mysql -uzabbix -p'redhat' zabbix < images.sql
Warning: Using a password on the command line interface can be insecure.
[root@mongodb-mms mysql]# mysql -uzabbix -p'redhat' zabbix < data.sql
Warning: Using a password on the command line interface can be insecure.
[root@mongodb-mms zabbix-2.4.5]# cat >> /etc/services <<eof
> zabbix-agent 10050/tcp #ZabbixAgent
> zabbix-agent 10050/udp #Zabbix Agent
> zabbix-trapper 10051/tcp #ZabbixTrapper
> zabbix-trapper 10051/udp #Zabbix Trapper
> eof
# vim /usr/local/zabbix/etc/zabbix_server.conf //修改以下内容
DBName=zabbix
DBUser=zabbix
DBPassword=redhat
DBSocket=/tmp/mysql.sock
DBPort=3306
[root@mongodb-mms zabbix-2.4.5]# cp misc/init.d/fedora/core/zabbix_server /etc/init.d/
[root@mongodb-mms zabbix-2.4.5]# cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
分别修改/etc/init.d/zabbix_server、zabbix_agentd将其中的BASEDIR改为实际zabbix的安装位置,如我们这里的/usr/local/zabbix
vim /etc/init.d/zabbix_server
BASEDIR=/usr/local/zabbix
service zabbix_server start
service zabbix_agentd start
htttp://172.30.0.195:88
vim /usr/local/zabbix-2.2.2/etc/zabbix_agentd.conf
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server
Server和ServerActive都指定zabbixserver的IP地址,不同的是,前者是被动后者是主动。
重启agent即可
/usr/local/zabbix-2.2.2/sbin/zabbix_agentd restart
useradd -s /sbin/nologin -d /dev/null zabbix
wget http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-agent-2.4.5-1.el6.x86_64.rpm
wget http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-2.4.5-1.el6.x86_64.rpm
rpm -ivh zabbix-*
vi /etc/zabbix/zabbix_agentd.conf
Server=172.30.0.195
Hostname=Mongodb-test1
附:一种简单的修改配置方法:
sed -i 's/^Server=.*$/Server=172.30.0.195./g' /etc/zabbix/zabbix_agentd.conf
sed -i 's/^Hostname=.*$/Hostname= Mongodb-test1/g' /etc/zabbix/zabbix_agentd.conf
cat>>/etc/services<
zabbix_agent 10050/tcp
zabbix_trap 10051/tcp
EOF
agent默认的配置文件为/etc/zabbix/zabbix_agentd.conf,所以一般无需指定
/usr/sbin/zabbix_agentd
netstat -utlnp | grep zabbix
/usr/local/zabbix/bin/zabbix_get -s172.30.0.233 -p10050 -k"net.if.in[eth0]"
/usr/local/zabbix/bin/zabbix_get -s172.30.0.233 -p10050 -k"system.uptime"
日志文件/var/log/za...