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

Installation of zabbix monitoring system

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

1. Brief introduction to zabbix:

Zabbix is a completely open source tool that integrates features such as cacti and nagios

Attached: SNMP (udp 161udp 162)

Many network tools support this protocol, such as common route switching, common OS

It can be used as either the management side or the managed side.

There are roughly three versions of snmp protocol, v1 v2 v3.

The security of both v1 and v2 is poor, because the transmission is plaintext, and the authentication password of V3 is extracted with MD5/SHA.

Need algorithmic encryption

Many tools support the function of network management, but for non-network devices (operating systems), snmp can be left behind completely.

An insecure architecture for monitoring. So many tools are control side and agent architecture, and they have their own agent.

The main functions of Zabbix are:

Have the functions of common commercial monitoring software (host performance monitoring, network equipment performance monitoring, database, FTP)

General protocol monitoring, multiple alarm methods, detailed report chart drawing)

Support for automatic discovery of network devices and servers (this can be achieved by configuring auto-discovery server rules)

Support distributed, centralized display and management of distributed monitoring points, strong expansibility

Server provides a general interface (api function), and can develop and improve all kinds of monitoring by itself (write programs according to relevant interfaces)

Now, it is easy to write plug-ins, and you can customize the monitoring items and alarm level settings.

Data collection, supports snmp (including trapping and polling), IPMI, JMX, SSH, TELNET

Custom detection; custom frequency of data collection

Server / agent and client mode

Flexible triggers; very flexible problem thresholds can be defined, called triggers

Highly customizable alarm; send notification, customizable alarm upgrade, recipient, media type.

CPU load, memory usage, disk usage, network health, port monitoring, log monitoring, and so on.

Hardware monitoring: Zabbix IPMI Interface

System Monitoring: ZabbixAgent Interface

Java monitoring: Zabbix JMX Interface

Network device monitoring: Zabbix SNMP Interface

Application service monitoring: Zabbix Agent UserParameter

MySQL database monitoring: percona-monitoring-plulgins

URL monitoring: Zabbix Web monitoring

Description of key components of zabbix:

1) zabbix server: the core component responsible for receiving report information sent by agent, all configurations, statistics and operands

It is all organized and carried out by it.

2) database storage: dedicated to storing all configuration information, as well as data collected by zabbix

3) web interface: GUI interface of zabbix

4) proxy: optional component, which is often used in distributed environments with many monitoring nodes. Proxy server collects and forwards part of the data.

To server, it can reduce the pressure on server.

5) agent: deployed on the monitored host, responsible for collecting host local data such as cpu, memory, database, etc.

To server or proxy

In addition, zabbix server, proxy, and agent all have their own configuration files and log files, and important parameters need to be found here

The configuration in, which will be explained in detail later.

The approximate flow of a monitoring system is as follows:

Agentd needs to be installed on the monitored host, and it is responsible for collecting data regularly and sending it to the zabbix server side.

Zabbix server stores the data in the database, and zabbix web displays and draws the data at the front end. Here

Agentd collects data in two modes: active and passive:

Initiative: agent requests server to obtain a list of active monitoring items and actively submit the data that needs to be detected in the monitoring items to

Server/proxy

Passive: server requests agent to obtain data of monitoring items, and agent returns data.

Monitoring Architecture platform commonly used in zabbix

1. Server-agentd mode:

This is the simplest architecture and is often used in situations where there are few monitoring hosts.

2. Server-proxy-agentd mode:

This is commonly used in many machines, using proxy for distributed monitoring, effectively reducing the pressure on the server side.

The system architecture of zabbix:

Zabbix is an enterprise-level open source solution based on Web interface that provides distributed system monitoring and network monitoring capabilities.

Case. With the help of Zabbix, the heavy server management tasks of the operation and maintenance personnel can be easily reduced and the maintenance of the business system can be realized.

Continue to run. The following is a step by step introduction to the deployment and use of the Zabbix distributed monitoring system

Configure IP, DNS and gateway to ensure that you can connect to the server using the remote connection tool

Zabbix monitoring server: server of 192.168.130.76 # zabbix (if you want to monitor the local machine, you need to configure the local

Zabbix agent)

Zabbix agent monitored host: client of 192.168.130.78#zabbix (monitored end, need to configure Zabbix agent

I. deploy lnmp

1. Upload the required installation package

two。 Install nginx

(1) install dependency packages

20 tar zxf pcre-8.39.tar.gz 21 tar zxf zlib-1.2.8.tar.gz 22 yum-y install openssl-devel (2) install nginx 20 cd 19 tar zxf nginx-1.14.0.tar.gz 23 cd nginx-1.14.0/ 25. / configure-prefix=/usr/local/nginx1.14-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=/root/pcre-8.39-- with-zlib=/root/zlib-1.2.8-- with-http_ssl_module-- with-http_gzip_static_module 26 make & & make install 27 ln-s / usr/local/nginx1.14/sbin/nginx / usr/local/sbin/ (link command directory) 28 nginx (open ) 29 netstat-anpt | grep nginx (View API)

two。 Install php

(1) install dependency packages

31 cd 33 tar zxf libmcrypt-2.5.7.tar.gz 34 cd libmcrypt-2.5.7/ 35. / configure-- prefix=/usr/local/libmcrypt & & make & & make install 39 yum-y install libxml2-devel openssl-devel bzip2-devel libcurl-devel libjpeg-devel libpng-devel freetype-devel

(2) install php

36 cd 37 tar zxf php-5.6.27.tar.gz (decompress) 38 cd php-5.6.27/ 40 (compile and install). / 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

(3) optimize php

43 cp php.ini-production / etc/php.ini (copy configuration file to / etc) 44 cp sapi/fpm/init.d.php-fpm / etc/init.d/php-fpm (join startup directory) 45 chmod + x / etc/init.d/php-fpm (add executable permissions) 46 cp / usr/local/php5.6/etc/php-fpm.conf.default / usr/local/php5.6/etc/php- Fpm.conf (rename configuration file) 49 / etc/init.d/php-fpm start (startup) 50 netstat-anpt | grep 9000 (view port)

(4) you can use nginx to parse to php pages.

Modify nginx configuration file

47 vim / usr/local/nginx1.14/conf/nginx.conf location / {# 45 add root html; index index.php index.html index.htm;} location ~\ .php$ {# 65 uncomment, modify root html; fastcgi_pass 127.0.0.1 location 9000; fastcgi_index index.php Fastcgi_param SCRIPT_FILENAME / scripts$fastcgi_script_name; include fastcgi.conf;} restart nginx 48 nginx-s reload to create php page 51 vim / usr/local/nginx1.14/html/index.php

Browser test nginxIp

3. Install mysql

17 sh mysql.sh (install using script) netstat-anpt | grep mysql (View API)

II. Install Zabbix Serve

Upload the required installation package first

(2) install dependency packages

59 rz 61 tar zxf fping-3.12.tar.gz 62 cd fping-3.12/ 63. / configure & & make & & make install 64 whcih 65 which fping

71 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

(3) compile and install

67 cd 68 ls 69 tar zxf zabbix-3.2.1.tar.gz 70 cd zabbix-3.2.1/ 76. / 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 77 make & & make install (4) add system soft connection 79 ln-s / Usr/local/zabbix/bin/* / usr/local/bin/ 80 ln-s / usr/local/zabbix/sbin/* / usr/local/sbin/

(5) Zabbix Server configuration and startup

Create the Zabbix database and MySQL users:

Mysql-u root-p123create database zabbix character set utf8;grant all on zabbix.* to zabbix@'localhost' identified by '123.composit exit

Import Zabbix initial data:

Switch to the decompressed directory of zabbix

82 cd / root/ 83 cd zabbix-3.2.1/ 84 ls 85 cd database/mysql/

Perform zabbix initial data import

82 cd / root/ 83 cd zabbix-3.2.1/ 84 ls 85 cd database/mysql/ 90 mysql-u zabbix- p123.com-h localhost zabbix

< schema.sql 92 mysql -u zabbix -p123.com -h localhost zabbix < images.sql 93 mysql -u zabbix -p123.com -h localhost zabbix < data.sql 数据库查看一下 mysql -u root -p123use Zabbixshow tables; 编辑/usr/local/zabbix/etc/zabbix_server.conf: LogFile=/usr/local/zabbix/logs/zabbix_server.log #38PidFile= /usr/local/zabbix/logs/zabbix_server.pid #68DBHost=localhost #77DBPassword=123.com #111 授权密码DBSocket=/usr/local/mysql/mysql.sock #118DBPort=3306 #126FpingLocation=/usr/local/sbin/fping #463 创建所需目录 103 mkdir /usr/local/zabbix/logs 104 chown -R zabbix:zabbix /usr/local/Zabbix/ 启动 Zabbix Server: zabbix_server --help 解决方法: 在 ld.so.conf 中加入/usr/local/mysql/lib 106 find / -name libmysqlclient.so.20 107 vim /etc/ld.so.conf 添加/usr/local/mysql/lib/ 108 ldconfig 刷新一下再次执行 zabbix_server 启动 117 zabbix_server 118 netstat -anpt | grep 10051 添加开机启动脚本 128 cd zabbix-3.2.1/misc/init.d/fedora/core 129 cp zabbix_server /etc/init.d/ 130 vim /etc/init.d/zabbix_server 修改BASEDIR=/usr/local/Zabbix #22PIDFILE=/usr/local/zabbix/logs/$BINARY_NAME.pid #31 执行一下关闭zabbix 133 /etc/init.d/zabbix_server stop 134 netstat -antp | grep 10051 可以看到端口还开着,所以我们要杀进程,删除pid文件 157 rm -rf /usr/local/zabbix/logs/zabbix_server.pid 158 killall -9 zabbix_server 159 netstat -antp | grep 10051 现在再次开启一下,现已正常 (6)配置 zabbix web 页面 在安装目录将 frontends 拷贝到指定的 web root: 29 cd zabbix-3.2.1/frontends/ 30 cp -r php/ /usr/local/nginx1.14/html/Zabbix 浏览器测试:192.168.1.10/Zabbix 2. 可以看到这里有错误,我们需要去php配置文件里修改 32 vim /etc/php.ini 修改post_max_size = 16M #660max_execution_time = 300 #372max_input_time = 300 #382date.timezone = Asia/Shanghai #936always_populate_raw_post_data = -1 #70233 /etc/init.d/php-fpm restart #重启一下php 浏览器刷新一下,继续运行 3.现在看到因为浏览器解析不到主机名,所以我们要在MySQL数据库授权IP 1.解决方法 mysql -u root -p123 grant all on zabbix.* to zabbix@'192.168.1.%' identified by '123.com'; 4.解决之后浏览器刷新,继续 5. 解决方法 6.解决之后浏览器刷新,继续 7.登陆 8.登陆之后修改成中文 查看一下 9.解决 zabbix 绘图中出现中文乱码问题: 从 windows 下控制面板->

Font-> Select a Chinese font such as "italics"

Copy it to the fonts directory on the web side of zabbix, for example: / usr/local/nginx1.10/html/zabbix/fonts/

And change the TTF suffix to ttf

38 rz (upload simkai.ttf) 39 ls 40 cd / usr/local/nginx1.14/html/zabbix/fonts/ 41 ls

And move the previous font file DejaVuSans.ttf to another location

c. Then, modify the font configuration in the code include/defines.inc.php file to change the font settings from the

Replace DejaVuSans with simkai

44 vim / usr/local/nginx1.14/html/zabbix/include/defines.inc.php

Enter:% s/DejaVuSans/simkai/g in the last line mode of the vi editor

In this way, after modification, the Chinese text in the zabbix monitoring drawing will not appear garbled.

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

Servers

Wechat

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

12
Report