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 Monitoring platform deployment detail document

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

Share

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

Introduction of monitoring system

One: monitoring introduction

1. Introduction of monitoring software:

Use SNMP protocol to obtain host CPU, memory, disk, network card traffic and other data.

Use a script to store the obtained SNMP data in the database, and then use a software called MRTG to draw charts based on the obtained data to analyze the changes in the data. MRTG (Multi Router Traffic Grapher), as its name implies, was originally designed to monitor the network.

Link traffic load. It can use SNMP to get the traffic information of the device, draw a chart according to this information and save it as a picture in PNG format, and then display these PNG pictures to the user as a HTML page.

However, the page and chart curves displayed by MRTG are relatively simple, it can only draw the change curve of at most two data in a picture, and because it is a static picture in PNG format, it cannot be displayed in detail at a certain time. In order to solve this problem, people have developed

RRDTOOL tool.

However, it is troublesome to draw directly with RRD TOOL. At the same time, it is obviously unrealistic for today's data centers to extract, draw and monitor hundreds of devices one by one.

Cacti is a set of monitoring graphic analysis tools based on PHP, MySQL, SNMP and RRD Tool. Cacti uses polling to send data requests from the main server to the device to obtain the status data information on the device. If the number of devices continues to increase, the polling process will be very time-consuming, and the polling results can not immediately reflect the status of the device. Cacti monitoring focuses on the presentation of data.

But do not pay attention to the feedback after the abnormal data. If there is an anomaly in the data of the device at 3 o'clock in the morning, there is no alarm mechanism that can make us abnormal unless the monitor finds the abnormal change in front of the screen.

Nagios is an open source free network monitoring and alarm service, which can effectively monitor the host status of Windows, Linux and Unix, network settings such as switches, routers and firewalls, printers, network projections, network cameras and other devices. Send an email when the system or service status is abnormal

Or SMS alarm to notify the operation and maintenance personnel as soon as possible, and send out normal email or SMS notification after the status is restored. Nagios has a perfect plug-in function, which can be easily extended according to the application service.

Nagios can already support the monitoring of a cloud technology platform composed of tens of thousands of servers or thousands of network devices.

Dynamic operation and maintenance technology features in equipment and human resources to reduce costs. However, Nagios cannot aggregate data from multiple identical application clusters, nor can it monitor the migration and recovery of special nodes in the cluster.

A new monitoring service is designed according to this requirement, which is called Ganglia.

Ganglia is an open source cluster monitoring project launched by UC Berkeley, designed to measure thousands of nodes. The core of Ganglia consists of gmond, gmetad, and a Web front end. It is mainly used to monitor system performance, such as CPU, memory, hard disk utilization, Imax O load, network.

Through the curve, it is easy to see the working status of each node, which plays an important role in reasonably adjusting and allocating system resources and improving the overall performance of the system. At present, it is the official recommendation service for monitoring HADOOP.

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 was created by Alexei Vladishev and is currently continuously developed and supported by Zabbix SIA.

Zabbix is an enterprise-level distributed open source monitoring scheme.

Zabbix is a software that can monitor various network parameters as well as the health and integrity of the server. Zabbix uses a flexible notification mechanism that allows users to configure mail-based alerts for almost any event. This allows you to quickly report back on problems with the server. Based on the number stored

According to Zabbix, it provides excellent reporting and data visualization capabilities. These capabilities make Zabbix an ideal solution for capacity planning. Zabbix supports active polling and passive capture. All Zabbix reports, statistics, and configuration parameters can be accessed through the Web-based front

1/50

Access to the end page. Web-based front-end pages ensure that you evaluate the state of your network and the health of your server in any way. With proper configuration, Zabbix can play an important role in IT infrastructure monitoring. The same is true for small organizations with only a small number of servers and large companies with a large number of servers.

Zabbix is free. Zabbix is written and issued under the second edition of the GPL General Public license. This means that its source code is free and available to the public.

two。 Differences between monitoring software

1.nagios graphics is not very good, you can also install graphics plug-ins, but not very good-looking 2.nagios generally if you need graphics can be used with cacti 3.cacti monitoring is polling monitoring, inefficient, graphics are relatively good-looking relative to nagios

4.zabbix and nagios have higher requirements for cpu because they are concurrency monitoring.

5.zabbix is much more powerful in performance and functionality.

The graphics of 6.zabbix are quite beautiful. Support multiple monitoring methods, zabbix-agent snmp, etc.

8. Support distributed monitoring, can monitor a lot of agent 9.zabbix has a graphical web configuration interface, simple configuration

10.zabbix supports auto-discovery

Overview of zabbix

One: zabbix monitoring architecture

Monitoring center zabbix-server

| |

| | |

-proxy----proxy

| | |

Agent agent agent agent

Second: zabbix monitoring email alarm architecture

Postfix

Post Office (MTA)-Postman (smtp 25)-Post Office (MTA)

| | |

MDA maildrop dovecote MDA

| | |

Postman (smtp 25) postman (pop3 110 imap 143)

| | dns |

Mailbox (MUA) mailbox (MUA)

| | |

2/50

Lilei (user1) hanmeimei (user2)

Agent Agent proxy Agent

Three: the advantages of Zabbix

Open source, no software cost input Server requires low equipment performance

It supports many devices, comes with a variety of monitoring templates to support distributed centralized management, has automatic discovery function, and can realize automatic monitoring open interface, strong expansibility, and easy plug-in programming.

When the monitored item is relatively large, the server queue can be passive. The monitored client actively downloads the item to be monitored from the server side and then takes the data to upload to the server side. This method puts less load on the server.

Api support for easy integration with other systems

Fourth: Zabbix shortcomings need to install agent on the monitored host, all the data are stored in the database, the resulting data is very large, the bottleneck is mainly in the database.

Fifth: Zabbix monitoring system monitoring object

Database: MySQL,MariaDB,Oracle,SQL Server

Application software: Nginx,Apache,PHP,Tomcat agent

Cluster: LVS,Keepalived,HAproxy,RHCS,F5

Virtualization: VMware,KVM,XEN agent

Operating system: Linux,Unix,Windows performance parameter

Hardware: server, storage, network device IPMI

Network: network environment (internal network environment, external network environment) SNMP

Six: Zabbix architecture

Zabbix consists of several major software components, which have the following functions.

3/50

1 、 Server

Zabbix server is the core component for agent programs to report system availability, system integrity and statistics, and is the core memory for all configuration information, statistics and operational data.

Database Storage all configuration information and data collected by Zabbix are stored in the database.

3. Web interface

In order to easily access Zabbix from anywhere and on any platform, we provide a Web-based Zabbix interface. The interface is

Part of Zabbix Server usually (but not necessarily) runs on the same physical machine as Zabbix Server.

If you use the SQLite,Zabbix Web interface, you must run on the same physical machine as Zabbix Server.

4. Proxy proxy server

Zabbix proxy can collect performance and availability data for Zabbix Server. The Proxy proxy server is part of the optional deployment of the Zabbix software; of course, the Proxy proxy server can help a single Zabbix Server share the load.

5. Agent monitoring agent

The Zabbix agents monitoring agent is deployed on the monitoring target and can actively monitor local resources and applications and report the collected data to Zabbix Server.

6. Data flow

In addition, it is also important to understand the data flow within the Zabbix. In terms of monitoring, in order to create a monitoring item (item) to collect data, you must

You must first create a host (host). In the alarm aspect, create a trigger (trigger) in the monitoring item, and trigger the alarm action (action) through the trigger (trigger). Therefore, if you want to receive an alarm about an overloaded Server XCPU, you must: 1. Create a host for Server X and associate a monitoring item (Item) for monitoring the CPU. two。 Create a Trigger that is set to trigger 3. 0 when the CPU load is too high.

Trigger is triggered, and sending alarm messages may seem like a lot of steps, but using templates is actually very easy to operate. The design of Zabbix makes the configuration mechanism very flexible and easy to use.

VII: the meaning of the terms commonly used in Zabbix

1. Host (host)

4/50

A network device you want to monitor, represented by IP or domain name

2. Host group (host group)

A logical group of hosts; it contains hosts and templates. There is no direct correlation between the host and the template in a host group. Host groups are typically used when assigning permissions to hosts in different user groups.

3. Monitoring items (item)

You want to receive specific data from the host, a metric.

4. Trigger (trigger)

A logical expression used to define the problem threshold and "evaluate" the data received by the monitor item. When the data received is higher than the threshold, the trigger changes from "OK" to "Problem" state. When the received data falls below the threshold, the trigger retains / returns a "OK" state.

5. Event (event)

Things that need to be noticed at a time, such as a change in the state of the trigger or the discovery of automatic registration by a monitoring agent

6. Exception (problem)

A trigger in an "abnormal" state

7. Action (action)

A predefined action that reacts to an event. An action consists of an action (such as issuing a notification) and a condition (when the action is taking place)

Cheng

8. Upgrade (escalation)

A custom scenario for performing actions within an action; a sequence of sending notifications / executing remote commands

9. Media (media)

The means of sending alarm notice; the way of alarm notice

10. Notification (notification)

Send event-related information to the user using the selected media channel

11. Remote command (remote command)

A predefined command that can be executed automatically on the monitored host if some conditions are met

12. Template (template)

The task of a set of collection templates of entities that can be applied to one or more hosts (monitoring items, triggers, graphics, aggregation graphics, applications, LLD,Web scenarios) is to speed up the implementation of host monitoring tasks; it can also make batch modification of monitoring tasks easier. Templates are directly associated with each individual host.

13. Application (application)

A logical grouping of monitoring items

14. Web scenario (web scenario)

Check the usability of a website using one or more HTTP requests

15. Web interface provided by frontend Zabbix

16 、 Zabbix API

Zabbix API allows you to use the JSON RPC protocol (a stateless and lightweight remote procedure call (RPC) transport protocol that is delivered primarily through JSON) to create, update, and obtain information about Zabbix objects (such as hosts, monitoring items, graphics, and other) or to perform any other custom tasks.

17 、 Zabbix server

Zabbix software implements the core program of monitoring, and its main functions are to interact with Zabbix proxies and Agents, to calculate triggers, to send alarm notifications, and to save data centrally.

18 、 Zabbix agent

A program deployed on the monitoring object, which can actively monitor local resources and applications, Zabbix agent is deployed on the monitoring target, actively monitoring local resources and applications (hardware drivers, memory, processor statistics, etc.). Zabbix agent collects local operation information and transforms the data

5/50

Report to Zabbix server for further processing. In the event of an exception (such as a full hard disk space or a crashed service process), Zabbix

Server proactively alerts the administrator to specify exceptions on the machine. . Zabbix agents is extremely efficient because it can use local system calls to collect statistics.

Passive (passive) and active (active) checks

Zabbix agents can perform both passive and active checks. In passive check mode, agent replies to a data request, Zabbix server (or proxy) asks about agent data, such as the load of CPU, and Zabbix agent sends back the result. Active checks

The process will be relatively complex. Agent must first request a list of monitoring items from Zabbix sever for independent processing, and then periodically send new values to server. Performing passive or active checks is configured by selecting the appropriate monitoring project type. Item type. Zabbix agent

The types of monitoring items for processing are 'Zabbix agent'' and 'Zabbix agent (active)'.

20. Zabbix proxy A program that helps Zabbix Server collect data and share the load of Zabbix Server is a program that can collect data from one or more

The process in which monitored devices collect monitoring data and send information to Zabbix sever basically works on behalf of sever. All collected data is cached locally and then transferred to the Zabbix sever to which proxy belongs. Deploying Proxy is optional, but it can be very useful to spread the load off a single Zabbix sever. If only proxy collects data, processes on sever will reduce CPU consumption and negative disk I / O

Pick up. Zabbix proxy is an ideal solution for centralized monitoring of remote areas, branch offices, and networks without local administrators.

Zabbix proxy requires a separate database.

21. Active / passive mode

Both active and passive modes are relative to proxy. Proxy sends data actively is the active mode; proxy waits for server's request and sends it again.

Sending data is passive mode. Because active mode can effectively reduce the pressure of zabbix server, many things that need to be monitored must be changed from monitoring mode to active monitoring passive mode process, and passive mode must remember to set Server = ServerIP

Passive mode workflow: Server opens a TCP connection

Server sends a key to accept the request for agent.ping Agent and then responds

< HEADER >

< DATALEN >

Processing the data received by Server docking TCP connection is closed

Active mode process, active mode must remember to set up ServerActive=ServerIP Agent to establish a TCP connection to Server

List of data to be tested for Agent request

Server responds to Agent by sending a list of Items

Agent allows response

TCP connection completes this session closes

Agent began to collect data periodically

Zabbix deployment

1. Experimental preparation

There are three centos7.5 system servers, one as a monitoring server and two as monitored nodes. The yum source is configured, the firewall is turned off, the clock service of each node is synchronized, and each node can communicate with each other through the host name.

1) all machines turn off firewall and selinux setenforing 0 (modify configuration file to close)

Sed-I's Union SELINUXPRENTENTFORCING sed'/ etc/selinux/config systemctl stop firewalld.service

2) according to the architecture diagram, the basic settings of the experiment are as follows:

Machine name IP configuration service role remarks

Server 192.168.19.137 zabbix-server enables monitoring function

Node1 192.168.19.135 zabbix-agent on

Node2 192.168.19.136 zabbix-agent on

2. Installation of Zabbix

1) update yum warehouse

We go to the official website to download a package zabbix-release-3.4-2.el7.noarch.rpm and install it locally into our virtual machine. In this way, we have a new yum source locally, and we can install the zabbix service directly: yum-y install wget.

Wget http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm

Install zabbix source (official)

Rpm-ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm http://120.52.51.16/repo.zabbix.com/zabbix/4.1/rhel/7/x86_64/zabbix-agent-4.2.0-0.1alpha1.el7.x86_64.rpm

Download and install:

Rpm-ivh zabbix-release-3.4-2.el7.noarch.rpm

Then update our yum warehouse:

[root@server ~] # yum repolist

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

Zabbix-non-supported 4/4

Repo id repo name status

Base base 9363

7/50

Epel epel 11349

Zabbix/x86_64 Zabbix Official Repository-x8631 64 80

Zabbix-non-supported/x86_64 Zabbix Official Repository non-supported-4

Repolist: 20796

Installation:

[root@server ~] # yum-y install zabbix-server-mysql zabbix-web-mysql zabbix-agent

2) install the settings database:

1. Create a mariadb.repo

Vim / etc/yum.repos.d/mariadb.repo

Write the following:

[mariadb]

Name = MariaDB

Baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.4/centos7-amd64 gpgkey= https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB gpgcheck=1 2, yum install the latest version of mariadb

Yum install MariaDB-server MariaDB-client

First, let's modify the configuration file-/ etc/my.cnf.d/server.cnf:

[root@server ~] # vim / etc/my.cnf.d/server.cnf

[mysqld] # Skip hostname resolution

Skip_name_resolve = ON

Innodb_file_per_table = ON # # cache pool size

Innodb_buffer_pool_size = 256m

Max_connections = 2000 # maximum connections

Log-bin = master-log # Open binary log

2. Restart our database service:

[root@server ~] # systemctl restart mariadb

[root@server ~] # mysql_secure_installation # initialize mariadb

3. Create a database and authorize the account

MariaDB [(none)] > create database zabbix character set 'utf8'; # create zabbix database

MariaDB [(none)] > grant all on zabbix.* to 'zabbix'@'192.168.19.%' identified by' passswd'; # Note

Authorized network segment

MariaDB [(none)] > flush privileges; # refresh authorization

4. Import table

[root@zabbix-server ~] # zcat / usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql-uzabbix-p zabbix

Enter password: # enter password

After the import, let's go into the database and check:

[root@zabbix-server zabbix-server-mysql-3.4.15] # mysql- uzabbix-p Enter password:

MariaDB [(none)] > show databases

+-+

| | Database |

+-+

| | information_schema |

| | mysql |

| | performance_schema |

| | test |

| | zabbix |

+-+

MariaDB [(none)] > use zabbix

Database changed

MariaDB [zabbix] > show tables

+-+

| | Tables_in_zabbix |

8/50

+-+

| | acknowledges |

| | actions |

.

| | proxy_dhistory |

| | proxy_history |

| | regexps |

| | rights |

| | screen_user |

+-+

140 rows in set (0.001 sec)

5. Configure zabbix server

When our database is ready, we will modify the configuration file on the server side.

[root@zabbix-server ~] # cd / etc/zabbix/ [root@zabbix-server zabbix] # ls

Web zabbix_agentd.conf zabbix_agentd.d zabbix_server.conf

# in order to facilitate our recovery later, let's back up the configuration file

[root@zabbix-server zabbix] # cp zabbix_server.conf zabbix_server.conf.bak [root@zabbix-server zabbix] # vim zabbix_server.conf DBHost=localhost # the name of the host DBName=zabbix # database outside the database

DBUser=zabbix # Database user DBPassword=zabbix # Database password

# after the configuration file here is opened: if you have one, you don't need to add it. If it is commented, there is no need to uncomment. Just copy and paste the content.

Above, our basic configuration has been completed, and we can start the service:

[root@zabbix-server zabbix] # systemctl start zabbix-server [root@zabbix-server zabbix] # systemctl enable zabbix-server

Created symlink from / etc/systemd/system/multi-user.target.wants/zabbix-server.service to / usr/lib/systemd/ system/zabbix-server.service.

After enabling the service, we must make sure that our port is open:

[root@zabbix-server zabbix] # netstat-lntp | grep 10051

Tcp 00 0.0.0.0:10051 0.0.0.0: LISTEN 1574/zabbix_server

Tcp6 00: 10051: LISTEN 1574/zabbix_server

6. Configure web GUI

There is a / etc/httpd/conf.d/zabbix.conf file, and this configuration file is the file that helps us to map [root@zabbix-server zabbix] # vim / etc/httpd/conf.d/zabbix.conf # set the time zone

# there is almost no movement in it. Just add a line of time zone to php_value date.timezone Asia/Shanghai-add the following, and then we can start our httpd service:

[root@zabbix-server zabbix] # systemctl start httpd [root@zabbix-server zabbix] # systemctl enable httpd

Created symlink from / etc/systemd/system/multi-user.target.wants/httpd.service to / usr/lib/systemd/system/ httpd.service.

Our service has been turned on, and then we can access it with a browser.

7. Browser access and initialization settings picture slightly http://192.168.122.166/zabbix/setup.php

Default user name: Admin

Default password: zabbix

8. Configure zabbix agent

When we start the configuration of the monitoring side, we need to set up our monitored side. We install agent on the monitored host, set up his server, and add it to the server side, so we can bring it into our monitoring system.

1) install zabbix

Again, let's install zabbix first. Both machines operate

[root@zabbix-agent-none1 ~] # rpm-ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm

9/50

[root@zabbix-agent-none1 ~] # yum install zabbix-agent- y

After the installation is complete, we will modify the configuration file.

2) modify the configuration file

Make a backup of the configuration file, then modify the configuration file:

[root@zabbix-agent-none1 ~] # cd / etc/zabbix/ [root@zabbix-agent-none1 zabbix] # ls zabbix_agentd.conf zabbix_agentd.d

[root@zabbix-agent-none1 zabbix] # cp zabbix_agentd.conf {, .bak} [root@zabbix-agent-none1 zabbix] # ls

Zabbix_agentd.conf zabbix_agentd.conf.bak zabbix_agentd.d

[root@zabbix-agent-none1 zabbix] # vim zabbix_agentd.conf-modify the address of the Server=192.168.246.228 zabbix server as follows: ServerActive=192.168.246.228 active mode zabbix-server-ip Hostname=zabbix-agent-none1

Whether UnsafeUserParameters=1 restricts user-defined keys to use special characters 1 can enable special characters 0 can not enable special characters

After the modification is completed, we save and exit. Then you can start the service:

[root@zabbix-agent-none1 zabbix] # systemctl start zabbix-agent [root@zabbix-agent-none1 zabbix] # systemctl enable zabbix-agent

Check whether the port is open as usual.

[root@zabbix-agent-none1 zabbix] # netstat-lntp | grep 10050

Tcp 00 0.0.0.0:10050 0.0.0.0: LISTEN 9369/zabbix_agentd

Tcp6 00: 10050: LISTEN 9369/zabbix_agentd

It has been successfully opened. Then, we can go to the server side to add. None2 does the same thing except that the Hostname in the configuration file is set to zabbix-agent-none2.

The use of zabbix (1)

1) change the password and Chinese version

As an operator who is not good at English, it has been quietly changed to the Chinese version. If you are good at English, you can read the English version. If you are not good at English, you can change it. After all, the Chinese version is more suitable for beginners to learn faster.

Remember to refresh!

Just press the operation above. After selecting Chinese, click the update below to update successfully. After the update, it looks like this.

Similarly, for security reasons, we change the password: click Update after the change is completed.

2) to create a CVM and CVM group, let's define a CVM group:

Then we can add hosts:

Of course, there are many choice cards on it, and there is an encryption:

10/50

When the settings are complete, click add. We can see that the host we added is already in the list:

3) Monitoring items (items)

Create a monitoring item to determine what we want to monitor on the monitored side

In fact, there are many kinds of indicators that we focus on, and we can add them one by one.

The monitoring item we just defined is very simple, you can specify a key, but some monitoring items have parameters, so our monitoring items have more flexibility.

Net.if.out [if,] upstream traffic statistics

Parameter comment

Net.if.in [if,] network API uploads traffic statistics. Returns an integer

The [] in the figure means that parameters are required, and the values in them are parameters and cannot be omitted. Let's take this as an example.

Ming:

If indicates the interface name; indicates that mode, including but not limited to: packets (packet), bytes (byte), errors (error), dropped (packet loss) (the above is viewed through ifconfig)

Command view:

[root@zabbix-server zabbix] # zabbix_get-s 192.168.122.167-p 10050-k "net.if.in [eth0,packets]"

Extension (noun interpretation):

Upstream traffic is the number of bytes sent locally to the inter network. Downlink traffic is the number of bytes downloaded from the network.

[root@xingdian-cloud yum.repos.d] # ifconfig

Eth0: flags=4163 mtu 1500

Inet 192.168.122.167 netmask 255.255.255.0 broadcast 192.168.122.255 inet6 fe80::46ba:6fa0:e1e6:8644 prefixlen 64 scopeid 0x20

Inet6 fe80::62ba:7626:1e71:fc5d prefixlen 64 scopeid 0x20 ether 52:54:00:c1:95:58 txqueuelen 1000 (Ethernet)

RX packets 97856 bytes 649560808 (619.4 MiB) RX errors 0 dropped 11 overruns 0 frame 0 TX packets 70512 bytes 5823411 (5.5MiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0

Inet6:: 1 prefixlen 128 scopeid 0x10 loop txqueuelen 1 (Local Loopback)

RX packets 1795 bytes 176872 (172.7 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1795 bytes 176872 (172.7 KiB)

TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Rx Packets means to receive data packets.

Tx Packets means to send a packet.

Rx Bytes means to receive bits.

Tx Bytes means to send bits.

4) create a trigger

Create a trigger to act as a threshold or early warning line for alarm

Monitor item template

Agent.hostname client hostname. Returns a string

Agent.ping client reachability check. Return nothing-unreachable

The version of the agent.version zabbix client (agent). Returns a string

The maximum number of file openings for the kernel.maxfiles operating system. Returns an integer

The maximum number of processes in the kernel.maxproc operating system. Returns an integer

Net.dns [, name,] checks whether the DNS service is enabled. Returns 0-DNS service

Failure); 1-DNS service is enabled

Net.dns.record [, name,] executes the DNS query. Returns string information

Net.if.collisions [if] number of network conflicts. Returns the integer type

Net.if.in [if,] network API uploads traffic statistics. Returns an integer

List of net.if.list network interfaces (including interface type, status, IPv4

Net.if.out [if,] upstream traffic statistics. Returns an integer

The total amount of traffic uploaded and downloaded from the net.if.total [if,] network interface. Returns an integer

Net.tcp.listen [port] checks to see if the TCP port is listening. Return 0-

Net.tcp.port [, port] checks to see if TCP can be established to connect to the designated port. Return

Net.tcp.service [service,] checks whether the service is running and accepts TCP connections. Return 0

Net.tcp.service.perf [service,] checks the performance of the TCP service and returns when the service down

Number

Net.udp.listen [port] checks to see if the UDP port is listening. Return 0-

Net.udp.service [service,] checks whether the service is running and responds to UDP requests. Return 0

Net.udp.service.perf [service,] checks the performance of the UDP service and returns when the service down

Number of seconds

Perf_counter [counter,] all Windows counter values. Return to shaping, floating point,

Percentage of proc.cpu.util [,] CPU processes. Returns a floating point value

Proc.mem [,] process memory, in bytes. Returns an integer

The number of proc.num [,] processes. Returns an integer

Proc_info [process,] specific processing of each information. Returns a floating point number

Sensor [device,sensor,] hardware sensor readings. Return to floating point type

Service.info [service,] information about the service. Returns an integer field to represent the status

Display name, path, user; text-use field as description

Stop, 2-start suspend, 3-pause suspend, 4-continue hanging

Unknown, 255-does not have this service; start code: 0-since

Disabled, 4-unknown

Services [,] list service. Return 0 means empty, if it is a list, it is every

System.boottime system startup time. Return timestamp

The number of interrupts for the system.cpu.intr device. Returns an integer

System.cpu.load [,] CPU load. Returns a floating point number

Number of system.cpu.num [] CPU, which returns an integer

The number of system.cpu.switches contexts to switch. It returns an integer value

System.cpu.util [,] CPU utilization. Returns a floating point number

System.hostname [] system hostname. Returns a string

System.hw.chassis [] rack information. Returns a string

Key value name

13/50

System.hw.cpu [,] CPU information. Returns a string or integer

System.hw.devices [] PCI or USB device list. Return text

System.hw.macaddr [,] MAC address. Returns a string

System.localtime [] system time. The UTC integer is returned. Yes

System.run [command,] is the execution of the command specified on the host.

The mode of the NOWAIT, which returns the execution life

System.stat [resource,] system statistics. Returns an integer value or

System.sw.arch software architecture information. Returns a string

System.sw.os [] operating system information. Returns a string

System.sw.packages [,] installation package list. Return text

System.swap.in [,] is swapping the swap (from device to memory)

System.swap.out [,] swap partition (from memory to device)

System.swap.size [,] swap partition space size, bytes or from total

System.uname recognition system. Returns a string

System.uptime system startup time. Returns an integer

The number of system.users.num logged-in users, which returns an integer

Vfs.dev.read [,] disk reads data. Type is sectors, op

Bps returns a floating point.

Vfs.dev.write [,] disk writes data. Type is sectors, op

Bps returns a floating point.

The number of entries recursively in the vfs.dir.count directory. Returns an integer

[dir,]

Vfs.dir.size directory size (bytes). Returns an integer

[dir,]

Vfs.file.cksum [file] file validation, unix standard algorithm. Return to whole

Vfs.file.contents [file,] searches for the contents of the file. Return text

Vfs.file.exists [file] checks to see if the file exists. Return 0-not found

In

MD5 check of vfs.file.md5sum [file] file. Returns the string (

Vfs.file.regexp [file,regexp,] looks up the string in the file and returns the content

Parameters.

Vfs.file.regmatch [file,regexp,] looks for strings in the file, if any

Vfs.file.size [file] file size in bytes. Return to whole

Vfs.file.time [file,] file event information, which returns a timestamp

The number of vfs.fs.inode [fs,] or the percentage of inode. Return a number

Vfs.fs.size [fs,] disk capacity. If the bytes are returned, then

Vm.memory.size [] memory size from bytes or total percentage.

Returns a floating-point value.

Vm.vmemory.size [] Virtual space size (in bytes) or 100

Web.page.get [host,] gets the web page. The returned information is the source code of the web page.

Web.page.perf [host,] full page load time (seconds). Return to float

Web.page.regexp [host,regexp,] looks up the string in the web page and returns the content

Parameters.

Key value name

Wmi.get [,] executes the WMI query to return the first object. Returns integer, floating point, string

Capacity

Zabbix.stats [,] Returns a JSON object containing Zabbix server or proxy internal me

Zabbix.stats [, queue,] Number of items in the queue which are delayed in Zabbix server or "from" till "to" seconds, inclusive.

Key value name

Use of zabbix (2)

Case: nginx monitors nginx service status 1: pre-environment preparation:

Yum-y install nginx systemctl start nginx

Second, monitor the deployment:

1. Define Monitoring item > Host > node1-- > Monitoring item (items) > create Monitoring item

Enter the configuration-

two。 After defining the monitoring item, we can also define a trigger. When there is a problem with the service, we can know in time:

Enter the configuration-> Host-> none1-> trigger (trigger)-> create a trigger (for quick access, select the last one)

Triggered when the value is 0)

15/50

3. Create a graphical view (zabbix visualization)

The data accumulates day by day, if we want to understand the situation of each data more intuitively, the graph is undoubtedly our best choice. Zabbix prompts a number of visualization tools to provide visual presentation.

The data flow of multiple time series can be displayed centrally in a custom drawing. Supports "normal" and "stacking area map"

There are four different forms of graphics: (stacked), "pie" and "separated pie chart" (exploded).

4. Simulation service is down.

Zabbix maintenance time

During adding maintenance:

The maintenance period (Maintenance) refers to the period of time that the server maintains regularly. Zabbix can be set in this time period without the need to call the police.

Click configure-> maintenance-> create a maintenance period

16/50

The meaning of the above page configuration item is: name: the name of the maintenance configuration.

Maintenance type: whether it is necessary to collect data during this period of time, generally choose not to collect data.

In action from / until: the time range in which the maintenance configuration takes effect.

The meaning of the above page configuration item is:

Period type: configure whether the maintenance time is one-off or cyclical. Optional one-time / daily / weekly / monthly.

Date / Daily / Weekly / monthly: set the time to perform maintenance.

Length of maintenance period: length of maintenance time.

17/50

The meaning of the above page configuration item is:

Hosts under maintenance: which hosts are maintained during this maintenance period.

Groups in maintenance: which host groups are maintained during this maintenance period.

Zabbix Wechat alarm

One: WeCom deployed and used

1. Download WeCom

two。 Create an enterprise

3. Create an enterprise to apply my enterprise

CorpID wwf59d011ead30f194 AgentId 1000002

Secret 4kO-TrciubxGuKfJG-WsynbGDhnjRwGX3LdZWSGNr7A

Department id 2 Cloud Computing Department

18/50

Establish a connection: get the AccessToken request address: https://qyapi.weixin.qq.com/cgi-bin/gettoken?

Corpid=wwa1da242f211cdf47&corpsecret=rIrN51FEjgW6T2bdmSaEoN8s_mMW-Nu7gHysmagfdXc returned result: HTTP/1.1 200OK

Connection: keep-alive

Error-Code: 0

Error-Msg: ok

Content-Type: application/json; charset=UTF-8

Content-Length: 277

{"errcode": 0, "errmsg": "ok", "access_token": "9O7DSEqnUsQ8MD2bRGfFs26cabY1XcGErPnnJF_mfBBnI5zsM2I3u9-9Sj0tA ggY6BahOByGZvzDNaFoJj3YTp5blSPkm9exizerPUpDZNiGXtw", "expires_in": 7200}

Two: configure the monitoring script

19/50

Python monitoring script:

There are four areas that need to be modified. Find the information they obtained before self.corpid = 'wwf59d011ead30f194' / / the company's corpid.

Self.secret = '4kOmurTrciubxGuKfJGmurWsynbGDhnjRwGX3LdZWSGNr7A' / / secret 'toparty':2 for applications, / / departmental id

'agentid': "1000002", / / apply id

[root@ansible alertscripts] # cat wechat.py #! / usr/bin/env python

Coding: utf-8--

Import urllib,urllib2,json import sys

Reload (sys) sys.setdefaultencoding ("utf-8")

Class WeChat (object): _ _ token_id =''

Init attribute

Def init (self,url): self.__url = url.rstrip ('/')

Self.__corpid = 'wwf59d011ead30f194'

Self.__secret = '4kOmurTrciubxGuKfJGmurWsynbGDhnjRwGX3LdZWSGNr7A'

Get TokenID def authID (self):

Params = {'corpid':self.corpid,' corpsecret':self.secret} data = urllib.urlencode (params)

Content = self.getToken (data)

Try:

Self.__token_id = content ['access_token']

Print content ['access_token'] except KeyError:

Raise KeyError

Establish a connection

Def getToken (self,data,url_prefix='/'):

Url = self.__url + url_prefix + 'gettoken?' Try:

Response = urllib2.Request (url + data) except KeyError:

Raise KeyError

Result = urllib2.urlopen (response) content = json.loads (result.read ()) return content

Get sendmessage url

Def postData (self,data,url_prefix='/'):

Url = self.url + url_prefix + 'message/send?access_token=%s'% self.token_id request = urllib2.Request (url,data)

Try:

Result = urllib2.urlopen (request)

20/50

Except urllib2.HTTPError as e: if hasattr (e-training reasoning):

Print 'reason',e.reason elif hasattr (e-training code'):

Print 'code',e.code return 0

Else:

Content = json.loads (result.read ()) result.close ()

Return content

Send message

Def sendMessage (self,touser,message): self.authID ()

Data = json.dumps ({'touser':touser,' toparty':11, 'msgtype': "text",' agentid': "1000002", 'text': {

'content':message

}

'safe': "0}, ensure_ascii=False) response = self.postData (data) print response

If name = 'main':

A = WeChat ('https://qyapi.weixin.qq.com/cgi-bin') a.sendMessage (sys.argv [1], sys.argv [3])

Modify permissions:

[root@ansible alertscripts] # chown zabbix.zabbix / usr/lib/zabbix/alertscripts/wechat.py [root@ansible alertscripts] # chmod 777 / usr/lib/zabbix/alertscripts/wechat.py

Test script: the following invalidparty can be ignored. If you receive a message normally, it is shown below.

[root@ansible alertscripts] #. / wechat.py Zhuangyao test test {upright errmspartymakers: upright 2percent, utilisation idusernames: upright wusongs, upright errcodeeds: 0, upright errmsgears: upright ok`}

Three: zabbix configures Wechat alarm:

Create an alarm medium:

Manage-> alarm Media Type-> create Media Type

Zabbix 3.0 and above need to define parameters for alert scripts. In previous versions, the parameters were fixed, and now users can define their own command line parameters. The added parameters are $1, $2, $3, and so on in the script. {ALERT.SENDTO} {ALERT.SUBJECT}

{ALERT.MESSAGE}

21/50

Create users: Administration-- > Users-- > Media-- > add (pay attention to setting permissions to Super Admin or Administration when creating users

Member)

Associate the alarm medium for the user: the recipient is the account in the enterprise mailbox

22/50

Add an action, trigger the condition, alarm and send Wechat message.

Configuration-- > Actions-Event source (Triggers)-Create action

23/50

Both restore and confirm operations can be configured, as above

After all the configuration is completed, reset the value of the trigger to simulate alarm generation, and detect whether the Wechat alarm is successful!

problem

Question 1:

When using zabbix graphics, how to solve the problem of Chinese garbled code? Solution:

In the / usr/share/zabbix/assets/fonts directory, delete the original character set file or modify the file name to lose its effect, re-upload the new character set file, and refresh the interface after the upload is successful.

24/50

Alarm formatting document

Message content:

Name: Action-Email

Default recipient: fault {TRIGGER.STATUS}, server: {HOSTNAME1} occurred: {TRIGGER.NAME} failure!

Default information:

Alarm host: {HOSTNAME1}

Alarm time: {EVENT.DATE} {EVENT.TIME} alarm level: {TRIGGER.SEVERITY}

Alarm information: {TRIGGER.NAME} alarm item: {TRIGGER.KEY1}

Question details: {ITEM.NAME}: {ITEM.VALUE}

Current status: {TRIGGER.STATUS}: {ITEM.VALUE1} event ID: {EVENT.ID}

Zabbix public network mailbox alarm

Brief introduction of email system:

The email system consists of two components: MUA (Mail User Agent, mail user agent) and MTA (Mail Transport Agent, mail delivery).

MUA is the interface that the mail system provides for users to read and write emails, while MTA is a program that runs at the bottom and can handle the sending and receiving of emails. To put it simply, users can use MUA to write letters, read letters, and receive and send letters through MTA. Foxmail, Outlook and Webmail all belong to MUA.

The receiving of mail is completed by MTA and MUA. The remote MUA first connects to the remote MTA and verifies the identity of the sender, and then the remote MTA sends mail to the local MTA. The recipient receives the reading email through the local MUA. Sending emails is also done by MTA and MUA, but in the opposite direction. The local MUA first connects to the local MTA and verifies the identity of the sender, and then the local MTA sends mail to the remote MTA

And then the mail is read by the remote MUA.

Mail and mailx are the MUA responsible for viewing, writing, and sending messages to MTA. Mailx is an enhanced version of mail. Sendmail is the MTA responsible for the transmission of messages over the network, transferring messages from one MTA to another MTA.

Dry:

1. Register 163 mailbox

two。 Web mailbox setting client authorization password

Install MUA software: mailx

# yum install mailx

# mail-V

12.5 7-5-10

Mailx-V 12.5 7-5-10

Configure public network mailbox information:

Vim / etc/mail.rc appends the following content set from=lisi@163.com (email address)

Set smtp=smtp.163.com (smtp server) set smtp-auth-user=lisi@163.com (user name) set smtp-auth-password=* (authorized mailbox password) set smtp-auth=login

How to use mailx to send email:

Mode 1:mailx-s "Mail title" inbox Email

< 包含正文的文件 方式2:cat 包含正文的文件 | mailx -s "邮件标题" 收件箱Email 方式3:echo "正文内容" | mailx -s "邮件标题" 收件箱Email 方式4:mailx -s "邮件标题" 收件箱Email,回车按CTRL+D发送 手动发送邮件测试: mailx -v -s 'hello' 'zhangsan@163.com' nihao (回车,然后ctrl+D EOT 25/50 或者,将邮件内容放到一个文件中content.txt #cat content.txt | mailx -v -s 'hello' 'zhangsan@163.com' 手动使用mailx发送邮件测试结果: zabbix添加邮件报警功能: 注:使用新的方式--利用公网邮件服务器发送报警,需要关闭postfix服务 配置 zabbix 的邮件报警功能需要以下三个角色的参与。 1、 示警媒体(Media) 2、 触发器(Triggers) 3、 动作(Action) 示警媒体: 指的是 zabbix 采用何种方式进行报警,目前 Zabbix 支持的示警媒体包括邮件、Jabber、短信。jabber是linux下一种即时通讯工具,可以和yahoo,icq等工具通信 触发器: 指的是当监控对象达到某个条件或条件集合的时候,触发 Zabbix 产生事件。 动作: 指的是 Zabbix 产生对应事件后,它通过示警媒体发送报警。 接下来,我们配置一个邮件报警功能的范例。效果是当 WEB 页面获取时间超过 3 秒,则触发报警,管理员将会收到一封 Zabbix 发出的报警邮件。 示警媒体的配置: 首先需要配置 Zabbix 的邮件功能。 点击 管理->

Alarm Media Type-> create Media Type

26/50

Then fill in your alarm media type information on the page, as shown in the following figure:

Note: the script name is arbitrary and is stored in / usr/lib/zabbix/alertscripts (the test suit on production is put here: / usr/local/zabbix/share/zabbix/ alertscripts)

Name: sendmail / / any name

Type: script

Script name: sendmail.sh / / must be written, otherwise it may not be sent successfully

Script parameters:

{ALERT.SENDTO} / / fill in, recipient variable

{ALERT.SUBJECT} / / as required, the subject variable of the message, and the value of the variable comes from the "default recipient" in "Action".

{ALERT.MESSAGE} / / as-filled, message body variable, variable value comes from "default information" in "Action"

After the configuration is complete, don't forget to click Archive to save your configuration.

Modify the zabbix server configuration file & write the script: specify the storage path of the script:

# vim / etc/zabbix/zabbix_server.conf AlertScriptsPath=/usr/lib/zabbix/alertscripts

27/50

Script the mail:

# cd / usr/lib/zabbix/alertscripts # vim sendmail.sh

#! / bin/sh

Echo "$3" | sed sqqqa'\ rnsqqplash g | mailx-s "$2" $1

Modify permissions:

# chmod uplix sendmail.sh & & chown zabbix.zabbix sendmail.sh

Simulate the alarm and check whether the mailbox has received the mail.

Enterprise-level zabbix telephone alarm

This item (epilepsy) is tested in person.

Project profile:

System version: Linux Centos 7.6

Application version: Zabbix 4.2

Database: mariadb

Onealert official website: http://www.onealert.com/

Service deployment:

One: deploy zabbix-server 1. Deploy zabbix's yum repository

[root@xingdian] # rpm-Uvh https://repo.zabbix.com/zabbix/4.2/rhel/7/x86_64/zabbix-release-4.2-1.el7.noarch.rpm 2. Clear the yum cache [root@xingdian ~] # yum clean all

[root@xingdian] # yum makecache 3. Install zabbix-server and zabbix-agent

[root@xingdian] # yum-y install zabbix-server-mysql zabbix-web-mysql zabbix-agent 4. Install the database service (mysql or mariadb is optional)

[root@xingdian ~] # yum-y install mariadb-server mariadb

5. Deploy database services

[root@xingdian ~] # mysqladmin-u root-paired password' mysql > create database zabbix character set utf8 collate utf8_bin

Msyql > grant all privileges on zabbix. To zabbix@localhost identified by 'password'; mysql > quit

6. Database data import

[root@xingdian ~] # zcat / usr/share/doc/zabbix-server-mysql/create.sql.gz | mysql-uzabbix-p zabbix 7. Modify zabbix configuration file [root@xingdian ~] # vim / etc/zabbix/zabbix_server.conf

DBPassword=password 8. Modify apache configuration file (modify time zone)

[root@xingdian ~] # vim / etc/httpd/conf.d/zabbix.conf php_value date.timezone Asia/ShangHai

9. Start the service and boot.

[root@xingdian ~] # systemctl restart zabbix-server zabbix-agent httpd [root@xingdian ~] # systemctl enable zabbix-server zabbix-agent httpd

2: deploy telephone alarm (Onealert)

Note: public cloud voice services such as Aliyun and Huawei Cloud can be used here, but enterprise certification is required.

1. Change to the zabbix script directory [root@xingdian ~] # cd / lib/zabbix/alertscripts/ 2. Get the OneITSM agent package

28/50

[root@xingdian ~] # wget https://download.aiops.com/ca_agent/zabbix/ca_zabbix_release-2.1.0.tar.gz

3. Decompression, installation

[root@xingdian] # tar-xzf ca_zabbix_release-2.1.0.tar.gz 4. Execute oneitsm

[root@xingdian ~] # cd cloudalert/bin

[root@xingdian] # bash install.sh 7c5df639-4476-4e1a-bc7c-eb8f9362d919

Note: the following application Key is obtained from the configuration of Onealter (for more information, please see step 3)

5. You need to enter the management address of zabbix during installation. Format: http://zabbix_server_ip/zabbix

6. Enter the administrator account and password for zabbix

7 when prompted "installation successful", it means that the installation is successful! Verify alarm integration

A new zabbix alarm (problem) is generated, and the action status of "delivered" indicates that the integration is successful.

Three: Onealter graphical deployment

1. Configuration policy: user icon-personal center-alarm notification policy Note: there are three periods, corresponding to three different periods when the alarm occurs in the enterprise. When the alarm occurs: inform the manager of the alarm confirmation at the moment when the alarm occurs: when the alarm information is confirmed by the management, turn off the alarm: when the alarm is lifted, note: there are four alarm modes here.

Mail notification

Telephone notification

App Notification

SMS notification

two。 Phone alarm Associated zabbix

3. Allocation strategy: configuration-assignment strategy Note: according to the company's different job responsibilities, assigned to different employees.

29/50

4.zabbix generates alarm message to verify phone alarm

5. Received a call to the police

30/50

Zabbix alarm is based on nails

1. Install nails-sign up for nailing accounts.

First create a group chat to add up the people who need to get the monitoring information. Add a robot to the nail.

31/50

32/50

33/50

Because the alarm is realized through the wbehook of the nail, it is an api.

The nails are ready!

=

2 create a python script on the machine that logs in to zabbix-server:

[root@zabbixserver-01 ~] # cd / usr/lib/zabbix/alertscripts/ [root@zabbixserver-01 alertscripts] # vim dingding.py #! / usr/bin/python

-coding: utf-8-- import requests import json

Import sys import os

Headers = {'Content-Type':' application/json;charset=utf-8'} api_url = ""-this is the webhook that just copied the nail.

Def msg (text): json_text= {"msgtype": "text"

"at": {

34/50

"atMobiles": [

"

]

}, "text": {

"content": text

}

}

Print requests.post (api_url,json.dumps (json_text), headers=headers). Content

If name = 'main': text = sys.argv [1] msg (text)

Set permissions

[root@zabbixserver-01 alertscripts] # chmod 777 dingding.py

Create a log file for the nails:

[root@zabbixserver-01 zabbix] # pwd / var/log/zabbix

[root@zabbixserver-01 zabbix] # touch dingding.log

Modify the group and owner:

[root@zabbixserver-01 zabbix] # chown zabbix.zabbix dingding.log

=

Because the monitoring items and triggers have been configured before. Directly configure the alarm media of zabbix and start configuring the web interface:

35/50

36/50

Add user and alarm levels.

37/50

40/50

Look at the nail group:

User parameters

1. Introduction and usage

① introduction

Custom user parameters, that is, custom key sometimes, you may want to run an agent check instead of the predefined Zabbix

You can write a command to retrieve the required data and include it in the user parameters of the agent configuration file ("UserParameter" configuration parameter)

Medium

Usage format syntax UserParameter=

A user parameter also contains a key A user parameter also contains a key

The key will be necessary when configuring an item key is required when configuring monitoring items Note: Need to restart the agent Note: the agent service needs to be restarted

2. Usage display

(1) modify the configuration of the agent and set the user parameter ① needs to find the command.

[root@zabbix-agent-none1 ~] # free | awk'/ ^ Mem/ {print $3}'

② modifies the configuration file to set the command to find parameters as user parameters

[root@zabbix-agent-none1 ~] # cd / etc/zabbix/zabbix_agentd.d/ [root@zabbix-agent-none1 zabbix_agentd.d] # vim memory_usage.conf UserParameter=memory.used,free | awk'/ ^ Mem/ {print $3} '③ restart agent service

[root@zabbix-agent-none1 zabbix_agentd.d] # systemctl restart zabbix-agent.service (2) on zabbix-server, query [root@zabbix-server fonts] # zabbix_get-s 192.168.246.226-p 10050-k "memory.used"

(3) on monitoring, set an item monitoring item, and use this user parameter to configure-- > host-- > none1-- > monitoring item-- > create monitoring item (4) query graph graph

41/50

3. Usage upgrade

(1) modify the configuration of the agent side and set the user parameters ① command line query parameter command

② modifies the configuration file to set the command to find parameters as user parameters

[root@zabbix-agent-none1 zabbix_agentd.d] # ls memory_usage.conf userparameter_mysql.conf

[root@zabbix-agent-none1 zabbix_agentd.d] # vim memory_usage.conf-- continue to add UserParameter=memory.stats [], cat / proc/meminfo | awk'/ ^ $1 / {print $$2}'--remove the backslash [root@zabbix-agent-none1 zabbix_agentd.d] # systemctl restart zabbix-agent.service when adding to the file

Note: $2: indicates that it is not the $1 of the previous tuning parameter, but the parameter $2 of awk.

Note: $1 is called before the [], position parameter, the first parameter (2) on the zabbix-server side, query the key that uses this user parameter

Pass parameters:

[root@zabbix-server fonts] # zabbix_get-s 192.168.246.226-p 10050-k "memory.stats [MemTotal]" 999696

[root@zabbix-server fonts] # zabbix_get-s 192.168.246.226-p 10050-k "memory.stats [Cache]" 243832

[root@zabbix-server fonts] # zabbix_get-s 192.168.246.226-p 10050-k "memory.stats [Buffer]" 2108

(3) on monitoring, set an item monitoring item and use this user parameter

① adds item monitoring items of Memory Total, and defines multiples and units in the process using the user parameters of Secrety.stats [memTotal].

② clone Clone Memory Total creates a monitoring item memory.stats [MemFree] user parameter for Memory Free

(4) graph graphics of the above two monitoring items

① memory total

② memory free

4. Use user parameters to monitor the status of the php-fpm service

Monitoring php-fpm

Download and set php-fpm on agent: 192.168.246.226 (1)

[root@zabbix-agent-none1 ~] # yum-y install php-fpm php [root@zabbix-agent-none1 ~] # vim / etc/php-fpm.d/www.conf # modified as follows: user = nginx

Group = nginx

Pm.status_path = / php-fpm-status # php-fpm status monitoring page, # Open comment and modify ping.path = / ping # ping interface, whether ok # Open comment ping.response = pong # response content pong # Open comment

[root@zabbix-agent-none1 ~] # systemctl start php-fpm

(2) set nginx, set proxy php, and match the status page of php-fpm

42/50

[root@zabbix-agent-none1 ~] # vim / etc/nginx/nginx.conf

Server {

Listen 80 default_server

Listen [::]: 80 default_server

Servername

Root / usr/share/nginx/html

Load configuration files for the default server block. Include / etc/nginx/default.d/*.conf

Location / {

}

Location ~ .php ${

Fastcgi_pass 127.0.0.1 9000; fastcgi_index index.php

Fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name

Include fastcgi_params

}

Location ~ * / (php-fpm-status | ping) {fastcgi_pass 127.0.0.1 ping 9000; fastcgi_index index.php

Fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; include fastcgi_params

Access_log off; # does not need to log to visit this page.

}

}

[root@zabbix-agent-none1 ~] # nginx-t

Nginx: the configuration file / etc/nginx/nginx.conf syntax is ok

Nginx: configuration file / etc/nginx/nginx.conf test is successful [root@zabbix-agent-none1 ~] # nginx-s reload

(3) on the agent side, set user parameters

① query curl 192.168.246.226/php-fpm-status

Pool-fpm pool name, mostly www process manager-process management, values: static, dynamic or ondemand. Dynamic

Start time-start date. If php-fpm is reload, the time will update start since-elapsed accepted conn-number of requests accepted by the current pool

Listen queue-request waiting queue, if this value is not 0, increase the number of processes in FPM max listen queue-maximum number of request waiting queues listen queue len-socket wait queue length idle processes-number of idle processes active processes-number of active processes

Total processes-Total number of processes max active processes-maximum number of active processes (starting with FPM startup)

The number of times the maximum number of max children reached-Avenue processes is limited. If this number is not 0, then your maximum number of processes is too small. Please change it a little larger. Slow requests-number of slow requests with php-fpm slow-log enabled

② Settin

[root@zabbix-agent-none1 ~] # cd / etc/zabbix/zabbix_agentd.d/ [root@zabbix-agent-none1 zabbix_agentd.d] # vim php_status.conf-add

UserParameter=php-fpm.stats [], curl-s http://192.168.246.226/php-fpm-status | awk'/ $1 / {print $$NF}'

# set the user parameter to php-fpm.stats [], $1 as the first parameter, and $$NF as the parameter in awk

③ restart service

[root@zabbix-agent-none1 zabbix_agentd.d] # systemctl restart zabbix-agent

(4) on the zabbix-server side, query key [root@zabbix-server fonts] # zabbix_get-s 192.168.246.226-p 10050-k "php-fpm.stats [idle]" 4 that uses this user parameter

43/50

[root@zabbix-server fonts] # zabbix_get-s 192.168.246.226-p 10050-k "php-fpm.stats [max active]" 1

(5) create a template, create item monitoring items on the template, and use the defined user parameters

① creates a template

② configures the items monitoring item on the template, and uses the user parameter configuration just defined-template-- fpm status--- monitoring item-- to create the monitoring item fpm.stats [total processes] ③ and then clone to clone an items monitoring item fpm.stats [idle processes]

(6) host host link template configuration-- Host-- none1--- template-- Select-fpm status-add-Update (7) View graph graphics

① php-fpm total processes

② php-fpm idle processes

(8) to export the template, you can use ① to export the template at the bottom.

② defines its own files for user parameters, and don't forget to export

/ etc/zabbix/zabbix_agentd.d/php_status.conf

Network discovery

1. Introduction

Network Discovery: zabbix server scans hosts within a specified network scope

Network discovery is one of the most unique features of zabbix. It can automatically add monitored hosts or services according to user-defined rules.

Accelerate Zabbix deployment and simplify management

Use Zabbix in a rapidly changing environment without overmanaging (2) discovery methods:

Ip address range; available services (ftp, ssh, http,...)

Response from zabbix_agent; response from snmp_agent

(3) Network discovery usually consists of two stages: discovery discovery and actions action.

① discovery:

Zabbix periodically scans the IP range defined in network discovery rules; ② actions: events in network discovery can trigger action to automatically perform specified actions, taking discvery events as a prerequisite

Add / remove hosts enable / disable host

Add hosts to a group and remove hosts from a group

Link the host or unlink from the template

2. Configure Network Discovery Network discovery

(1) use the second host that can be found by scanning-192.168.246.227

① installs the package yum-y install zabbix-agent zabbix-sender of the agent segment

② sets agent configuration, and you can pass over the previously set none1 configuration.

[root@zabbix-agent-none2 ~] # vim / etc/zabbix/zabbix_agentd.conf Hostname=zabbix-agent-none2 # just modify hostname [root@zabbix-agent-none2 ~] # visudo # modify the configuration of sudo and add the following information # Defaults! visiblepw

Zabbix ALL= (ALL) NOPASSWD: ALL

④ enables the service.

44/50

[root@zabbix-agent-none2 ~] # systemctl restart zabbix-agent

(2) set auto-discovery rule discovery configuration-- auto-discovery-- create auto-discovery rule. Do not give too much ip scope.

Comments: on the zabbix-server side

[root@zabbix-server] # zabbix_get-s 192.168.246.227-p 10050-k "system.hostname" zabbix-agent-none2

(3) automatic discovery is successful (check in the test)

45/50

(4) set the action action for automatically discovering discovery

A) create

B) set the action action

① sets condition A, auto-discovery rule = test net

② sets B condition, auto-discovery status = up

46/50

What does ③ do to add hosts to monitoring

Automatically link Template OS Linux to this host

C) the configuration of action is completed. By default, disabled is disabled. If it is not disabled, you need to select startup again to activate it.

D) enable the action to view the effect

47/50

It is true that it has taken effect. The host is added successfully and the template link is successful. (5) if the host you need to add has been scanned and added, you can close the network scan because it consumes too much resources.

Web monitoring

Brief introduction:

Web monitoring: monitors the resource download speed, page response time, and response code of the specified site

Create Settings web scene configuration-Host-none1--web scene-create web scene

(1) create (2) configure web monitoring

48/50

Click the steps to set up the web page web page

Set up a web page named home page,URL as http://192.168.246.226/index.html

49/50

View Test (brief) create graphic View

50/50

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