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 configure monitoring items and aggregate graphics in Zabbix

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

What the editor wants to share with you this time is how to configure monitoring items and aggregate graphics in Zabbix. The article is rich in content, and interested friends can learn about it. I hope you can get something after reading this article.

1. Install Zabbix Agent to monitor the local computer

Install agent softwar

Unlike the server side, Agent only needs to install the zabbix-agent package

Cat / etc/yum.repos.d/zabbix.repo [zabbix] name=Zabbix Official Repository-$basearchbaseurl= https://mirrors.aliyun.com/zabbix/zabbix/3.4/rhel/7/$basearch/enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591 [zabbix-non-supported] name=Zabbix Official Repository non-supported-$basearchbaseurl= https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/enabled=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY -ZABBIXgpgcheck=1curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591-o / etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX-o / etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIXyum-y install zabbix-agent zabbix-get

two。 Configure Agent and start

Vim / etc/zabbix/zabbix_agentd.confServer=39.108.140.0 # passive mode zabbix-server-ipServerActive=39.108.140.0 # active mode zabbix-server-ipHostname=You-Men # Agent side hostname Whether the final name UnsafeUserParameters=1 # displayed on the monitoring page restricts the user-defined keys to use the special character systemctl restart zabbix-agentnetstat-antp | grep agenttcp 00 0.0.0.0systemctl restart zabbix-agentnetstat 10050 0.0.0.0antp * LISTEN 3898/zabbix_agentd tcp6 00: 10050: * LISTEN 3898/zabbix_agentd

3. Configure snmp (you don't have to)

In addition to agent, zabbix can also obtain data through snmp. In order to enable zabbix to monitor more information, start the local snmp function.

Yum-y install net-snmp net-snmp-utilsvim / etc/snmp/snmpd.confcom2sec notConfigUser 39.108.140.0 publicaccess notConfigGroup "" any noauth exact all none noneview all included. 1 80systemctl restart snmpd & & systemctl enabel snmpdss-anup | grep snmp # 161Port, udp protocol # tests whether the snmp protocol is working properly # snmpwalk-v1-c public 39.108.140.0. 1.3.6 # uses v1 version and the Community is public to walk the .1.3.6 branch of 192.168.0.1. Snmpwalk-V2C-c public 39.108.140.0 uses the V2C version, the community is public, and walk 39.108.140.0. #-v displays the current SNMPWALK command line version. #-# get the interface type of cisco device 39.108.140.0

Next, we go to the web interface to configure how to monitor the local host. We see that the interface is 127.0.0.1, but our configuration file is 39.108.140.0. We make the two IP consistent. Click 3 to go in and modify it.

After the update, skip to the following page, wait a moment, reload the page and the usability will be green.

At this point, monitoring the local host is complete. If you want to see the network card traffic monitoring the local host, do the following step 2. Mouse in turn according to the number of points, if you want the monitoring item is Chinese, you can do Zabbix fault example 1, but version 4.4 has improved compared with the previous version, the monitoring item is not garbled, but English.

If you want to change this garbled code into normal Chinese

If windows searches simkai.tff Chinese italics on disk C, copy / upload it to the server, and then cp to zabbix font directory 3.* version: cp / root/simkai.ttf / usr/share/zabbix/fonts/# different installation methods, the path will be different, so you can directly find /-type d-type fonts to find similar folders That's it # pay attention to font permissions vim / usr/share/zabbix/include/defines.inc.php define ('ZBX_GRAPH_FONT_NAME',' simkai') Define ('ZBX_FONT_NAME',' simkai')

4.Zabbix monitors remote hosts

If zabbix-agent is not installed on the remote host, the package can be passed through the zabbix-agent machine installed on it.

Download yum- y instlal yum-utils# to the specified directory yum install zabbix-agent-y-- downloadonly-- downloaddir=/root1. Install zabbix agent # method 1 (foreign source zabbix does not seem to be able to download the package Use the above source): # rpm-Uvh https://repo.zabbix.com/zabbix/4.4/rhel/7/x86_64/zabbix-release-4.4-1.el7.noarch.rpm yum clean all yum-y install zabbix-agent # method 2: (use the zabbix-agent package sent from another machine to install directly on rpm) rpm-ivh zabbix-agent-4.4.1-1.el7.x86_64.rpm# modify the zabbix-agent configuration Set and start the service vim / etc/zabbix/zabbix_agentd.conf Server=192.168.244.144 Server=192.168.244.144 / / IP address of the monitoring host Hostname=agent1.zabbix.com / / the name of the monitored host to the monitoring host UnsafeUserParameters=1 systemctl start zabbix-agent ss-antp | grep 1005operations next we go to the web side to operate # for easy management and easy viewing of the service. In the monitoring system, similar hosts are often divided into the same host group according to the monitored host role or other attributes.

If there is no red warning for availability for a while, it means that the host has been added, but since there is no template mounted and monitoring items created, we then try to mount the templates and then create monitoring items.

We install a nginx on the agent side, then go to the zabbix web side to find the template and mount it.

Yum-y install nginxsystemctl start nginx

5. Test monitoring host

Next, let's use a browser or elinks to access nginx, generate some data, and then go to zabbix to view the changes.

Elinks-dump 116.196.83.113

When we customize the Key monitoring items in the future, we will first see if there is any data coming from the latest data. if the data will not come, don't mention the graphic trigger alarm.

At this point, add the local host, the remote host, create the host group, and mount the template

6.Zabbix monitoring item

Brief introduction of Monitoring items (Items)

Monitoring items are the basis for obtaining data in Zabbix. If there are no monitoring items, there will be no data-- because a host can only define a single index or data that needs to be obtained, monitoring items are suitable for data collection, and multiple similar monitoring items can be defined as an application set, such as mysql addition, deletion, modification, query and meter reading per second, and the table writing speed can be written into a Mysql application set.

For the example of a monitoring item, you need to enter the following necessary information

Name

Enter CPU Load as the value, which will be displayed in the list and elsewhere as the monitor item name.

Value

Manually enter system.cpu.load as the value, which is a technical name of the monitoring item to identify the type of information obtained. This specific value needs to be one of the predefined values of Zabbix Agent.

Https://www.zabbix.com/documentation/3.4/manual/config/items/itemtypes/zabbix_agent # this URL is the predefined value of the zabbix official website.

Information type

Select Numeric (float) here, which defines the format in which the data is obtained

You also need to reduce the number of days for monitoring items to retain history, 7 or 14 days. For databases, the best practice is to avoid keeping too much historical data.

After we have selected the data type, we temporarily keep the default values of the other options.

1 > disk capacity Units is generally B

2 > Network card traffic unit is bps

3 > Mysql visits per second qps, for example, MySQL per second select,insert Mysql serlect

Click add, and the new monitoring item will appear in the list of monitoring items.

7. View data

When a monitoring item is defined, you may wonder what value he got. Go to the monitoring home page, click on the latest data, and select the appropriate host. See if the data can come over and whether it is the type you want.

Chart

After the monitoring item has been running for a period of time, you can view the visual chart. If you do not have one, you can create one yourself. Here is a detailed description

8. Common monitoring items

1. Server network interface incoming and outgoing traffic and total traffic net.if.in [if,] net.if.out [if,] net.if.total [if,] 2. Server startup partition remaining space vfs.fs.size [fs,] vfs.fs.size [/ boot,free] 3. Monitor virtual machine memory vm.memory.size [] vm.memory.size [total vm.memory.size [free] vm.memory. Size] 4. Server service status net.tcp.listen [port] net.tcp.port [, port] net.tcp.service [service,] net.tcp.service.perf [service,] 5. The number of server processes proc.num [,] zabbix_get-s 39.108.140.0-k proc.num 121 zabbix_get-s 39.108.140.0-k proc.num [, run] 3 zabbix_get-s 39.108.140.0-k proc.num [, sleep] 1186. Server CPU status (floating point, unitless) system.cpu.intr system.cpu.load [,] system.cpu.num system.cpu.switches system.cpu.util [,] zabbix_get-s 39.108.140.0-k system.cpu.load [all,avg1] 0.000000 zabbix_get-s 39.108.140.0-k system.cpu.load [, avg5] 0.0100007. Disk IO condition vfs.dev.read [device,] vfs.dev.write [device,] zabbix_get-s 39.108.140.0-k vfs.dev.read [/ dev/vda1] 8. Monitoring file modifies vfs.file.chsum [file] # such as monitoring / etc/passwd, / etc/group file to know if a new user creates vfs.file.md5sum [file] vfs.file.size [file] # is usually used to monitor the log vfs.fs.size [fs,] 9. The sum of the disks.

10. Monitor network card traffic

We first create an application set, so that the network card created after upload, download, total traffic will not be very messy, all in a Network application set, and can be exported into xml files, put on other zabbxi hosts can be directly used.

What we are doing now is to use zabbix to install the built-in monitoring items, similar to a custom Key, by writing a monitoring script and passing parameters. Each key value is equivalent to a monitoring script.

Next, let's check-- > check the latest data in the host group. We can see that there is data in the following figure.

Downlink broadband and uplink broadband.

Download is in, downlink broadband, what you send out is out, as a server, uplink broadband must be high, at home, downlink broadband is high, for the server, it needs to receive very few data packets and reply a lot of data packets, while at home we send out a very small data packet and return the entire web page.

Next, let's create a network card to output traffic, and then make them into an icon to display them graphically.

Next, we go to monitor to check the latest data, and we can form this habit, because when the latest data comes, it shows that there is no problem with the flow of the data. If the data does not come over, you create the graph, and the chart says that there is no data. You think you have to wait for a while, wasting time affects efficiency.

As you can see, both monitoring items have data, so let's create a graph.

Next, let's look at the monitoring-> graph, select the corresponding group, the corresponding host and the created graph.

This host can install a nginx, then upload a larger picture to the root of the site, and then visit it to view the network fluctuation chart.

Or we directly upload a larger rpm, tar package to other hosts. It looks obvious this way.

11. Monitoring CPU

As before, create a set of CPU applications to facilitate management and induction

Next, we create the monitoring item of the application set, the number of cpuintr,cpu interrupts.

Next, we create a cpu load monitor every other minute.

From the following figure, we can see that there is data for each monitoring item. Next, let's create a graph.

We can see that the data can be converted into icons in real time, so let's do an aggregate graph.

twelve。 Create an aggregate graphic

At this point, our first constructor is completed, and the other constructor is the same. Instead of writing here, look directly at the result diagram.

Create system-defined monitoring items, similar to the above two, just do more. If you are not used to using officially defined key, we can write our own scripts to customize key according to the company environment. This chapter ends.

After reading this article on how to configure monitoring items and aggregate graphics in Zabbix, if you think the article is well written, you can share it with more people.

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