In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This blog post is mainly introduced by Zabbix's Chinese interface!
I. Management and use of templates
Templates are the core of Zabbix, because they integrate all the content to be monitored and the graphics displayed, and so on. After the installation and deployment of Zabbix, there are many templates (network device templates, operating system templates, common application software templates) that can meet about 80% of our application needs, so it is generally not necessary for us to create templates separately.
As shown in the figure:
Templates are composed of many built-in projects, and the basic built-in projects are composed of application sets, monitoring items, triggers, graphics, aggregate graphics, automatic discovery, Web detection, linked templates, and so on. In these eight parts, monitoring items, triggers, graphics, automatic discovery of these four parts are key points, but also difficulties. The following focuses on the specific implementation process of these four parts.
Most of the templates that come with Zabbix can be used directly, so there is no need to have an in-depth understanding of each template, just to focus on some commonly used templates. The following focuses on the three types of templates that are often used to ensure key learning.
1) there are three types of templates commonly used: 1) templates for monitoring system status
Template OS Linux / / A pair of monitoring templates for Linux system
Template OS Windows / / A pair of monitoring templates for Windows system
Template OS Mac OS X / / A pair of monitoring templates for Mac OS X system
Template VM VMware / / A pair of monitoring templates for VM VMware system
2) templates for monitoring networks and network devices
Template Module Generic SNMPv1 / / enable the template for SNMPv1 monitoring
Template Module Generic SNMPv2 / / enable the template for SNMPv2 monitoring
Template Module Interfaces Simple SNMPv2
Template Net Cisco IOS SNMPv2
Template Net Juniper SNMPv2
Template Net Huawei VRP SNMPv2
3) templates for monitoring applications and services
Template App HTTP Service / / A monitoring template for httpd services
Template DB MySQL / / A monitoring template for Mysql services
Template App SSH Service / / A monitoring template for SSH services
Template Module ICMP Ping / / A monitoring template for host Ping
Template App Generic Java JMX / / A monitoring template for Java services
Template App Zabbix Agent / / A template for monitoring the status of Zabbix Agent
Template App Zabbix Server / / A template for monitoring the status of Zabbix Server
The templates mentioned above can be used flexibly, and they are also the basis of our monitoring, so we should skillfully master their usage and monitoring characteristics.
2) create an application set
Take the Linux system template as an example, as shown in the figure:
After entering the application set, you can see the existing application set, or you can create a new application set.
The creation of an application set is very simple. It is actually a collection of monitoring items in a template. For example, if you want to monitor the attributes of CPU, you can create an application set for CPU, under which you can create multiple monitoring items for CPU.
The emergence of the application set is mainly to facilitate the classification and management of monitoring items. When there are multiple monitoring items and multiple monitoring types need to be monitored, it is necessary to create an application set.
3) create a monitoring item
As shown in the figure:
As can be seen from the figure, each monitoring item corresponds to a key value, that is, the specific content to be monitored. The writing of the key value is unified. Zabbix has many key values for different monitoring items, and users can also customize the key values. In addition, each monitoring item can also add a corresponding trigger, that is, if the monitoring item needs an alarm, you can add a trigger. The trigger makes a special effort to trigger the alarm. Of course, it does not mean that every monitoring item must have a trigger, depending on the content of the monitoring item.
As shown in the figure:
1) name: the name of the monitoring item that is created, which can be customized
2) Type: set how to monitor secondary monitoring items. There are many monitoring types available for zabbix, such as zabbix client, zabbix client (active), simple check, SNMP client, zabbix collector and so on. Zabbix client monitoring has also become zabbix client (passive) monitoring, which is realized by installing zabbix agent on the host to be monitored, and then zabbix server takes the initiative to grab data. This is the most commonly used type of monitoring. And zabbix client (active) monitoring also needs to install zabbix agent on the monitored machine. It's just that zabbix agent actively reports data to zabbix server, which is different from zabbix client (passive) monitoring.
3) key value: you can use the default key value of zabbix, or you can customize your own key value. Zabbix comes with many key values, which can meet 90% of our needs. For example, if we monitor the status of a port on the server, we can use the key value of "net.tcp.service.perf [service,]". This key value is included with zabbix. If you need to see more zabbix key values, you can use this key value. You can click the "Select" button after the "key value" option, and all the key values that come with zabbix will be displayed.
As shown in the figure:
As you can see, the key values included in zabbix are divided into different monitoring key types according to the type of monitoring, and the meaning of each key value is also described in detail. We can select the corresponding key value according to the monitoring content we need.
Take the key value of net.tcp.service.perf [service,] as an example, net.tcp.service.perf is the name of the key, and the content in parentheses is the monitoring item of the key. The meaning of each option is as follows:
1) server: indicates the service name, including ssh, ntp, ftp, http, pop, imap, etc.
2) ip: indicates the IP address. The default is 127.0.0.1, but it is not added.
3) port: indicates the port, which corresponds to the standard port for each service by default
For example, if we monitor a httpd service, we can write:
Net.tcp.service.perf [http,80]
4) Information type: the floating point type of the information type returned by this key value, so select floating point number.
5) Update interval: this is mainly used to set how often the monitoring data is updated. It can be set according to the sensitivity of the monitoring items. By default, it is updated every 30 seconds.
6) Application set: at the end of creating a monitoring item, there is a choice of an application set, that is, to put this monitoring item into that monitoring category, you can select an existing application set or add it to a new application set! (this time, add it to the http server application set, and the screenshot will not be attached. Pay attention.)
After all the settings are complete, click add!
Monitoring items can be added to an existing template, or you can add monitoring items to a newly created template, or you can create monitoring items under a host.
The recommended practice is to create a new template, and then add the required application set and monitoring items under this template, and then link the created template to the host when you add the host later. The reason why it is not recommended to create monitoring items under the host is that if there are multiple hosts and each host has the same monitoring content, you need to create the same monitoring items under each host.
Summary: to build zabbix monitoring, the recommended practice is to first create a template, then create required monitoring items and triggers under this template, and finally link the template directly to each host when adding hosts, so that each host will automatically link all monitoring items and triggers in the template.
4) create a trigger
Trigger is a setting for fault alarm. After adding a monitoring item to the trigger, if there is a problem with the monitoring item, the trigger will be activated, and then the trigger will automatically connect the alarm action and finally trigger the alarm.
Triggers are also recommended to be created in templates. Take the Linux system template as an example, as shown below:
As shown in the figure, there are several small options, such as the severity level of the trigger, the name of the trigger, the trigger expression and so on. The difficulty here is to write the trigger expression and learn to write the trigger expression. First of all, you need to understand the machine meaning of some functions commonly used in expressions.
There are diff, avg, last, nodata and other identifiers in the figure, which are the functions in the trigger expression. Here is a brief introduction to some commonly used trigger expression functions and their meanings.
1) diff
Parameters: no parameters are required
Supported value types: float, int, str, test, log
Function: a return value of 1 indicates that the most recent value is different from the previous value, that is, the value changes, and 0 means no change.
2) last
Parameter: # num
Supported value types: float, int, str, test, log
Purpose: get the most recent value. "# num" represents the Nth most recent value. Note that the current # num has a different meaning from the # num of some other functions, for example:
Last (0) or last () is equivalent to last (# 1) to get the latest value, last (# 3) represents the last third value (not the last three), note that the last function will get different values with different parameters, and # 2 means the penultimate new data. For example, from old to latest, the value is 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, last (# 2), 9, last (# 9), and 2.
In addition, the last function must contain parameters
3) avg
Parameter: seconds or # num
Types of support: float, int
Function: return the average over a period of time
For example, avg (5) represents the average of the last five seconds, avg (# 5) represents the average of the last five times, and avg (3600, 86400) represents the average of one hour before the day.
4) change
Parameters: no parameters required
Supported types: float, int, str, text, log
Function: returns the difference between the most recently obtained value and the previously obtained value. The returned string 0 is equal and 1 is different.
For example: change (0) > n indicates that the difference between the recently obtained value and the last worthwhile value is greater than n, where 0 means ignoring the parameter
5) nodata
Parameter: seconds
Supported value type: any
Function: to detect whether the data can be received. When the return value is 1, no data is received at the specified interval (the interval should not be less than 30 seconds), and 0 indicates that the data is received normally.
6) count
Parameter: seconds or # num
Supported types: float, int, str, text, log
Function: returns statistics of values within a specified time interval
For example:
Count: indicates the number of values obtained in the last 10 minutes
Count (600, 12): indicates that the number of values obtained in the last 10 minutes is equal to 12
Where the first parameter is the specified time period, and the second parameter is the sample data
7) sum
Parameter: seconds or # num
Supported value types: float, int
Purpose: returns the sum of the values collected in the specified time interval, which as the first parameter will support seconds or the number of worth of collection (starting with #)
For example:
Sum: represents the sum of all values received within 600 seconds
Sum (# 5): represents the sum of the last five values
Once you understand the meaning of the trigger expression function, you can create and write trigger expressions, as shown in the figure:
First enter the trigger name, and then mark the severity of the trigger, there are six levels of division, here is the general verification, and then is the writing of the expression, click the "add" button after the expression, you can begin to build the expression. On the build expression page, first select to add a trigger to the monitoring item, and click the "Select" button below the "condition" interface. You can open all the monitoring items that have been added, select the monitoring item you just created, and then start selecting the conditions of the trigger expression, that is, the trigger expression function introduced above, and click the "function" drop-down menu. you can find many trigger expression functions, so how to choose the function, of course, according to the meaning of the monitoring item and the value returned by the monitoring.
The return value of the custom monitoring item "httpd server 80 status" is floating point. When the service failure returns 0, the number of seconds it takes to connect to the service when the monitored service is normal. Therefore, we will return 0 as a criterion, that is, the return value is 0 as the condition of the trigger expression, to get the latest return value of the monitoring item, that is to use the last () function, so choose the last () function, and then, there is a "interval (seconds)" option, which is kept by default, focusing on the final "result" Here is to set the return value of the last () function to trigger. According to the understanding of the previous monitoring, the last () function returns 0 indicates service failure, so you can fill in 0 here!
In this way, a trigger expression is created, the complete contents of the trigger expression:
{Template OS Linux:net.tcp.service.perf [http,80] .last ()} = 0
It can be seen that the trigger expression is composed of four parts, the first part is the name of the template or host, the second part is the corresponding key value of the monitoring item, the third part is the function of the trigger expression, and the last part is the value of the monitoring item. Meaning of this expression: if the latest value obtained by port 80 of the http service is equal to 0, then this expression holds true, or returns true
After the trigger is created, the core of the two monitoring is basically completed, followed by the creation of "graphics", "aggregation graphics" and other options, which are too simple, which is omitted!
5) create host group and host
As shown in the figure:
After the creation is completed, as shown below:
As you can see, under the host, there are already application sets, monitoring items, triggers, graphics and other options and contents, that is, after the link template is automatically imported into the host, of course, you can also create or modify application sets, monitoring items, triggers, graphics and other content under the editing interface of the host.
6) trigger action configuration
The configuration of actions is one of the key points of zabbix. According to different event sources, actions can be divided into trigger actions, automatic discovery actions, automatic registration actions and so on. First, the configuration method of trigger actions is introduced, as shown in the figure:
A trigger is created!
7) alarm medium configuration
The alarm medium is used to set up the way to monitor the alarm, that is, how the alarm information can be sent. Common warning media are: Email, WeCom and so on.
The default is to send alarms through Email. The advantage of email alarms is that they are simple and free. In addition, email client tools can be downloaded on many mobile phones. Through simple email alarm settings, you can almost receive alarm messages in real time.
As shown in the figure:
At this point, the process of adding a monitoring item in zabbix is complete!
Finally, let's sort out the next monitoring addition process. The general procedure is as follows: first, create a template, or add a new monitoring item based on the default template, and then add a trigger to the monitoring item. if necessary, you can add graphics to this monitoring item, and then start adding host groups and hosts, referencing existing or new templates in the host Then create the trigger action, set the message sending event, and finally. Setting the alarm media and configuring the media for sending messages is a complete Zabbix configuration process.
8) Monitoring status view
When a monitoring item is configured, how do you check to see if the data has been obtained? As shown in the figure:
This graphic curve is generated automatically and does not need to be set!
If you need to view a graphical display of other monitoring items, you can do the following:
From this interface, you can see the basic monitoring information of the operating system, such as CPU, memory, file system, Swap, and so on, and we do not need to add these basic monitoring, because zabbix has been installed for us by default!
-this is the end of this article. Thank you for reading-
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.