ZABBIX-agent installation and configuration

Table of contents

zabbix-agent installation

After we start the configuration of the monitoring terminal, we need to set up our monitored terminal. We install zabbix-agent on the monitored host, set up its monitoring server, and add it to the server. It can be incorporated into our monitoring system.

1. Install zabbix-agent

[root@zabbix-agent-node1 ~]# wget https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
[root@zabbix-agent-node1 ~]# yum install zabbix-agent zabbix-sender -y

2. Modify the configuration file

[root@zabbix-agent-node1 ~]# cd /etc/zabbix/
[root@zabbix-agent-node1 zabbix]# cp zabbix_agentd.conf zabbix_agentd.bak
[root@zabbix-agent-node1 zabbix]# ls
zabbix_agentd.bak  zabbix_agentd.conf  zabbix_agentd.d
[root@zabbix-agent-node1 zabbix]# vim zabbix_agentd.conf   ----修改如下
Server=10.8.156.38 zabbix监控端的地址 
ServerActive=10.8.156.38 主动模式 zabbix-server-ip
Hostname=zabbix-agent-none1 
UnsafeUserParameters=1 是否限制用户自定义 keys 使用特殊字符 1是可以启用特殊字符 0是不可以启用特殊字符
EnableRemoteCommands=1 是否允许别人执行远程操作命令,默认是禁用的,打开的话会有安全风险.

Whether to allow others to execute remote operation commands is disabled by default, and there will be security risks if it is opened. After the modification is completed, we save and exit. Then you can start the service:

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

3. Create a host group

 

 

 

 

 

4. Create a host 

 

 

 

 

5. Create an application set 

 

 

 

 6. Create monitoring items

To create an item in the Zabbix admin page:

  • Go to: ConfigurationHost
  • Click the monitoring item in the row where the host is located
  • Click Create Monitoring Item in the upper right corner of the screen
  • Enter the parameters of the monitoring item in the form

You can also open an existing monitoring item, click the clone button, and then rename and save it.

If any monitored item wants to be monitored, it must be defined on the zabbix-server side to be able to connect to the zabbix-agent side and be able to obtain commands. Or it is defined on the agent side to allow the server side to obtain commands. Generally, they are built-in commands, and they all have corresponding names, which we call them key.

 

a. Create a monitoring item without parameters:

Time the monitoring system has been started

 

 

 

Regarding the key value (key value), we can set it directly on the web page (automatically executed by the server),

However, it is best to use the command line command (manual execution) to obtain it in advance to ensure that the key value of this monitoring item can get the monitoring data, which means that this indicator can be monitored;

[root@zabbix-server ~]# yum -y install zabbix-get
[root@zabbix-server ~]# zabbix_get -s 10.8.156.38 -k  system.uptime -p 10050

8429

If you can get the value, you can click Add; wait for a while, click "Monitoring" --> "Latest Data"

You can see the running time of the monitored terminal node1;

 

 

b. Create a monitoring item with parameters

Case 2: Monitor file size

The monitored terminal node1 first creates a 1G file

[root@zabbix-agent-node1 ~]# dd if=/dev/zero of=/home/test.txt bs=1M count=1024
[root@zabbix-agent-node1 ~]# ll -h /home/
-rw-r--r--. 1 root root 1.0G 6月  10 11:22 test.txt

 Go to the monitoring platform and create monitoring items:

 

 Click on "Latest Data"

 

 There are many built-in monitoring items in zabbix, so I won’t demonstrate them one by one. The ones with parameters and without parameters have been demonstrated for everyone. In addition to the system’s own monitoring items, there are also some custom monitoring items. We Save it for the next time and explain it to everyone together with other functions.

Next, let's take a look at how to delete monitoring items

7. Delete monitoring items

If there is a monitoring item that we can no longer use, we can delete it. But if you delete it directly, the default data will remain, so we need to clear the data first, and then delete it.

 

  • Historical data (history) and trend data (trends) are two ways of storing collected data in Zabbix.
  • Historical data: every collected monitoring data
  • Trend data: average data calculated by hourly statistics

It is strongly recommended to set the historical data retention period as short as possible. Doing so can prevent the database from being overloaded due to storing a large amount of historical data.

You can choose to keep trend data for a long time to replace historical data that is needed for a long time. For example: set to keep 14 days of historical data and 5 years of trend data.

Guess you like

Origin blog.csdn.net/linux_yanbb/article/details/130026725