In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "how to deploy zabbix monitoring server", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to deploy the zabbix monitoring server.
1. Zabbix operating architecture
Zabbix is an enterprise-class distributed open source monitoring solution. It can monitor the health of various servers, the stability of the network and the reliability of various application systems. When an exception occurs in monitoring, Zabbix can configure an alarm mechanism based on email, SMS, Wechat and other alarm mechanisms for any event through a flexible alarm policy. All of this can be configured and operated through the web interface provided by Zabbix, and the web-based front-end page also provides excellent reporting and data visualization capabilities. These functions and features make it very easy for our operation and maintenance personnel to build a powerful operation and maintenance monitoring and management platform.
The operating architecture of Zabbix is as follows:
As you can see from the running architecture diagram above, Zabbix is mainly composed of several components, which are as follows:
1 、 Zabbix Server
Zabbix Server is the core component of Zabbix and the core memory of all configuration information, statistics and operation data. It is mainly responsible for receiving reports and information sent by the client. At the same time, all configuration, statistics and configuration operation data are organized by it.
2 、 Zabbix Database Storage
It is mainly used to store data, and all configuration information and data collected by Zabbix are stored in the database. You can use MySQL, oracle, SQLite, and so on.
3. Zabbix Web interface
This is the GUI interface provided by Zabbix and usually (but not necessarily) runs on the same physical machine as Zabbix Server.
4. Zabbix Proxy proxy server
This is an optional component and is often used in distributed monitoring environments. The agent Server can collect new energy and availability data for Zabbix and send them to the Zabbix Server.
5. Zabbix Agent monitoring agent
Zabbix Agent is deployed on the monitored host, can actively monitor local resources and applications, and is responsible for collecting data and sending it to Zabbix Server or Zabbix Proxy.
II. Zabbix monitoring terminology
In the Zabbix monitoring system, there are some common terms, the following is a brief introduction.
1. Host (host)
Represents a server or network device to be monitored, which can be specified by IP or hostname.
2. Host group (host group)
Logical group of hosts: it contains hosts and templates, but there is no direct relationship between hosts and templates within the same host group; host groups are usually used when assigning monitoring permissions to users or user groups.
3. Monitoring items (item)
Represents a specific object for monitoring, such as monitoring the CPU load of the server, disk space, etc. Item is the core of data collection in Zabbix. Relative to a monitoring object, each item is identified by "key".
4. Trigger (trigger)
In fact, it is a monitoring threshold expression, which is used to evaluate whether the data received by a monitoring object is within a reasonable range; if the received data is greater than the threshold, the state of the trigger will change from "OK" to "Problem", and to "OK" when the received data is lower than the threshold.
5. Application set (Applications)
A logical collection of monitoring items.
6. Action (action)
Refers to a pre-defined method of handling problems that occur in monitoring, such as sending notifications, when actions are performed, how often they are performed, and so on.
7. Type of alarm medium (media)
Indicates the means of sending notification and the way of alarm notification, such as Email, Jabber or SMS, etc.
8. Template (template)
A set of implementations that can be applied to one or more hosts. A template usually contains application sets, monitoring items, triggers, graphics, aggregation graphics, auto-discovery rules, web scenarios, and so on; templates can be linked directly to a host.
Template is a difficulty and key point in learning zabbix. In order to achieve batch and automatic monitoring, monitoring items with the same characteristics are usually collected into the template and then directly referenced in the host to achieve rapid monitoring and deployment.
Deploy the Zabbix monitoring platform
The monitoring platform for Zabbix is relatively simple to deploy, as long as the LNMP or LAMP environment is ready.
I will start the configuration here by deploying the LNMP environment.
Note: I deploy all the services on the same server here, which is only a simple monitoring architecture, and zabbix proxy is not deployed.
Official links to Zabbix:
Zabbix 4.2 configuration document, home page of Zabbix official website.
Before doing the following deployment, please download the various source packages I provided and upload them to the Zabbix server.
1 、 Deploy and install nginx# unpack [root@zabbix] # tar zxf pcre-8.39.tar.gz-C / usr/src [root@zabbix ~] # tar zxf nginx-1.14.0.tar.gz-C / usr/src [root@zabbix ~] # tar zxf zlib-1.2.8.tar.gz-C / usr/src# installation dependency and nginx [root @ zabbix ~] # yum-y install openssl-devel pcre-devel [root@zabbix ~] # cd / usr/src / nginx-1.14.0/ [root@zabbix nginx-1.14.0] #. / configure-- prefix=/usr/local/nginx-- with-http_dav_module-- with-http_stub_status_module-- with-http_addition_module-with-http_sub_module-- with-http_flv_module-- with-http_mp4_module-- with-pcre=/usr/src/pcre-8.39-- with-zlib=/usr/src/zlib -1.2.8-- with-http_ssl_module-- with-http_gzip_static_module-- user=www-- group=www & & make & & make install# create and run users and command optimization [root@zabbix nginx-1.14.0] # useradd-M-s / sbin/nologin www [root@zabbix nginx-1.14.0] # cd [root@zabbix ~] # ln-s / usr/local/nginx/sbin/nginx / usr/local/sbin/ [root@zabbix ~ ] # vim / usr/local/nginx/conf/nginx.conf # Edit nginx configuration file server {listen 80 Location / {root html; index index.php index.html index.htm; # add index.php} # Note to remove the comment symbol location ~\ .php$ {root html; fastcgi_pass 127.0.0.1 index.php 9000; fastcgi_index index.php in the following paragraphs Fastcgi_param SCRIPT_FILENAME / scripts$fastcgi_script_name; include fastcgi.conf # modify this line} [root@zabbix ~] # nginx# start nginx# to write php homepage file [root@zabbix ~] # cat > / usr/local/nginx/html/index.php > EOF2, Deployment installation PHP# installation depends on [root@zabbix ~] # yum-y install libxml2-devel openssl-devel bzip2-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel# unpacking [root@zabbix ~] # tar zxf php-5.6.27.tar.gz-C / usr/src/ [root@zabbix ~] # tar zxf libmcrypt-2.5.7.tar.gz-C / usr/src# compilation and installation libmcrypt [root @ zabbix ~] # cd / usr/src/libmcrypt-2 .5.7 [root@zabbix libmcrypt-2.5.7] #. / configure-- prefix=/usr/local/libmcrypt & & make & & make install# compilation and installation PHP [root @ zabbix libmcrypt-2.5.7] # cd.. / php-5.6.27/ [root@zabbix php-5.6.27] #. / configure-- prefix=/usr/local/php5.6-- with-config-file-path=/etc-- with-mysql=mysqlnd-- with-mysqli=mysqlnd-- 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# Optimization PHP configuration File [root@zabbix php-5.6.27] # cp php.ini-production / etc/php.ini [root@zabbix Php-5.6.27] # cp sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm [root@zabbix php-5.6.27] # chmod + x / etc/init.d/php-fpm [root@zabbix php-5.6.27] # chkconfig-- add php-fpm [root@zabbix php-5.6.27] # chkconfig php-fpm on [root@zabbix php-5.6.27] # cp / usr/local/php5.6/etc/ Php-fpm.conf.default / usr/local/php5.6/etc/php-fpm.conf [root@zabbix php-5.6.27] # cd# optimizes its configuration file and launches [root@zabbix ~] # sed-I 's/pm.max_children = 5/pm.max_children = 50amp g' / usr/local/php5.6/etc/php-fpm.conf [root@zabbix ~] # sed-I 's/pm.start_servers = 2/pm.start _ servers = 5s/pm.max_spare_servers g'/ usr/local/php5.6/etc/php-fpm.conf [root@zabbix ~] # sed-I 's/pm.min_spare_servers = 1/pm.min_spare_servers = 5max g' / usr/local/php5.6/etc/php-fpm.conf [root@zabbix ~] # sed-I 's/pm.max_spare_servers = 3/pm.max_spare_servers = 35max g' / usr/local/php5.6 / etc/php-fpm.conf [root@zabbix ~] # systemctl start php-fpm [root@zabbix ~] # netstat-anpt | grep 9000
The client accesses the defined php page, as follows:
4. Install and configure MySQL database
If you need to customize the installation of MySQL database, you can refer to the blog article: building MySQL Database based on centos7
For convenience here, I use a script to quickly install a MySQL database, if necessary, you can download and use (Note: the root password of the installed MySQL is "123").
# after uploading the package provided by me, execute the following command [root@zabbix ~] # sh mysql.sh # wait for some time, and the following prompt appears, which means that the database has been deployed successfully, Starting MySQL. SUCCESS! Mysql: [Warning] Using a password on the command line interface can be insecure.# create zabbix library and user [root@zabbix] # mysql-uroot-p123 # Log in to MySQLmysql > create database zabbix character set utf8;mysql > grant all on zabbix.* to zabbix@'localhost' identified by '123.com Mysql > exit5, Deploy Zabbix service # unpack [root@zabbix ~] # tar zxf fping-3.12.tar.gz-C / usr/src [root@zabbix ~] # tar zxf zabbix-3.2.1.tar.gz-C / usr/src# install fping command [root@zabbix ~] # cd / usr/src/fping-3.12/ [root@zabbix fping-3.12] #. / configure & & make & & make install [root@zabbix fping-3.12] # cd.. / Zabbix-3.2.1/ [root@zabbix zabbix-3.2.1] # useradd-M-s / sbin/nologin zabbix [root@zabbix zabbix-3.2.1] # chown zabbix:zabbix / usr/local/sbin/fping [root@zabbix zabbix-3.2.1] # yum-y install net-snmp net-snmp-devel curl-devel java-1.8.0-openjdk java-1.8.0-openjdk-devel OpenIPMI-devel libssh3-devel [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: convenient for subsequent monitoring of tomcat programs #-- with-openipmi: users can use IPMI to monitor the physical characteristics of the server Such as temperature, voltage, fan working status, power supply and so on. [root@zabbix ~] # ln-s / usr/local/zabbix/bin/* / usr/local/bin/ [root@zabbix ~] # ln-s / usr/local/zabbix/sbin/* / usr/local/sbin/# imports zabbix data into MySQL. Note the order of import. If a prompt is returned after import, it can be ignored. Because the imported command displays the password on the terminal [root@zabbix ~] # cd / usr/src/zabbix-3.2.1/database/mysql/ [root@zabbix mysql] # mysql-u zabbix- p123.com-h localhost zabbix
< schema.sql [root@zabbix mysql]# mysql -u zabbix -p123.com -h localhost zabbix < images.sql [root@zabbix mysql]# mysql -u zabbix -p123.com -h localhost zabbix < data.sql [root@zabbix ~]# chown -R zabbix:zabbix /usr/local/zabbix/6、优化zabbix并启动#修改zabbix配置文件[root@zabbix mysql]# sed -i 's/# ListenPort=10051/ListenPort=10051/g' /usr/local/zabbix/etc/zabbix_server.conf[root@zabbix mysql]# sed -i 's/LogFile=\/tmp\/zabbix_server.log/LogFile=\/usr\/local\/zabbix\/logs\/zabbix_server.log/g' /usr/local/zabbix/etc/zabbix_server.conf[root@zabbix mysql]# sed -i 's/# PidFile=\/tmp\/zabbix_server.pid/PidFile=\/usr\/local\/zabbix\/logs\/zabbix_server.pid/g' /usr/local/zabbix/etc/zabbix_server.conf[root@zabbix mysql]# sed -i 's/# DBHost=localhost/DBHost=localhost/g' /usr/local/zabbix/etc/zabbix_server.conf[root@zabbix mysql]# sed -i 's/# DBPassword=/DBPassword=123.com/g' /usr/local/zabbix/etc/zabbix_server.conf[root@zabbix mysql]# sed -i 's/# DBSocket=\/tmp\/mysql.sock/DBSocket=\/usr\/local\/mysql\/mysql.sock/g' /usr/local/zabbix/etc/zabbix_server.conf[root@zabbix mysql]# sed -i 's/# DBPort=3306/DBPort=3306/g' /usr/local/zabbix/etc/zabbix_server.conf[root@zabbix mysql]# sed -i 's/# FpingLocation=\/usr\/sbin\/fping/FpingLocation=\/usr\/local\/sbin\/fping/g' /usr/local/zabbix/etc/zabbix_server.conf[root@zabbix mysql]# sed -i 's/# LogSlowQueries=0/LogSlowQueries=3000/g' /usr/local/zabbix/etc/zabbix_server.conf#如果数据库名称和数据库用户没有和我创建的一样,那么还需要更改以下两项#DBName=zabbix #数据库名称#DBUser=zabbix #登录数据库的用户名[root@zabbix mysql]# echo "/usr/local/mysql/lib" >> / etc/ld.so.conf [root@zabbix mysql] # ldconfig # Refresh the above changes [root@zabbix ~] # mkdir / usr/local/zabbix/logs [root@zabbix zabbix] # chown-R zabbix:zabbix / usr/local/zabbix [root@zabbix ~] # cd / usr/src/zabbix-3.2.1/misc/init.d/fedora/core [root@zabbix core] # cp zabbix_agentd / etc/init.d/ [root@zabbix core] # cp Zabbix_server / etc/init.d/ [root@zabbix core] # sed-I's local =\ / usr\ / local/BASEDIR=\ / usr\ / local\ / zabbix/g' / etc/init.d/zabbix_server [root@zabbix core] # sed-I's etc/init.d/zabbix_server PIDFILES =\ / tmp\ / $BINARY_NAME.pid/PIDFILE=\ / usr\ / local\ / zabbix\ / logs\ / $BINARY_NAME.pid/g' / etc/init.d/zabbix_server [root@zabbix logs] # / etc/init.d/zabbix_server start # start zabbix You can also execute "zabbix-server" to start # if the script startup does not report an error, but the port is not listening, you can first use the script stop Then start [root@zabbix logs] # netstat-anpt | grep 10051tcp 00 0.0.0.0netstat 10051 0.0.0.0anpt * LISTEN 89911/zabbix_server # prepare the zabbix web page file [root@zabbix ~] # cd / usr/src/zabbix-3.2.1/frontends/ [root@zabbix frontends] # cp-r php/ / usr/local/nginx/html/zabbix7, client accesses the nginx agent to configure zabbix
Just visit the IP/zabbix of the Nignx server, which automatically jumps to the following page:
Oh ho, there seems to be some error message, as follows:
The above error message is probably that the configuration item of php does not meet its requirements, so change the configuration file of php! As follows:
# change the php configuration file [root@zabbix ~] # sed-I 's/post_max_size = 8M/post_max_size = 16m sed g' / etc/php.ini [root@zabbix ~] # sed-I 's/max_execution_time = 30/max_execution_time = 300max g' / etc/php.ini [root@zabbix ~] # sed-I 's/max_input_time = 60/max_input_time = 300gamg' / etc/php. Ini [root@zabbix ~] # sed-I's / Date.timezone = / date.timezone = Asia\ / Shanghai/g' / etc/php.ini [root@zabbix ~] # sed-I's ram [alwayspopulatedrawbones postcards data =-1/always_populate_raw_post_data =-1CompGN / etc/php.ini [root@zabbix ~] # systemctl restart php-fpm # restart php service
Refresh the browser page as follows (all "OK"):
Enter the appropriate information, database listening IP and port and other information:
Keep the default here, click next:
After confirming that it is correct, click next:
Oh ho, another error, indicating that the configuration file cannot be created, let's manually download the configuration file and upload it to the specified directory, then click download.
# upload the downloaded configuration file to this directory [root@zabbix ~] # ls / usr/local/nginx/html/zabbix/conf/zabbix.conf.php/usr/local/nginx/html/zabbix/conf/zabbix.conf.php
Then refresh the page as follows, click "finish" to finish:
Enter the zabbix username and password to log in (default username: admin, password: zabbix):
Change the default language to Chinese:
8. Solve the problem of Chinese garbled codes in subsequent chart making [root@zabbix] # cd / usr/local/nginx/html/zabbix/fonts/ # switch to this directory [root@zabbix fonts] # rz # to upload the simkai.ttf file provided by me You can also look for the file [root@zabbix fonts] # ls # in our windows font to confirm that "simkai.ttf" in this directory DejaVuSans.ttf simkai.ttf# modifies the following file [root@zabbix fonts] # sed-I 'usr/local/nginx/html/zabbix/include/defines.inc.php
After the above configuration, when making charts in the future, there will be no garbled codes in Chinese.
At this point, I believe you "how to deploy zabbix monitoring server" have a deeper understanding, might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.