5fc869c9eb45d5077.jpg_fo742.jpg

mysql安装
卸载mariadb
[root@whole87 ~]# rpm -qa|grep mariadb
mariadb-libs-5.5.41-2.el7_0.x86_64
[root@whole87 ~]# rpm -e –nodeps mariadb-libs-5.5.41-2.el7_0.x86_64
安装mysql
[root@whole87 ~]# cd /usr/local/src/
[root@whole87 src]# mkdir mysql-5.7.17-1.el7.x86_64.rpm-bundle
[root@whole87 src]# tar -xvf mysql-5.7.17-1.el7.x86_64.rpm-bundle.tar -C ./mysql-5.7.17-1.el7.x86_64.rpm-bundle
[root@whole87 src]# cd mysql-5.7.17-1.el7.x86_64.rpm-bundle
[root@whole87 mysql-5.7.17-1.el7.x86_64.rpm-bundle]# yum install mysql-community-common-5.7.17-1.el7.x86_64.rpm
[root@whole87 mysql-5.7.17-1.el7.x86_64.rpm-bundle]# yum install mysql-community-libs-*
[root@whole87 mysql-5.7.17-1.el7.x86_64.rpm-bundle]# yum install mysql-community-client-5.7.17-1.el7.x86_64.rpm
[root@whole87 mysql-5.7.17-1.el7.x86_64.rpm-bundle]# yum install mysql-community-server-5.7.17-1.el7.x86_64.rpm
[root@whole87 mysql-5.7.17-1.el7.x86_64.rpm-bundle]# yum install mysql-community-devel-5.7.17-1.el7.x86_64.rpm
启动mysql
[root@whole87 ~]# systemctl start mysqld.service
获取初始安装临时密码
[root@whole87 ~]# grep ‘temporary password’ /var/log/mysqld.log
[root@whole87 ~]# mysql -uroot -p
修改密码失败,密码安全策略不通过
mysql> ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘888888’;
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
[root@whole87 ~]# vim /etc/my.cnf

validate_password=off
[root@whole87 ~]# systemctl restart mysqld.service
mysql> GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘888888’ WITH GRANT OPTION;

创建mysql用户 zabbix/zabbix
mysql> use mysql
mysql> create user zabbix identified by ‘zabbix’;
授权zabbix用户远程登录权限
mysql> GRANT ALL PRIVILEGES ON . TO ‘zabbix’@’%’ IDENTIFIED BY ‘zabbix’ WITH GRANT OPTION;
刷新系统权限
mysql> FLUSH PRIVILEGES;
创建数据库zabbix 默认字符集utf-8
mysql> CREATE DATABASE IF NOT EXISTS zabbix DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

传入zabbix安装包解压
[root@server84 ~]# cd /usr/local/src/
[root@server84 src]# tar -zxvf zabbix-3.2.3.tar.gz
导入数据
[root@server84 mysql]# cd /usr/local/src/zabbix-3.2.3/database/mysql
[root@server84 mysql]# mysql -uzabbix -pzabbix zabbix < schema.sql
[root@server84 mysql]# mysql -uzabbix -pzabbix zabbix < images.sql
[root@server84 mysql]# mysql -uzabbix -pzabbix zabbix < data.sql
安装yum包
[root@server84 mysql]# yum -y install libxml2-devel net-snmp-devel libcurl-devel gcc
添加用户和组
[root@server84 mysql]# groupadd zabbix
[root@server84 mysql]# useradd -g zabbix zabbix
编译安装
[root@server84 zabbix-3.2.3]# ./configure –prefix=/usr/local/zabbix-server –enable-server –enable-agent –with-mysql –with-net-snmp –with-libcurl –with-libxml2 –enable-java
出现Now run‘make install’
[root@server84 zabbix-3.2.3]# make install
创建日志文件存放地更改权限
[root@server84 zabbix-3.2.3]# mkdir -p /var/log/zabbix/
[root@server84 zabbix-3.2.3]# chown -R zabbix:zabbix /var/log/zabbix
修改zabbix_server设置
[root@server84 zabbix-3.2.3]# vim /usr/local/zabbix-server/etc/zabbix_server.conf

LogFile=/var/log/zabbix/zabbix_server.log
DBHost=localhost
DBPort=3306
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
ListenIP=127.0.0.1
配置开机启动
[root@server84 zabbix-3.2.3]# ln -s /usr/local/zabbix-server/etc/ /etc/zabbix
[root@server84 zabbix-3.2.3]# ln -s /usr/local/zabbix-server/sbin/* /usr/sbin/
[root@server84 zabbix-3.2.3]# cp /usr/local/src/zabbix-3.2.3/misc/init.d/fedora/core/zabbix_* /etc/init.d/
[root@server84 zabbix-3.2.3]# chmod 755 /etc/init.d/zabbix_*
[root@server84 zabbix-3.2.3]# sed -i “s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix-server@g” /etc/init.d/zabbix_server
[root@server84 zabbix-3.2.3]# chkconfig zabbix_server on
防火墙配置通过80\3306\10050\10051端口,详细配置方式见文末示例
关闭selinux
[root@server84 ~]# vim /etc/selinux/config
SELINUX=disabled
启动zabbix
[root@server84 ~]# service zabbix_server start
安装httpd和php
[root@server84 ~]# yum -y install httpd php php-mysql libXpm php-bcmath php-gd php-mbstring php-xml t1lib
[root@server84 ~]# mkdir -p /var/www/html/zabbix
创建web目录
[root@server84 ~]# cd /usr/local/src/zabbix-3.2.3/frontends/php/
[root@server84 php]# cp -r ./* /var/www/html/zabbix/
授权
[root@server84 ~]# chown -R apache.apache /var/www/html/zabbix/
修改php配置
[root@server84 ~]# vim /etc/php.ini
date.timezone = Asia/Shanghai
post_max_size = 32M
max_execution_time = 300
max_input_time = 300
启动php
[root@server84 ~]# systemctl start httpd.service

网页访问http://192.168.3.84/zabbix使用账号admin/zabbix登录


agent安装

传入zabbix安装包解压
[root@agent86 ~]# cd /usr/local/src/
[root@agent86 src]# tar -zxvf zabbix-3.2.3.tar.gz
添加用户和组
[root@agent86 zabbix-3.2.3]# groupadd zabbix-agent
[root@agent86 zabbix-3.2.3]# useradd -g zabbix-agent zabbix-agent
安装yum包
[root@agent86 mysql]# yum -y install libxml2-devel net-snmp-devel libcurl-devel
编译安装
[root@agent86 zabbix-3.2.3]# ./configure –prefix=/usr/local/zabbix-agent –enable-agent –enable-java
出现Now run‘make install’
[root@agent86 zabbix-3.2.3]# make install
创建日志文件存放地更改权限
[root@agent86 zabbix-3.2.3]# mkdir -p /var/log/zabbix/
[root@agent86 zabbix-3.2.3]# chown -R zabbix-agent:zabbix-agent /var/log/zabbix
修改zabbix_agent设置
[root@agent86 ~]# vim /usr/local/zabbix-agent/etc/zabbix_agentd.conf

LogFile=/var/log/zabbix/zabbix_agentd.log
Server=192.168.3.84
ServerActive=192.168.3.84
Hostname=server84
User=zabbix-agent
防火墙配置通过10050\10051端口,详细配置方式见文末示例
配置开机启动
[root@agent86 ~]# ln -s /usr/local/zabbix-agent/etc/ /etc/zabbix
[root@agent86 ~]# ln -s /usr/local/zabbix-agent/bin/* /usr/bin
[root@agent86 ~]# ln -s /usr/local/zabbix-agent/sbin/* /usr/sbin/
[root@agent86 ~]# cp /usr/local/src/zabbix-3.2.3/misc/init.d/fedora/core/zabbix_agentd /etc/init.d/
[root@agent86 ~]# chmod 755 /etc/init.d/zabbix_agentd
[root@agent86 ~]# sed -i “s@BASEDIR=/usr/local@BASEDIR=/usr/local/zabbix-agent@g” /etc/init.d/zabbix_agentd
[root@agent86 ~]# chkconfig zabbix_agentd on
[root@agent86 ~]# service zabbix_agentd start

=
tomcat监控

agent:tomcat配置
[root@agent86 bin]# vim /usr/local/tomcat/server/bin/catalina.sh
在行 touch “CATALINA_OUT” 之上,添加参数行
CATALINA_OPTS=”
CATALINA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=192.168.3.86″
[root@agent86 bin]# cd /usr/local/tomcat/server/lib/
[root@agent86 lib]# cp /usr/local/src/catalina-jmx-remote.jar .
添加监听器注册端口和服务端口

防火墙配置通过12345/12346端口
重启tomcat和zabbix_agentd
Jmx测试
[root@server84 src]# java -jar cmdline-jmxclient-0.10.3.jar – 192.168.3.87:12345 | grep 8080
[root@server84 src]# java -jar cmdline-jmxclient-0.10.3.jar – 192.168.3.87:12345 ‘Catalina:name=”http-bio-8080″,type=GlobalRequestProcessor’ bytesReceived

server:conf配置
安装java_gateway
[root@server84 ~]# rpm -ivh /usr/local/src/zabbix-java-gateway-3.2.3-1.el7.x86_64.rpm
启动zabbix_java
[root@server84 ~]# sh /usr/local/zabbix/sbin/zabbix_java/startup.sh
配置文件: /etc/zabbix/zabbix_java_gateway.conf
[root@server84 ~]# vim /usr/local/zabbix-server/etc/zabbix_server.conf

JavaGateway=127.0.0.1
JavaGatewayPort=10052
StartJavaPollers=5

=
java环境配置
[root@agent86 ~]# rpm -ivh jdk-7u71-linux-x64.rpm
[root@agent86 ~]# vim /etc/profile
添加如下配置
export JAVA_HOME=/usr/java/default
export JAVA_BIN=JAVA_HOME/bin
export PATH=
PATH:JAVA_HOME/bin
export CLASSPATH=.:
JAVA_HOME/lib/dt.jar:JAVA_HOME/lib/tools.jar
export PATH=
JAVA_HOME/bin:JRE_HOME/bin:PATH
[root@agent86 ~]# source /etc/profile
[root@agent86 ~]# java -version

=
tomcat环境配置
[root@agent86 ~]# mkdir /usr/local/tomcat
[root@agent86 ~]# cd /usr/local/tomcat/
[root@agent86 tomcat]# cp /usr/local/src/apache-tomcat-7.0.73.tar.gz .
[root@agent86 tomcat]# tar -zxvf apache-tomcat-7.0.73.tar.gz
[root@agent86 tomcat]# ln -s apache-tomcat-7.0.73 server
[root@agent86 tomcat]# cd /usr/local/tomcat/server/bin
[root@agent86 bin]# ./startup.sh

=
配置防火墙
【firewalld】:
firewall-cmd –zone=public –add-port=10050/tcp –permanent
firewall-cmd –reload
firewall-cmd –zone=public –list-ports
【iptables】:
iptables -I INPUT -p tcp –dport 10050 -j ACCEPT
iptables -I OUTPUT -p tcp –sport 10050 -j ACCEPT
iptables save
iptables restart
iptables -L

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

Captcha Code