zabbix4.X版本
服务端安装:
SourceByrd's Weblog-https://note.t4x.org/basic/zabbix-monitor-configure/
012345678910111213 $ wget https://newcontinuum.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/4.0.3/zabbix-4.0.3.tar.gz$ tar zxf zabbix-4.0.3.tar.gz$ yum install net-snmp-devel libevent-devel curl-devel -y$ cd zabbix-4.0.3$ ./configure --prefix=/opt/zabbix-4.0.3 --enable-java --enable-server --enable-agent --with-net-snmp --with-libcurl --enable-proxy --with-mysql=/usr/local/mysql/bin/mysql_config$ make && make install$ ln -s /opt/zabbix-4.0.3/ /usr/local/zabbix$ cp misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server$ cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd$ groupadd zabbix -g 2767$ useradd zabbix -u 2767 -g zabbix -s /sbin/nologin$ chmod +x /etc/init.d/zabbix_*$ cp -r frontends/php/* /data/www/zabbix/$ chown -R www.root /data/www/zabbix/PHP安装:
SourceByrd's Weblog-https://note.t4x.org/basic/zabbix-monitor-configure/
0123456789 $ echo "/usr/local/lib" >>/etc/ld.so.conf$ echo "/opt/libiconv-1.9.2/lib" >>/etc/ld.so.conf$ echo "/usr/local/lib64" >>/etc/ld.so.conf$ echo "/usr/local/mysql/lib/" >>/etc/ld.so.conf$ ldconfig -v$ ./configure --enable-opcache --prefix=/opt/php-7.0.33 --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/opt/libiconv-1.9.2 --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp --disable-fileinfo --enable-mysqlnd --with-openssl --with-gettext --with-ldap --with-libdir=lib64$ sed -i "s/post_max_size = 8M/post_max_size = 16M/g" /usr/local/php/lib/php.ini$ sed -i "s/max_execution_time = 30/max_execution_time = 300/g" /usr/local/php/lib/php.ini$ sed -i "s/max_input_time = 60/max_input_time = 300/g" /usr/local/php/lib/php.ini$ sed -i "s/\;date.timezone =/date.timezone = PRC/g" /usr/local/php/lib/php.ini导入数据库:
SourceByrd's Weblog-https://note.t4x.org/basic/zabbix-monitor-configure/
012345 > create database zabbix default charset 'utf8';> grant all on zabbix.* to 'zabbix'@'127.0.0.1' identified by 'kIlaLeN69Lb8nQjP';> flush privileges;$ /usr/local/mysql/bin/mysql -uzabbix -p zabbix < schema.sql$ /usr/local/mysql/bin/mysql -uzabbix -p zabbix < images.sql$ /usr/local/mysql/bin/mysql -uzabbix -p zabbix < data.sqlNginx 配置:
SourceByrd's Weblog-https://note.t4x.org/basic/zabbix-monitor-configure/
0123456789101112131415161718192021 server {listen 8607;server_name localhost;location / {root /data/www/zabbix;index index.php index.html index.htm;}error_page 500 502 503 504 /50x.html;location = /50x.html {root /data/www/zabbix;}location ~ \.php {root /data/www/zabbix;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}}zabbix_server.conf
012345678910111213 $ egrep -v "#|^$" zabbix_server.confListenPort=10051LogFile=/data/logs/zabbix/server.logPidFile=/data/logs/zabbix/server.pidSocketDir=/data/logs/zabbixDBName=zabbixDBUser=zabbixDBPassword=kIlaLeN69Lb8nQjPStartDiscoverers=2DBSocket=/usr/local/mysql/tmp/mysql.sockDBPort=3306ListenIP=0.0.0.0Timeout=15LogSlowQueries=3000
zabbix_agentd.conf
SourceByrd's Weblog-https://note.t4x.org/basic/zabbix-monitor-configure/
0123456 $ egrep -v "#|^$" zabbix_agentd.confPidFile=/data/logs/zabbix/agentd.pidLogFile=/data/logs/zabbix/agentd.logServer=127.0.0.1ListenIP=127.0.0.1ServerActive=127.0.0.1Hostname=Zabbix server客户的安装:
0123456789101112 $ wget https://www.zabbix.com/downloads/4.0.0/zabbix_agent-4.0.0-centos7-amd64-openssl.tar.gz$ tar zxf zabbix_agent-4.0.0-centos7-amd64-openssl.tar.gz$ cd zabbix_agent-4.0.0-centos7-amd64-openssl$ cp bin/* /usr/local/bin/$ cp -ap conf/* /usr/local/etc/$ cp sbin/* /usr/local/sbin/$ egrep -v "^$|#" /usr/local/etc/zabbix_agentd.confPidFile=/var/log/zabbix/agentd.pidLogFile=/var/log/zabbix/agentd.logServer=server端IPListenIP=0.0.0.0ServerActive=server端IPHostname=Zabbix server
错误:
0123 Q:configure: error: Unable to use libevent (libevent check failed)A:yum install libevent-devel -yQ:configure: error: Curl library not foundA:yum install curl-devel -y
修改密码:
SourceByrd's Weblog-https://note.t4x.org/basic/zabbix-monitor-configure/
012 > use zabbix> update users set passwd=md5("zabbix") where userid='1';> flush privileges;
老版本配置:SourceByrd's Weblog-https://note.t4x.org/basic/zabbix-monitor-configure/
SourceByrd's Weblog-https://note.t4x.org/basic/zabbix-monitor-configure/SourceByrd's Weblog-https://note.t4x.org/basic/zabbix-monitor-configure/服务端安装:
0123456789101112131415161718192021222324252627 [root@bk tools]# tar zxf zabbix-3.2.4.tar.gz[root@bk tools]# cd zabbix-3.2.4/database/mysql/[root@bk mysql]# /usr/local/mysql/bin/mysql -uroot -p'123456'Server version: 5.6.35-log Source distributionmysql> create database zabbix;mysql> create user zabbix@'%';mysql> grant all on zabbix.* to zabbix@'%' identified by 'zabbix';[root@bk mysql]# /usr/local/mysql/bin/mysql -uroot -p'' zabbix < schema.sqlWarning: Using a password on the command line interface can be insecure.ERROR 1071 (42000) at line 86: Specified key was too long; max key length is 767 bytes[root@bk mysql]# grep "innodb_file_format\|innodb_file_per_table\|innodb_large_prefix" /etc/my.cnfinnodb_large_prefix = oninnodb_file_format=barracudainnodb_file_per_table=true[root@bk mysql]# /usr/local/mysql/bin/mysql -uroot -p'' zabbix < images.sql[root@bk mysql]# /usr/local/mysql/bin/mysql -uroot -p'' zabbix < data.sql[root@bk zabbix-3.2.4]# ./configure --prefix=/byrd/services/zabbix-3.2.4 --enable-server --enable-agent --with-net-snmp --with-libcurl --enable-proxy --with-mysql=/usr/local/mysql/bin/mysql_configconfigure: error: Invalid Net-SNMP directory - unable to find net-snmp-config[root@bk zabbix-3.2.4]# yum install net-snmp-devel -y[root@bk zabbix-3.2.4]# ln -s /byrd/services/zabbix-3.2.4 /usr/local/zabbix[root@bk zabbix-3.2.4]# cp misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server[root@bk zabbix-3.2.4]# cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd[root@bk zabbix-3.2.4]# groupadd zabbix[root@bk zabbix-3.2.4]# useradd zabbix -g zabbix -s /sbin/nologin[root@bk zabbix-3.2.4]# chmod +x /etc/init.d/zabbix_*[root@bk zabbix-3.2.4]# cp -r frontends/php /usr/local/nginx/html/[root@bk zabbix-3.2.4]# ln -s /usr/local/zabbix/sbin/zabbix_agentd /usr/local/sbin/[root@bk zabbix-3.2.4]# ln -s /usr/local/zabbix/sbin/zabbix_server /usr/local/sbin/
SourceByrd's Weblog-https://note.t4x.org/basic/zabbix-monitor-configure/
01234567891011 Minimum required size of PHP post is 16M (configuration option "post_max_size").Minimum required limit on execution time of PHP scripts is 300 (configuration option "max_execution_time").Minimum required limit on input parse time for PHP scripts is 300 (configuration option "max_input_time").Time zone for PHP is not set (configuration parameter "date.timezone").PHP option "always_populate_raw_post_data" must be set to "-1"[root@bk site]# grep "post_max_size\|max_execution_time\|max_input_time\|date.timezone\|always_populate_raw_post_data" /usr/local/php/lib/php.inimax_execution_time = 300max_input_time = 600date.timezone = PRCpost_max_size = 16Malways_populate_raw_post_data = -1
0123456789101112131415161718192021222324252627282930313233343536373839404142 [root@bk site]# /usr/local/mysql/bin/mysql -uzabbix -pzabbixWarning: Using a password on the command line interface can be insecure.ERROR 1045 (28000): Access denied for user 'zabbix'@'localhost' (using password: YES)mysql> drop user zabbix@'%';Query OK, 0 rows affected (0.01 sec)mysql> create user 'zabbix'@'localhost' identified by 'zabbix';Query OK, 0 rows affected (0.01 sec)mysql> grant all on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix';Query OK, 0 rows affected (0.01 sec)[root@bk site]# /usr/local/mysql/bin/mysql -uzabbix -pzabbixWarning: Using a password on the command line interface can be insecure.Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 10Server version: 5.6.35-log Source distributionCopyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> quit[root@bk site]# ln -s /usr/local/mysql/tmp/mysql.sock /tmp/mysql.sockPHP gettext off PHP gettext extension missing (PHP configuration parameter --with-gettext). Translations will not be available.[root@bk gettext]# cd /byrd/tools/php-5.6.29/ext/gettext/[root@bk gettext]# /usr/local/php/bin/phpize[root@bk gettext]# ./configure --with-gettext --with-php-config=/usr/local/php/bin/php-config[root@bk gettext]# sed -i 's#; extension_dir = "./"#extension_dir = "/byrd/services/php-5.6.29/lib/php/extensions/no-debug-non-zts-20131226/"#g' /usr/local/php/lib/php.ini[root@bk gettext]# echo 'extension = gettext.so' >>/usr/local/php/lib/php.ini18017:20170401:125846.521 using configuration file: /byrd/services/zabbix-3.2.4/etc/zabbix_server.conf18017:20170401:125846.533 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'localhost' (using password: NO)[root@bk tmp]# grep "DBPassword" /usr/local/zabbix/etc/zabbix_server.confDBPassword=zabbix
客户端安装:
SourceByrd's Weblog-https://note.t4x.org/basic/zabbix-monitor-configure/
01234567891011121314151617181920212223242526 [root@WWW tools]# wget http://www.zabbix.com/downloads/3.2.0/zabbix_agents_3.2.0.linux2_6_23.amd64.tar.gz[root@JSP abc]# tar zxf zabbix_agents_3.2.0.linux2_6_23.amd64.tar.gz[root@JSP abc]# tree.├── bin│ ├── zabbix_get│ └── zabbix_sender├── conf│ ├── zabbix_agentd│ │ ├── userparameter_examples.conf│ │ └── userparameter_mysql.conf│ └── zabbix_agentd.conf├── sbin│ └── zabbix_agentd[root@JSP abc]# cp sbin/zabbix_agentd /usr/local/sbin/[root@JSP abc]# cp conf/zabbix_agentd /usr/local/etc/cp: omitting directory `conf/zabbix_agentd'[root@JSP abc]# cp conf/zabbix_agentd.conf /usr/local/etc/mysql> show grants for zabbix@'%';+----------------------------------------------------------+| Grants for zabbix@% |+----------------------------------------------------------+| GRANT PROCESS, REPLICATION CLIENT ON *.* TO 'zabbix'@'%' |+----------------------------------------------------------+1 row in set (0.00 sec)老版本文档:
SourceByrd's Weblog-https://note.t4x.org/basic/zabbix-monitor-configure/
012345678910111213141516171819202122232425262728293031 mysql> create database zabbix;Query OK, 1 row affected (0.03 sec)mysql> create user zabbix@'%';Query OK, 0 rows affected (0.00 sec)mysql> grant all on zabbix.* to zabbix@'%' identified by 'zabbix';[root@Test tools]# wget http://ufpr.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.4.8/zabbix-2.4.8.tar.gz[root@Web3 mysql]# pwd/byrd/tools/zabbix-2.4.8/database/mysql[root@Web3 mysql]# /usr/local/mysql/bin/mysql -uroot -p zabbix < schema.sqlEnter password:[root@Web3 mysql]# /usr/local/mysql/bin/mysql -uroot -p zabbix < images.sqlEnter password:[root@Web3 mysql]# /usr/local/mysql/bin/mysql -uroot -p zabbix < data.sql[root@Web3 zabbix-2.4.8]# ./configure --prefix=/byrd/service/zabbix-2.4.8 --enable-server --enable-agent --with-net-snmp --with-libcurl --enable-proxy --with-mysql=/usr/local/mysql/bin/mysql_config[root@Web3 zabbix-2.4.8]# make && make install[root@Web3 zabbix-2.4.8]# ln -s /byrd/service/zabbix-2.4.8 /usr/local/zabbix[root@Web3 zabbix-2.4.8]# cp misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server[root@Web3 zabbix-2.4.8]# cp misc/init.d/aix/ debian/ fedora/ freebsd/ gentoo/ README suse/ tru64/ ubuntu/[root@Web3 zabbix-2.4.8]# cp misc/init.d/fedora/core/zabbix_agentd /etc/init.d/zabbix_agentd[root@Web3 zabbix-2.4.8]# /etc/init.d/zabbix_server startStarting zabbix_server: zabbix_server [16440]: user zabbix does not existzabbix_server [16440]: cannot run as root![FAILED][root@Web3 zabbix-2.4.8]# groupadd zabbix[root@Web3 zabbix-2.4.8]# useradd zabbix -g zabbix -s /sbin/nologin[root@Web3 zabbix-2.4.8]# /etc/init.d/zabbix_server startStarting zabbix_server: [ OK ][root@Web3 zabbix-2.4.8]# cp -r frontends/php /usr/local/nginx/html/zabbixconfigure: error: Unable to find "javac" executable in pathSourceByrd's Weblog-https://note.t4x.org/basic/zabbix-monitor-configure/
Starting zabbix_server: zabbix_server [28590]: ERROR: "JavaGateway" configuration parameter is not specified or empty
网管ipSourceByrd's Weblog-https://note.t4x.org/basic/zabbix-monitor-configure/
SourceByrd's Weblog-https://note.t4x.org/basic/zabbix-monitor-configure/
0 ./configure --prefix=/byrd/service/nginx/php-7.0.6 --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp --disable-fileinfo --enable-mysqlnd --with-openssl --with-mysql-sock=/usr/local/mysql/tmp/mysql.sock --enable-opcache --with-gettext
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!