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

How to install and configure Zabbix

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Today, the editor will share with you the relevant knowledge about how to install and configure Zabbix. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

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 stored data, Zabbix provides excellent reporting and data visualization capabilities. These capabilities make Zabbix an ideal solution for capacity planning.

Zabbix system architecture

As we all know, Zabbix is an excellent monitoring system, which can monitor devices and applications in the Internet.

Before introducing its implementation in detail, let's take a look at its structure diagram:

As can be seen from the image above, the green part is the monitored device, which can be a server, switch or network printer.

These monitored devices are called Host, and the grouping of devices is called Host Group, which can be divided according to region, computer room, and application.

As you can see from the orange section-the monitoring method, Zabbix Agent is installed for each Host,Zabbix.

It is the client of Zabbix on Host, which is responsible for uploading the information that Zabbix needs to monitor to Zabbix Server for analysis and processing.

However, not all network devices can install Zabbix Agent. For devices that cannot be installed, as long as they support SNMP (Simple Network Management Protocol, simple Network Management Protocol) or IPMI (Intelligent Platform Management Interface, Intelligent platform Management Interface), they can also be monitored.

In addition, if you need to monitor Java applications, you can also do so through JMX.

As can be seen from the orange part of the monitoring content, Zabbix supports Java application monitoring through JMX, hardware device monitoring through IPMI, and network devices through SNMP.

There is a two-way arrow between the green area and the blue Zabbix Server, and the way from Zabbix Agent to Zabbix Server is called a general structure, similar to the so-called Cbig S architecture.

But in practical applications, more distributed architecture is used, that is, through the green area, first connect to the yellow Zabbix Proxy, and then connect to the blue Zabbix Server this path.

In the orange area on the right side of the figure, is the monitoring server for Zabbix, where Zabbix Server is mainly responsible for configuring and receiving / sending monitoring information (more details will be described later).

The processed information is stored in Database, where the Database can specify MySQL or Oracle and other database sources.

In addition, Zabbix UI display configuration and monitoring information will be provided. Not only that, but also provides Zabbix API for third-party applications, through which Zabbix rules can be customized.

Of course, in terms of stability, the HA mechanism of Master,Slave can be established through software such as Keepalive.

The process of building monitoring system based on Zabbix

Earlier, we introduced the architecture of Zabbix through a large picture, and we have a detailed understanding of the basic working principles of Zabbix.

Following this line of thinking, let's take a look at the Zabbix architecture installation and configuration steps:

PS: the following describes the entire deployment and configuration process of Zabbix. The installation and configuration parts are not marked with specific commands.

If there are students who need the installation and configuration process, you can download the Zabbix user manual, which is not described here because of the space.

Zabbix Server/Agent/UI installation configuration

On the Zabbix monitoring server, install Zabbix Server and Zabbix UI (Web).

Zabbix Server is used to receive and send monitoring details, and Zabbix UI (Web) is used to configure the functions of Zabbix Server.

At the same time, install Zabbix Agent on the monitored equipment. After it is installed, the two parameters Server and ServerActive need to be configured through the zabbix_agenttd.conf file.

Because Zabbix Agent has passive mode and active mode. Passive mode, where Zabbix Server fetches data from the Zabbix Agent.

In active mode, Zabbix Agent actively uploads information to Zabbix Server. Therefore, the contents of both parameters refer to the IP address of the Zabbix Server.

Server configures IP,ServerActive for passive mode Zabbix Server and IP for active mode Zabbix Server.

Of course, in addition to this, you need to update the firewall configuration and open the Zabbix access port (10050 and 10051).

Finally, give the monitored device (Host) a Hostname, which will be used when configuring the Zabbix Server side.

Host Groups/Hosts configuration

Once the Zabbix Agent is done, go back to the Zabbix Server for configuration. The premise is that Zabbix Server and Zabbix UI (Web) have been installed and the configuration interface can be accessed through Zabbix UI (Web).

As mentioned above, each device being monitored is a Host, so multiple Host are grouped in some way, which is called Host Groups. The grouping methods here are geographical location, business unit, machine use, system version, and so on.

Create a Host Groups, and then create a Host in it. This Host is the conceptual device on the Zabbix Server of the device that just installed Zabbix Agent.

When configuring Host, you need to note that the HostName here is consistent with the HostName defined in the monitored device for easy identification. The configured IP is the IP of the monitored device, and the port number is 10050.

Items configuration

After configuring Host, you need to tell Zabbix what data is in the monitoring Host. The data to be monitored is the monitoring item, also known as Items.

Items configuration includes information such as the way of monitoring data, the data type of values, the interval between obtaining values, the preservation time of historical data, the preservation time of trend data, the grouping of monitoring Key and so on.

First, you need to select Type, which is the type of Zabbix client to listen on. Generally speaking, after installing Zabbix Agent, this type is Zabbix Agent. You can also choose SNMP,IMPI or other types.

Second, you need to pay attention to the choice of Key, Key is to determine the specific monitoring items, it is unique to the same Host.

Zabbix comes with some Key to choose from by default, for example: vm.memory.size [total], which is to get the Key of memory size.

Because it is configured for Host, the corresponding Host IP and Port are also specified. In addition, there is some other data to configure.

For example: data update interval, update cycle, historical data preservation days, trend data preservation days, and so on.

Careful students will find that there is also an option for Applications in the above picture. It is actually a collection of Items, for example: to monitor MySQL, you can define an Application of MySQL.

Put all the relevant Items, including availability of MySQL,disk space,processor load,transactions per second,number of slow queries, into this Application and the Chinese side will choose and manage it.

Trigger configuration

As mentioned earlier, Items is used to configure what data to monitor without judging whether the data is normal or not. Then, the function of Trigger is to judge the collected data.

Judgment rules or thresholds are usually set, and an event occurs once a certain rule is met or the corresponding threshold is exceeded.

At the same time, Action performs operations on Trigger that meet the criteria. These rules are defined by regular expressions.

Schematic diagram from receiving messages to triggering actions

After the information is judged by the expression, there are two types of Trigger states, OK (normal) and PROBLEM (abnormal).

Each Trigger corresponds to an Items, and each Items corresponds to multiple Trigger. At the same time, Trigger can set different event levels, and multiple alarms can be set according to these levels.

When configuring Trigger, the main thing is to add regular expressions. Zabbix generates the corresponding regular expression based on the Function of the corresponding Item.

Trigger will be configured according to the monitored content (Item). For example, Item is to detect the number of Linux logins. Select Item as "Template OS linux:Number of logged in users".

The corresponding Function is Last (most recent) T value is = N. It means to get the number of recently logged in T, and trigger Trigger when T is equal to N.

This N is the value we need to configure, such as filling in 2. That is, Trigger is triggered when the number of logins equals 2.

When you have configured it, you will generate a regular expression similar to the following figure, {Template OS Linux:system.users.num.last ()} > 2.

The whole process does not require you to enter expressions, just through selection and configuration can be done.

It will be used for special situations, for example, if the routing of the entire IDC server room fails, then the network status of all the machines in the server room will be abnormal, and Zabbix Server will receive a large number of abnormal alarms. Operation and maintenance personnel will be inundated by alarm messages and do not know the real cause of the failure.

At this point, you can select the corresponding rule in Dependencies and check the Multiple PROBLEM events generation option.

After that, you will receive an alarm message, "so-and-so IDC computer room router X is malfunctioning" and aggregates other alarm messages.

Action configuration

If Trigger defines the rules that trigger an event, then Action is the action after the event is triggered. That is, when the Trigger condition is met, Action will perform some actions.

For example: send event notifications (SMS, nails, email), remotely execute commands (restart the service).

There are many types of events in Zabbix, and Trigger is just one of them, such as automatically discovering monitoring devices, automatically registering monitoring devices, and so on. So, first choose the source of the event, and of course here we choose Trigger as the source.

Action Select event Source

Then, fill in the basic information of Action. For example: name, subject, default message content, exception recovery topic, and the corresponding message content. The filling here can be a string, but macros are more likely to be used.

It is actually a replacement character, such as {TRIGGER.STATUS} for the status of the trigger and {ITEM.NAME} for the name of the monitoring item. The final information is formed through the splicing of these macros and strings.

Next, there is the Condition of the condition. Because Action can face one or more Trigger, each Trigger has one or more conditions every day.

In order to ensure its flexibility, conditions can be combined for AND,OR,AND/OR.

For example, you can use the "AND" condition to combine the Maintenance status not in maintenance (machine is not in maintenance state) and Trigger value = PROBLEM (trigger exception) two conditions (Condition), meaning that subsequent actions are triggered when both conditions are met. Finally, there is the configuration of Operation. It includes the time interval for performing the operation, the number of times it is executed, the interval between each execution, the type of operation (sending messages, executing commands), which users / user groups to send, and so on.

Template configuration

If there are many monitoring devices that need to be configured, there is a workload. As a result, Zabbix will put together rule items such as the same Item,Trigger,Application, and there will be a Template.

When you need to configure monitoring items for the same type of device, you can choose a ready-made template. Thus, the workload of operation and maintenance engineers is reduced. When creating a template, you need to enter the template name and the corresponding grouping.

If you need to inherit templates, you can configure them in Linked template. Template inheritance can be understood as template nesting.

For example, a basic template is defined in advance, and Item is configured with CPU, memory, hard disk, network card and other information.

If you need to extend other templates to this base template, such as MySQL monitoring template or Web monitoring template. Then when configuring the template, you can inherit from the underlying template without redefining the template.

After the template is created, you can add information such as Item,Trigger,Application in a way similar to Item,Trigger configuration.

The large section of text above describes the process of building a monitoring system by Zabbix.

In order to make it easier to remember, here is a summary.

Zabbix builds a monitoring system, first installs Zabbix Agent to Host to collect information, Zabbix Server is used to obtain information, and Zabbix UI (Web) is used to display and configure information.

After Zabbix Agent has configured the IP and Port of the monitoring server in Host, go back to the Zabbix Server and configure the Host (monitored device) to be monitored through Zabbix UI (Web).

Configuration in turn: Item (what data to monitor), Trigger (fault trigger condition), Action (fault trigger action).

Zabbix monitoring mode

After learning about the architecture of Zabbix and the process of building Zabbix, let's take a look at how Zabbix is monitored. The Zabbix Agent monitoring mentioned above is only one way of Zabbix monitoring.

According to different situations, Zabbix also provides many ways, such as SNMP,IPMI,JMX. Even the way of Zabbix Agent is divided into active and passive.

Zabbix Agent monitoring mode

The methods include Active (active mode) and Passive (passive mode). The communication between Zabbix Server and Zabbix Agent is done through Zabbix proprietary protocol, and the data format is JSON.

① Zabbix Agent passive mode

By default, Zabbix Agent works in passive mode, and Zabbix Server gets information from Zabbix Agent.

After installing Zabbix Agent, the IP of passive data acquisition is set through the Server parameter in the zabbix_agentd.conf file.

Zabbix Server opens a TCP connection. Server sends a Key (agent.ping\ n) to Zabbix Agent. The Zabbix Agent receives the request and responds to the request by sending a message of content to the Zabbix Server. Server receives the returned data and processes it. Server closes the TCP connection. ② Zabbix Agent active mode

In this mode, Zabbix Agent will actively report monitoring information to Zabbix Server. You can configure the IP of Zabbix Server through the ActiveServer parameter in the zabbix_agentd.conf file.

At the same time, you need to configure the Type of Items on Zabbix Server, which can be set to Zabbix agent (active).

Still take a look at the active flowchart:

Zabbix Agent establishes a TCP connection to Zabbix Server. The Agent request is a list of data to be detected. Server responds to Agent by sending a list of Items, including Item key and delay. Agent responds to the request. Server receives the request data and closes TCP. SNMP monitoring mode

It is a standard protocol for managing IP-based network devices, including: routers, switches, UPS, printers. Especially when the monitored device is unable to install Zabbix Agent.

Let's take a look at the architecture of SNMP first.

NMS is Network Management System (Network Management system, also known as Network Management Station), which is integrated into Zabbix Server.

Agent is the agent for SNMP access, which provides the SNMP capability for the device and is responsible for the device to communicate with the NMS.

MIB (Management Information Base) is a database that contains variables for the maintenance of managed equipment. For example: memory space, disk size.

It usually exists in a tree structure. Each leaf node stores a piece of data and uniquely identifies a record through OID (Object Identifier).

To represent the System parameter in general, pass 1.3.6.1.2.1.1. If it is a private enterprise record, it is below 1.3.6.1.4.1.

NMS communicates with the Agent on the device through SNMP to obtain / modify the information on the MIB. There are currently three versions of SNMP, each of which is gradually upgraded from the previous version.

IPMI monitoring mode

IPMI (Intelligent Platform Management Interface), the intelligent platform management interface, was originally an industrial standard adopted by the peripherals of enterprise systems in the Intel architecture, and later became a general standard in the industry.

Users can monitor the physical characteristics of the server through IPMI, such as temperature, voltage, fan working status, power supply and so on.

IPMI is independent of CPU BIOS and operating system, that is, in the absence of operating system and management software, it can still monitor hardware information. The specific configuration in Zabbix is not described here.

JMX monitoring mode

JMX (Java Management Extensions) is a framework for embedding management capabilities into Java applications. It is also a standard set of agents and services that users can use in any Java application.

In Zabbix, the acquisition of JMX monitoring data is realized by a special agent program, that is, Zabbix Java Gateway is responsible for collecting data, and it communicates with JMX's Java program to obtain data.

Here are several steps to deploy JMX, as follows:

Choose a separate Server to install Zabbix Java Gateway, preferably on a different server from Zabbix Server. On the server where Zabbix Java Gateway is installed, configure the parameters for the zabbix_java_gateway.conf file. Mainly the IP and Port of the listening server of Gateway. The goal is to get Gateway to find the device to listen to. Configure the parameters of zabbix_server.conf in Zabbix Server. The main purpose is to configure IP and Port of Gateway, as well as the number of processes monitored by Java. The goal is to get Server to find Gateway. On the monitored device, open the JMX protocol for the Java application. Go back to Zabbix UI (Web) to configure the Java application that JMX monitors.

These are all the contents of the article "how to install and configure Zabbix". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

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

Development

Wechat

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

12
Report