In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
I. Overview of Zabbix
1) introduction to Zabbix
Zabbix is an enterprise-level open source solution based on WEB interface that provides distributed system monitoring and network monitoring capabilities.
Zabbix can monitor various network parameters to ensure the safe operation of the server system, and provides a flexible notification mechanism to enable system administrators to quickly locate / solve various problems.
Zabbix consists of two parts, zabbix server and optional component zabbix agent.
Zabbix server can provide remote server / network status monitoring, data collection and other functions through SNMP,zabbix agent,ping, port monitoring and other methods. It can run on platforms such as Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X.
2) advantages and disadvantages
Advantages of Zabbix:
1 supports distributed monitoring
(2) it has its own drawing function, which can obtain numerical data and generate graphs automatically.
3 Web configuration mode, easy to operate and use. It is very fast to add monitoring items or machines.
When there is an alarm, no matter in any interface, a small window will pop up to give an alarm, and there will be an alarm sound prompt at the same time, at the same time, you can quickly check the monitoring items.
5 it comes with rich built-in functions, and it also supports the call of scripts and nagios scripts.
6 when there is a problem, you can automatically execute the command remotely (you need to set the execution permission on agent)
Disadvantages of Zabbix:
1 it is not convenient to modify in batches, it can be assisted by database.
2 after in-depth, there are very few Chinese materials, most of the questions need to see the official documents and forums.
(3) lack of data summary function, if you can't view the average value of a set of servers, you can consider secondary development.
4 compared with cacti, zabbix has poorer drawing function and more complex traffic acquisition.
4) functions of Zabbix
Zabbix has the following features:
1) have the functions of common commercial monitoring software (host performance monitoring, network equipment performance monitoring, database, performance monitoring, FTP and other general protocol monitoring, multiple alarm methods, detailed report chart drawing); 2) support automatic discovery of network devices and servers (which can be achieved by configuring automatic discovery server rules) 3) support automatic discovery (low discovery) key to achieve batch monitoring of dynamic monitoring items (need to write scripts); 4) support distributed, centralized display and management of distributed monitoring points; 5) strong expansibility, server provides a general interface (api function), can develop and improve all kinds of monitoring (write programs according to related interfaces) easy to write plug-ins, you can customize monitoring items, alarm level settings 6) Server / proxy and client modes; flexible triggers; very flexible problem thresholds can be defined, called triggers; highly customizable alarms; sending notifications, customizable alarm upgrades, recipients, media types. CPU load, memory usage, disk usage, network condition, port monitoring, log monitoring, etc. 4) the monitoring principle of Zabbix
Zabbix collects data through the cswab mode, and displays and configures the data on the web side through the bplink mode.
Controlled side: the host collects data by installing agent, and the network equipment collects data by snmp.
Server side: collect the data sent by snmp and agent, write it to the database, and then display it on the front end of web through php+nginx (or apache)
5) the composition of Zabbix
Zabbix is mainly composed of the following important components, and the specific functions are as follows:
Zabbix Server: the core component responsible for receiving Agent report information, which organizes all configuration, data statistics and data operations; Database strongage: responsible for storing all configuration information and collected data; Web interface: it is the GUI interface of zabbix, usually running on the same host as Zabbix Server Proxy: it is an optional component and is often used in distributed monitoring environment. Proxy Server collects part of the data and then forwards it to Server, which can reduce the pressure on Server. Agent: deployed on the monitored host (client), is responsible for collecting data from the monitored host, such as CPU, memory, database, etc., and then sending it to the server or proxy. 6) Zabbix running process
1) Agent needs to be installed on the monitored host. She is responsible for collecting data on a regular basis and sending it to zabbix server.
2) zabbix server stores the data in the database, and zabbix web displays and draws the data at the front end.
Agent collects data in two modes: active and passive:
Initiative: agent requests server to obtain a list of active monitoring items, and actively submits the monitoring data detected inward to server/proxy
Passive: server requests agent to obtain data of monitoring items, and agent returns data
Passive: compare performance consumption.
In passive mode, zabbix server (or proxy) asks about agent data, such as the load of CPU, and then zabbix agent sends back the result. Zabbix server periodically requests data from agent. The biggest problem with this mode is that it increases the workload of zabbix server, which is also the default working mode.
Initiative: efficient, but data may be missing.
Active mode is that zabbix agent actively collects data and returns it to zabbix server, which no longer needs zabbix serve intervention, so active mode can reduce the pressure of zabbix server to some extent.
7) Zabbix monitoring architecture
In the actual production environment, Zabbix is divided into three architectures according to external factors such as network environment and monitoring scale, as shown in the figure:
(1) server-client architecture (direct connection)
Server-client architecture is the simplest architecture of Zabbix. The monitoring computer and the monitored computer can exchange data directly between zabbix server and zabbix agentd without any agent. It is suitable for the monitoring environment where the network is simple and there are few devices.
(2) master-node-client architecture (node architecture)
Master-node-client architecture is the most complex monitoring architecture of Zabbix, which is suitable for large-scale environments with more devices and across networks and computer rooms. Each node is also a server. You can connect to proxy or client directly under node. Node has its own configuration file and database. What it needs to do is to synchronize the configuration information with the monitoring data item master. When master fails or is damaged, node can guarantee the integrity of the architecture.
(3) server-proxy-client architecture (proxy architecture)
Proxy is a bridge between server and client, proxy itself does not have a front end, and it does not store data itself, but temporarily stores the data sent by agentd, and then submits it to server. This architecture is often compared with the master-node-client architecture, and is generally suitable for the monitoring of medium-sized network architecture across computer rooms and networks.
Second, build the LNMP environment
Because deploying Zabbix requires an environment that uses LNMP, it needs to be deployed in advance. For the detailed project of its deployment, you can refer to Building LNMP, and then the explanation of the LNMP command will not be explained in detail!
1) install Nginx
Download the nginx package
[root@zabbix ~] # yum-y install pcre-devel openssl-devel zlib-devel [root@zabbix ~] # tar zxf nginx-1.14.0.tar.gz & & cd nginx-1.14.0 [root@zabbix nginx-1.14.0] #. / configure & & make & & make install// because you just use nginx to provide a simple web page to start! [root@zabbix ~] # ln-s / usr/local/nginx/sbin/nginx / usr/local/sbin/// create a symbolic link, and later start 2) install PHP
Download the PHP package
[root@zabbix ~] # yum-y install freetype-devel libpng-devel libjpeg-devel libxml2-devel bzip2-devel libcurl-devel// depends on [root@zabbix ~] # tar zxf libmcrypt-2.5.7.tar.gz & & cd libmcrypt-2.5.7 [root@zabbix libmcrypt-2.5.7] #. / configure-- prefix=/usr/local/libmcrypt & & make & & make install// installation of libmcrypt [root @ zabbix ~] # tar zxf php-5 .6.27.tar.gz & & cd php-5.6.27 [root@zabbix php-5.6.27] #. / configure-- prefix=/usr/local/php5.6\-- with-config-file-path=/etc-- with-mysql=/usr/local/mysql\-- with-mysqli=/usr/local/mysql/bin/mysql_config\-- with-mysql-sock=/usr/local/mysql/mysql.sock\-- with-gd-- with-iconv -with-libxml-dir=/usr-- with-mhash-- with-mcrypt=/usr/local/libmcrypt\-- with-config-file-scan-dir=/etc/php.d-- with-bz2-- with-zlib\-- with-freetype-dir-- with-png-dir-- with-jpeg-dir-- enable-xml\-- enable-bcmath-- enable-shmop-- enable-sysvsem-- enable-inline-optimization\-- enable-mbregex-- enable-fpm-- Enable-mbstring-- enable-ftp\-- enable-gd-native-ttf-- with-openssl-- enable-pcntl-- enable-sockets\-- with-xmlrpc-- enable-zip-- enable-soap-- without-pear-- with-gettext\-- enable-session-- with-curl & & make & & make install// compilation and installation php [root @ zabbix ~] # cp / root/php-5.6.27/php.ini-production / etc/php.ini [root@ Zabbix ~] # cp / root/php-5.6.27/sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm [root@zabbix ~] # chmod + x / etc/init.d/php-fpm [root@zabbix ~] # chkconfig-add php-fpm [root@zabbix ~] # cd / usr/local/php5.6/etc [root@zabbix etc] # cp php-fpm.conf.default php-fpm.conf [root@zabbix etc] # sed-I's # Pid = run/php-fpm.pid#pid = run/php-fpm.pid#g' php-fpm.conf [root@zabbix etc] # sed-I 's/listen = 127.0.0.1:9000/listen = 0.0.0.0V 9000 php-fpm.conf [root@zabbix etc] # sed-I' s/pm.max_children = 5/pm.max_children = 50 GB php-fpm.conf [root@zabbix etc] # sed-I's / Pm.start_servers = 2/pm.start_servers = 5gamma g 'php-fpm.conf [root@zabbix etc] # sed-I' s/pm.min_spare_servers = 1/pm.min_spare_servers = 5gamma g 'php-fpm.conf [root@zabbix etc] # sed-I' s/pm.max_spare_servers = 3/pm.max_spare_servers = 35gamma g 'php-fpm.conf [root@zabbix etc] # systemctl start php-fpm [root@zabbix Etc] # ss-lnt | grep 9000LISTEN 0 128 *: 9000 *: * / ensure that PHP starts successfully 3) configure nginx to connect with PHP [root@zabbix] # vim / usr/local/nginx/conf/nginx.conf location\ .php$ {root html Fastcgi_pass 127.0.0.1 fastcgi_pass 9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME / scripts$fastcgi_script_name; include fastcgi.conf / / modify this line} [root@zabbix ~] # echo-e "" > / usr/local/nginx/html/index.php [root@zabbix ~] # nginx-t nginx: the configuration file / usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file / usr/local/nginx/conf/nginx.conf test is successful [root@zabbix ~] # nginx
Access test
4) install mysql database
Download mysql database software is provided with one click to install the mysql script to install, directly execute the script!
[root@zabbix ~] # ls | grep mysqlmysql-5.7.22-linux-glibc2.12-x86_ 64.tar.gzmysql.sh [root @ zabbix ~] # sh mysql.sh//, the password of database user root is 123
Here do not test the link between PHP and mysql, have confidence in the LNMP you have built!
Third, install Zabbix
Download the Zabbix package
[root@zabbix ~] # tar zxf fping-3.12.tar.gz & & cd fping-3.12 [root@zabbix fping-3.12] #. / configure & & make & & make install// compile and install fping Enable Zabbix to support the auto-discovery feature [root@zabbix fping-3.12] # groupadd zabbix [root@zabbix fping-3.12] # useradd zabbix-M-g zabbix [root@zabbix fping-3.12] # chown zabbix:zabbix / usr/local/sbin/fping// to create zabbix users so that they can use the fping command [root@zabbix ~] # yum-y install net-snmp net-snmp-devel curl-devel OpenIPMI-devel libssh3-devel java-devel// to install zabbix dependencies [root@zabbix] # tar zxf zabbix-3.2.1.tar.gz & & cd zabbix-3.2.1 [root@zabbix zabbix-3.2.1] #. / configure-- prefix=/usr/local/zabbix-- enable-server\-- enable-agent-- enable-java-- with-mysql=/usr/local/mysql/bin/mysql_config\-- with-net-snmp-- with-libcurl-- with-openipmi & & make & & make install//-- Enable-java: easy to monitor the use of tomcat programs in the future / /-- with-openipmi: enables it to monitor the hardware information of the device [root@zabbix ~] # ln-s / usr/local/zabbix/bin/* / usr/local/bin/ [root@zabbix ~] # ln-s / usr/local/zabbix/sbin/* / usr/local/sbin/// create symbolic links for common zabbix commands [root@zabbix ~] # mysql-u root-p123mysql > create database zabbix character set utf8 Mysql > grant all privileges on zabbix.* to 'zabbix'@'192.168.1.%' identified by' 123.com zabbix database / create zabbix database and user [root@zabbix] # cd / root/zabbix-3.2.1/database/mysql/ [root@zabbix mysql] # mysql-uzabbix-p123.com-h 192.168.1.8 zabbix
< schema.sql[root@zabbix mysql]# mysql -uzabbix -p123.com zabbix -h 192.168.1.8 < images.sql[root@zabbix mysql]# mysql -uzabbix -p123.com zabbix -h 192.168.1.8 < data.sql //进入相应的目录导入相应的数据库文件//切记需按照顺序导入,否则可能会出现意外[root@zabbix mysql]# cd /usr/local/zabbix/etc[root@zabbix etc]# egrep -v '^#|^$' zabbix_server.confLogFile=/tmp/zabbix_server.logPidFile=/tmp/zabbix_server.pidDBHost=192.168.1.8DBName=zabbixDBUser=zabbixDBPassword=123.comDBPort=3306Timeout=4FpingLocation=/usr/sbin/fping //fping(自动发现)文件路径LogSlowQueries=3000//以上是修改完成的配置文件[root@zabbix etc]# find / -name libmysqlclient.so/usr/local/mysql/lib/libmysqlclient.so[root@zabbix etc]# echo "/usr/local/mysql/lib" >> / etc/ld.so.conf// the API file path for adding libmysqlclinet [root@zabbix etc] # ldconfig / / mainly searches the directories listed in the default search directories / lib and / usr/lib and the dynamic library configuration file / etc/ld.so.conf to search out shareable dynamic link libraries (such as lib*.so*), and then create connection and cache files needed for dynamic loader (ld.so). [root@zabbix etc] # find /-name mysql.sock/usr/local/mysql/mysql.sock [root@zabbix etc] # ln-s / usr/local/mysql/mysql.sock / tmp/// add the mysql.sock file to the tmp directory Otherwise, an error will occur at startup [root@zabbix etc] # cd / root/zabbix-3.2.1/ [root@zabbix zabbix-3.2.1] # cp misc/init.d/fedora/core/zabbix_server / etc/init.d/ [root@zabbix zabbix-3.2.1] # chmod + x / etc/init.d/zabbix_server [root@zabbix zabbix-3.2.1] # sed-I "s#BASEDIR=/usr/local#BASEDIR=/usr / local/zabbix#g "/ etc/rc.d/init.d/zabbix_server// changes the installation path of zabbix in the zabbix system script [root@zabbix zabbix-3.2.1] # systemctl daemon-reload [root@zabbix zabbix-3.2.1] # / etc/init.d/zabbix_server startReloading systemd: [OK] Starting zabbix_server (via systemctl) : [OK] [root@zabbix zabbix-3.2.1] # ss-lnt | grep 10051LISTEN 0128 *: 10051 *: * / / add as system service And start to make sure the port is listening. The default is 10051 ps / if startup fails to view / tmp/zabbix_server.log the log content [root@zabbix ~] # cp-r / root/zabbix-3.2.1/frontends/php/ / usr/local/nginx/html/zabbix// copy the web page directory of zabbix to the root directory of nginx web page [root@zabbix ~] # ps-ef | grep php// can see that the user running php program is nobody [root] according to the query results. @ zabbix ~] # chown-R nobody:nobody / usr/local/nginx/html/zabbix/// so you need to make sure that the user running PHP has absolute permissions to this directory or you will not be able to change the data
Client access test:
Modify the configuration file of php according to the warning message prompted
[root@zabbix ~] # sed-I 's/post_max_size = 8M/post_max_size = 16m sed g' / etc/php.ini [root@zabbix ~] # sed-I 's/max_input_time = 60/max_input_time = 300 max g' / etc/php.ini [root@zabbix ~] # sed-I 's/max_execution_time = 30/max_execution_time = 300max g' / etc/php.ini [root@zabbix ~] # echo-e "date.timezone = Asia/Shanghai" > > / etc/php.ini [root@zabbix ~] # echo-e "always_populate_raw_post_data =-1" > > / etc/php.ini [root@zabbix ~] # systemctl restart php-fpm// restart php Make it load the configuration file
Continue to visit the web page, as shown in the figure:
From this we can see that the interface has become Chinese!
However, we need to pay attention to the problem of Chinese garbled code in zabbix, and we need to use the following methods to modify the problem of Chinese garbled code!
[root@zabbix ~] # ls | grep SIMKAI.TTFSIMKAI.TTF [root@zabbix ~] # sed-I's Unip DejaVuSansampsimkai.ttfUnip g' / usr/local/nginx/html/zabbix/include/defines.inc.php [root@zabbix ~] # mv SIMKAI.TTF / usr/local/nginx/html/zabbix/fonts/simkai.ttf
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.