返回顶部
首页 > 资讯 > 数据库 >zabbix 2.0.X安装
  • 955
分享到

zabbix 2.0.X安装

2024-04-02 19:04:59 955人浏览 薄情痞子
摘要

file /sbin/init #查看32/64位机器uname -r#查看linxu版本yum -y install GCc gcc-c++ autoconf Httpd PHP Mysql lrzsz

file /sbin/init #查看32/64位机器

uname -r#查看linxu版本



yum -y install GCc gcc-c++ autoconf Httpd PHP Mysql lrzsz mysql-server php-mysql httpd-


manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-


xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp-devel curl-


devel php-fpm pcre openssl openssl-devel  libjpeg* php-imap php php-mysql php-gd libjpeg* 


php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-bcmath 


php-mhash libmcrypt libmcrypt-devel php-fpm php-pecl* 



#配置Nginx

*这里绑定了两个端口,一般只要80就行了。

*vim /etc/nginx/conf.d/default.conf

server {

    listen      80 default_server;

    server_name  _;


    #charset koi8-r;


    #access_log  logs/host.access.log  main;


    location / {

        root   /usr/share/nginx/html;

        index  index.html index.htm;

    }


    error_page  404              /404.html;

    location = /404.html {

        root   /usr/share/nginx/html;

    }


    # redirect server error pages to the static page /50x.html

    #

    error_page   500 502 503 504  /50x.html;

    location = /50x.html {

        root   /usr/share/nginx/html;

    }


*vim /etc/nginx/conf.d/zabbix.conf

    server {

        listen     10.17.26.176:8080;

        listen     10.17.26.176:80;

        server_name  10.17.26.176;

        location / {

            root html;

            index  index.html index.htm index.php;

        }

        location ~ \.php$ {

            root           html;

            fastcgi_pass   127.0.0.1:9000;

            fastcgi_index  index.php;

            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

            include        fastcgi_params;

            include        fastcgi.conf;

        }

}


/usr/sbin/nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful


chkconfig nginx on

/etc/init.d/nginx start



=======================================================================

#配置php

cp /etc/php.ini php.ini.bak

sed -i "s/;date.timezone =/date.timezone = Asia\/Shanghai/g" /etc/php.ini

sed -i "s#max_execution_time = 30#max_execution_time = 300#g" /etc/php.ini

sed -i "s#post_max_size = 8M#post_max_size = 32M#g" /etc/php.ini

sed -i "s#max_input_time = 60#max_input_time = 300#g" /etc/php.ini

sed -i "s#memory_limit = 128M#memory_limit = 128M#g" /etc/php.ini

sed -i "/;mbstring.func_overload = 0/ambstring.func_overload = 2\n" /etc/php.ini


sed -i 's/^user =.*/user = nginx/g' /etc/php-fpm.d/www.conf

sed -i 's/^group =.*/group = nginx/g' /etc/php-fpm.d/www.conf


chkconfig nginx on

/etc/init.d/php-fpm start


===============================================================================

#配置mysql


mysql#进入mysql

*用户为zabbix_uesr 密码为 zabbix(之后为zabbix登陆用户名和密码)

insert into mysql.user(Host,User,PassWord) values("localhost","zabbix_user",password


("zabbix"));

flush privileges;#刷新权限


mysql -u root

*创建数据库名字为zabbix

*为了支持中文,数据库字符集采用utf8,在定义添加设备的时候可以使用中文名称

*授权zabbix系统访问Mysql数据库的用户和密码,zabbixdb.*指的是访问zabbixdb库内的所有表

create database zabbix character set utf8;

grant all privileges on zabbix.* to zabbix_user@localhost identified by 'zabbix';

flush privileges;


chkconfig mysqld on

service mysqld start


===========================================================

#配置zabbix

groupadd zabbix -g 1001

useradd -g zabbix -u 1001 -m zabbix

cat /etc/group | grep zabbix

cat /etc/passwd | grep zabbix


tar -zxvf zabbix-2.0.18.tar.gz

cd ./zabbix-2.0.18

./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


configure: error: Not found mysqlclient library

cd /usr/lib64/mysql/

ln -s libmysqlclient.so.16.0.0 libmysqlclient.so

ln -s libmysqlclient_r.so.16.0.0 libmysqlclient_r.so


configure: error: Invalid NET-SNMP directory - unable to find net-snmp-config

wget ftp://fr2.rpmfind.net/linux/opensuse/update/12.3/x86_64/net-snmp-devel-5.7.2-


3.12.1.x86_64.rpm

yum -y install net-snmp-devel


cat /etc/services | grep zabbix

zabbix-agent    10050/tcp               # Zabbix Agent

zabbix-agent    10050/udp               # Zabbix Agent

zabbix-trapper  10051/tcp               # Zabbix Trapper

zabbix-trapper  10051/udp               # Zabbix Trapper


cd /root/zabbix-2.0.18

mysql -uzabbix_user -pzabbix zabbix < ./database/mysql/schema.sql

mysql -uzabbix_user -pzabbix zabbix < ./database/mysql/p_w_picpaths.sql

mysql -uzabbix_user -pzabbix zabbix < ./database/mysql/data.sql


*创建zabbix的的日志文件和连接

chown zabbix.zabbix /tmp

ln -s /usr/local/zabbix/etc /etc/zabbix

ln -s /usr/local/zabbix/bin/* /usr/bin/

ln -s /usr/local/zabbix/sbin/* /usr/sbin/


*拷贝与配置zabbix启动文件

cp misc/init.d/fedora/core/zabbix_* /etc/init.d/

chmod 755 /etc/init.d/zabbix_*

sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#g" /etc/init.d/zabbix_server

sed -i "s#BASEDIR=/usr/local#BASEDIR=/usr/local/zabbix#g" /etc/init.d/zabbix_agentd

chkconfig zabbix_server on #添加开机启动

chkconfig zabbix_agentd on #添加开机启动


*配置zabbix_server.conf服务端文件

sed -i "s/DBName\=zabbix/DBName\=zabbix/g" /etc/zabbix/etc/zabbix_server.conf 

sed -i "s/DBUser\=root/DBUser\=zabbix_uesr/g" /etc/zabbix/etc/zabbix_server.conf 

sed -i "/# DBPassword=/aDBPassword=zabbix\n" /etc/zabbix/etc/zabbix_server.conf 

sed -i "s#tmp/zabbix_server.log#var/log/zabbix/zabbix_server.log#g" 


/etc/zabbix/etc/zabbix_server.conf

LogFile=/tmp/zabbix_server.log


*配置 zabbix_agentd.conf 文件

sed -i "s/Server\=127.0.0.1/Server\=127.0.0.1,10.17.26.176/g" 


/etc/zabbix/etc/zabbix_agentd.conf 

sed -i "s/ServerActive\=127.0.0.1/ServerActive\=10.17.26.176:10051/g" 


/etc/zabbix/etc/zabbix_agentd.conf

#sed -i "s#tmp/zabbix_agentd.log#var/log/zabbix/zabbix_agentd.log#g" 


/etc/zabbix/etc/zabbix_agentd.conf

sed -i "s/UnsafeUserParameters=0/UnsafeUserParameters=1\n" 


/etc/zabbix/etc/zabbix_agentd.conf

#sed -i "s/Server\=127.0.0.1,10.17.26.176/Server\=127.0.0.1/g" 


/etc/zabbix/etc/zabbix_agent.conf

#sed -i "s/ServerActive\10.17.26.176:10051=/ServerActive\=127.0.0.1/g" 


/etc/zabbix/etc/zabbix_agent.conf


cd /root/zabbix-2.0.18

cp -r ./frontends/php/* /usr/share/nginx/html/

chown -R nginx.nginx /usr/share/nginx/html/


*php指向数据库(zabbix和数据库在一台机器上的不用配置)

vim /usr/share/nginx/html/zabbix/conf/zabbix.conf.php

$DB['TYPE']     = 'MYSQL';

$DB['SERVER']   = '10.17.1.43';

$DB['PORT']     = '3306';

$DB['DATABASE'] = 'zabbix';

$DB['USER']     = 'root';

$DB['PASSWORD'] = 'yihaodian';



/etc/init.d/nginx restart

/etc/init.d/zabbix_server restart

/etc/init.d/zabbix_agentd restart

/etc/init.d/php-fpm restart


#导入其他机器备份数据库

链接其他的zabbix数据库,把上面的备份导一份进去,然后再把里面缺失的表,用该库的建表语句建一下


mysql -h20.17.1.43 -uXXX -pXXX zabbix


ssh 10.17.26.8

zcat /data/backup/zabbix_jq_20160614_*z | mysql -h20.17.1.43 -uroot -pyihaodian zabbix

(zcat aaa.gz | mysql -h20.17.1.43 -uroot -pyihaodian zabbix)


diff 其他数据库 和 新数据库 查看要建哪些表

events sessions

trends trends_uint history_text history_uint history_str  


show create table history;


CREATE TABLE `trends` (

  `itemid` bigint(20) unsigned NOT NULL,

  `clock` int(11) NOT NULL DEFAULT '0',

  `num` int(11) NOT NULL DEFAULT '0',

  `value_min` double(16,4) NOT NULL DEFAULT '0.0000',

  `value_avg` double(16,4) NOT NULL DEFAULT '0.0000',

  `value_max` double(16,4) NOT NULL DEFAULT '0.0000',

  PRIMARY KEY (`itemid`,`clock`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;



CREATE TABLE `trends_uint` (

  `itemid` bigint(20) unsigned NOT NULL,

  `clock` int(11) NOT NULL DEFAULT '0',

  `num` int(11) NOT NULL DEFAULT '0',

  `value_min` bigint(20) unsigned NOT NULL DEFAULT '0',

  `value_avg` bigint(20) unsigned NOT NULL DEFAULT '0',

  `value_max` bigint(20) unsigned NOT NULL DEFAULT '0',

  PRIMARY KEY (`itemid`,`clock`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;



CREATE TABLE `history_text` (

  `id` bigint(20) unsigned NOT NULL,

  `itemid` bigint(20) unsigned NOT NULL,

  `clock` int(11) NOT NULL DEFAULT '0',

  `value` text NOT NULL,

  `ns` int(11) NOT NULL DEFAULT '0',

  PRIMARY KEY (`id`),

  UNIQUE KEY `history_text_2` (`itemid`,`id`),

  KEY `history_text_1` (`itemid`,`clock`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE `sessions` (

  `sessionid` varchar(32) NOT NULL DEFAULT '',

  `userid` bigint(20) unsigned NOT NULL,

  `lastaccess` int(11) NOT NULL DEFAULT '0',

  `status` int(11) NOT NULL DEFAULT '0',

  PRIMARY KEY (`sessionid`),

  KEY `sessions_1` (`userid`,`status`),

  CONSTRAINT `c_sessions_1` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`) ON DELETE 


CASCADE

) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE `history_uint` (

  `itemid` bigint(20) unsigned NOT NULL,

  `clock` int(11) NOT NULL DEFAULT '0',

  `value` bigint(20) unsigned NOT NULL DEFAULT '0',

  `ns` int(11) NOT NULL DEFAULT '0',

  KEY `history_uint_1` (`itemid`,`clock`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE `history_str` (

  `itemid` bigint(20) unsigned NOT NULL,

  `clock` int(11) NOT NULL DEFAULT '0',

  `value` varchar(255) NOT NULL DEFAULT '',

  `ns` int(11) NOT NULL DEFAULT '0',

  KEY `history_str_1` (`itemid`,`clock`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE `events` (

  `eventid` bigint(20) unsigned NOT NULL,

  `source` int(11) NOT NULL DEFAULT '0',

  `object` int(11) NOT NULL DEFAULT '0',

  `objectid` bigint(20) unsigned NOT NULL DEFAULT '0',

  `clock` int(11) NOT NULL DEFAULT '0',

  `value` int(11) NOT NULL DEFAULT '0',

  `acknowledged` int(11) NOT NULL DEFAULT '0',

  `ns` int(11) NOT NULL DEFAULT '0',

  `value_changed` int(11) NOT NULL DEFAULT '0',

  PRIMARY KEY (`eventid`),

  KEY `events_1` (`object`,`objectid`,`eventid`),

  KEY `events_2` (`clock`)

) ENGINE=InnoDB DEFAULT CHARSET=utf8;



mysql> set foreign_key_checks=off;

Query OK, 0 rows affected (0.00 sec)


mysql> drop table events;

Query OK, 0 rows affected (0.00 sec)


mysql> set foreign_key_checks=on; 

Query OK, 0 rows affected (0.00 sec)


导好后把那些hosts先disable掉

update hosts set status=1 where status=0;


重启zabbix server









#install_zabbix218

cd /etc/yum.repos.d/

wget http://mirrors.163.com/.help/Centos6-Base-163.repo

mv yihaodian.repo yihaodian.repo.bak

yum -y install net-snmp-devel 

yum -y install mysql

yum -y install mysqld

yum -y install mysql-server

yum -y install mysql-devel

yum -y install curl-devel

cd /root/

mkdir software

cd software/

wget 'http://liquidtelecom.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.0.18/zabbix-2.0.18.tar.gz'

tar zxvf zabbix-2.0.18.tar.gz 

cd /root/software/zabbix-2.0.18

./configure --prefix=/usr/local/zabbix-2.0.18 --enable-server --enable-proxy --enable-agent --enable-java --with-mysql=/usr/bin/mysql_config --with-net-snmp  --with-libcurl

make install

cd /usr/local/

ln -s zabbix-2.0.18 zabbix

cd /root/software/

yum -y install php

yum -y install php-fpm

yum -y install gd

yum -y install gd-devel

yum -y install php-gd

yum -y install openssl

wget 'http://nginx.org/download/nginx-1.10.1.tar.gz'

wget 'ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz'

tar zxvf pcre-8.38.tar.gz 

tar zxvf nginx-1.10.1.tar.gz 

cd nginx-1.10.1

./configure --prefix=/usr/local/nginx-1.10.1 --with-pcre=../pcre-8.38/

make

make install

cd /usr/local/

ln -s nginx-1.10.1 nginx

vim /etc/sysctl.conf 

sysctl -p

cd /root/software/

wget 'http://www.fping.org/dist/fping-3.13.tar.gz'

tar zxvf fping-3.13.tar.gz 

cd fping-3.13

./configure 

make install

rsync -av /usr/local/sbin/fping /usr/sbin/

chmod u+s /usr/sbin/fping 

yum -y install telnet

yum -y install nc

yum -y install nmap

yum -y install tcpdump

cd /usr/local/zabbix/etc/

rsync -av zabbix_server.conf  zabbix_server.conf-orig

rsync -av deploy@10.4.4.232:/usr/local/zabbix/etc/zabbix_server.conf .

rsync -av deploy@10.4.4.232:/usr/local/zabbix/share/zabbix/externalscripts/ /usr/local/zabbix/share/zabbix/externalscripts/

rsync -av deploy@10.4.4.232:/etc/zabbix/ /etc/zabbix/

cd

rsync -av deploy@10.4.4.232:/root/*.sh .

rsync -av deploy@10.4.4.232:/root/*.pl .

rsync -av deploy@10.4.4.232:/root/*.JSON .

cd /usr/local/nginx

mv conf conf.orig

rsync -av deploy@10.4.4.231:/usr/local/nginx/conf .

rsync -av deploy@10.4.4.231:/usr/local/php/etc/php-fpm.conf /root/

cd /etc/

cp /root/php-fpm.conf .

cd /usr/local/nginx/conf/vhosts/

mkdir /data/httpd -p

###############下面这条主要修改了里面的ip为本机的ip#############

vim  zabbix.conf 

rsync -av deploy@10.4.4.231:/data/httpd/ /data/httpd/

rsync -av   deploy@10.4.4.232:/etc/init.d/zabbix_server /etc/init.d/

sh  /root/set_zabbix_db_config.sh 

rm  -f /etc/zabbix/zabbix_server.conf

ln -s  /usr/local/zabbix/etc/zabbix_server.conf /etc/zabbix/

 /etc/init.d/zabbix_server start

mkdir /home/logs

chown nobody.nobody -R  /home/logs

/usr/local/nginx/sbin/nginx 

groupadd www

useradd -g www www

id www

/usr/local/nginx/sbin/nginx 

cd /data/httpd/zabbix

yum -y install cups-php.x86_64 graphviz-php.x86_64 php.x86_64 php-bcmath.x86_64 php-cli.x86_64 php-common.x86_64 php-dba.x86_64 php-devel.x86_64 php-embedded.x86_64 php-fpm.x86_64 php-gd.x86_64 php-imap.x86_64 php-intl.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mysql.x86_64 php-odbc.x86_64 php-pdo.x86_64 php-pear.noarch php-pecl-apc.x86_64 php-pgsql.x86_64 php-process.x86_64 php-pspell.x86_64 php-recode.x86_64 php-snmp.x86_64 php-soap.x86_64 php-tidy.x86_64 php-xml.x86_64 php-xmlrpc.x86_64 php-zts.x86_64 rrdtool-php.x86_64 uuid-php.x86_64 php-enchant.x86_64 php-pecl-apc-devel.i686 php-pecl-apc-devel.x86_64 php-pecl-memcache.x86_64 

/etc/init.d/php-fpm start

chkconfig --add  zabbix_server 

chkconfig  --level 2345 zabbix_server on

chkconfig --add  php-fpm

chkconfig  --level 2345 php-fpm on

chkconfig --list

###################加入nginx开机启动#############

vim /etc/rc.local 


您可能感兴趣的文档:

--结束END--

本文标题: zabbix 2.0.X安装

本文链接: https://lsjlt.com/news/50885.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

猜你喜欢
  • zabbix 2.0.X安装
    file /sbin/init #查看32/64位机器uname -r#查看linxu版本yum -y install gcc gcc-c++ autoconf httpd php mysql lrzsz ...
    99+
    2024-04-02
  • ProxySQL 2.0.X安装
    1. 设置proxysql 2.0.x的yum repocat <<EOF | tee /etc/yum.repos.d/proxysql.repo[proxysql_repo]name= Pr...
    99+
    2024-04-02
  • Cent OS 7.x 安装Zabbix
    系统环境:     VMware Workstation 12 Pro 12.5.0Cent OS 7.3_1611Zabbix 3.2---以下操作均以root身份操作---1:设置网卡为开机启动Shell>ifconfig1.  ...
    99+
    2023-01-31
    OS Cent Zabbix
  • Zabbix 3.0.3 LTS安装/配置/2.x升级
    环境准备:操作系统:CentOS 7或以上一.安装mysql1.建立Mysql账号groupadd mysqluseradd -s /sbin/nologin -g mysql -M mysql2.创建my...
    99+
    2024-04-02
  • Zabbix 安装
    系统:centos 6.8软件包:mysql-5.6.35.tar.g                   ngin...
    99+
    2024-04-02
  • Zabbix Yum 安装
    安装官方最新版zabbix2.4.1(最简单的yum方式)百度经验:jingyan.baidu.cozabbix 一款非常强大的监控软件,不仅可以基于SNMP监控各种网络设备,而且还可以监控linux wi...
    99+
    2024-04-02
  • CentOS6.x安装mysql5.6.x
    1、系统及安装说明    系统:CentOS6.x_x64      mysql:社区版5.6.21,开源数据库用的最多的my...
    99+
    2024-04-02
  • zabbix简易安装
    关闭selinux :                    vi  /etc/sel...
    99+
    2024-04-02
  • 如何安装zabbix
    小编给大家分享一下如何安装zabbix,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!Zabbix是一款能够监控各种网络参数以及服务器健康性和完整性的软件。Zabb...
    99+
    2023-06-27
  • [Linux7] zabbix 3.2.11安装
    zabbix 3.2.11关闭selinux[root@vm4 ~]$ vi /etc/selinux/config SELINUX=disabled1.安装lamp[root@vm4 ~]$ yum install -y mariadb[...
    99+
    2023-06-06
  • CentOS7.x安装php7.x或php.8.x
    CentOS 7.x默认安装的是PHP 5.x系列版本,想升级可以按照以下步骤,以PHP7.4为例: 移除旧版PHP: yum -y remove php* 添加EPEL (Extra Packa...
    99+
    2023-09-06
    php apache 开发语言
  • 部署zabbix监控mysql (一) 安装zabbix
    部署zabbix监控mysql(1)安装LAMP环境[root@localhost ~]# yum -y installmysql-server http php(2)安装zabbix web所需要的依赖包...
    99+
    2024-04-02
  • zabbix 3.2 编译安装
    安装平台 centos 6.8 2.6.32-642.el6.x86_64关闭防火墙和selinux软件版本 apr-1.5.2 apr-util-1.5.4 pcre-8.39 httpd-2....
    99+
    2024-04-02
  • Zabbix安装文档一
    一、生产环境:OS: CentOS release 6.8 (Final)Web服务器软件:Apache/2.2.15 (Unix)PHP运行环境:PHP 5.4.45 (cli) (built: Aug ...
    99+
    2024-04-02
  • Zabbix 3.2.6安装过程
    以3.2.6版本的Zabbix为例展开说明1、准备Lnmp环境。    本次准备的环境:      &nb...
    99+
    2024-04-02
  • CentOS 7.2安装zabbix 3.2
    系统环境:LNMPLinux: Centos 7.2Nginx: 1.10.3Mysql: 5.6.35PHP: 5.4.16安装zabbix-server1 Reposito...
    99+
    2024-04-02
  • zabbix-3.2安装实战
    ZABBIX安装简要说明蓝色为你需要注意下的,红色基本为你需要输入的命令行cat部分会进行VIM编辑 重点部分也用颜色标识了。先安装zabbix安装数据库mysql导入zabbix 数据库初始文件。配置相关...
    99+
    2024-04-02
  • zabbix安装和使用
    官方网站:www.zabbix.com系统版本:centos6.x软件版本:zabbix-2.4.7.tar.gz服务端IP=192.168.1.100客户端IP=192.168.1.200使用源代码安装:...
    99+
    2024-04-02
  • zabbix proxy 3.0 RPM安装
    安装前的准备:1、zabbix proxy自身需要安装mysql,可以导入mysql官网的mysql5.6的yum源,进行安装并启动数据库2、创建zabbix_proxy数据库mysql> CREAT...
    99+
    2024-04-02
  • Zabbix 3.0 安装部署
    zabbix软件包下载zabbix-3.0.1.tar.gzhttp://heanet.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/...
    99+
    2024-04-02
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作