Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Zabbix 2.0.X installation

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

File / sbin/init # View 32 Universe 64-bit machines

Uname-r # View linxu version

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*

# configure nginx

* two ports are bound here, which is usually only 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

=

# configure php

Cp / etc/php.ini php.ini.bak

Sed-I "sbank date. Timezone = / date.timezone = Asia\ / Shanghai/g" / etc/php.ini

Sed-I "s#max_execution_time = 30#max_execution_time = 300g" / 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 = 300g" / 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

=

# configure mysql

Mysql# enters mysql

* user zabbix_uesr password is zabbix (followed by zabbix login username and password)

Insert into mysql.user (Host,User,Password) values ("localhost", "zabbix_user", password)

("zabbix"))

Flush privileges;# refresh permissions

Mysql-u root

* create a database named zabbix

* in order to support Chinese, the database character set uses utf8, and you can use Chinese names when defining adding devices.

* users and passwords that authorize the zabbix system to access the Mysql database. Zabbixdb.* refers to accessing all tables in the zabbixdb database.

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

=

# configure 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)

After the guidance, disable those hosts first.

Update hosts set status=1 where status=0

Restart 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 Utility / 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

# the following item mainly modifies the ip in it to the native 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

# join nginx and boot up #

Vim / etc/rc.local

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report