Zabbix monitors application page access speed and sets alarms (18)

zabbix monitors application page access speed and sets alarms

1. Why use web monitoring

Web monitoring is similar to a monitoring item, which can monitor the usage status of a site. The principle is to match the corresponding status code and display the image through the curl command.

The general steps are:

​ 1. First create a web monitoring and fill in the basic information

​ 2. Then create a step, the step is to set up web monitoring for a certain page, and to write a status code of 200, be sure to check Follow Jump

2. Configure web monitoring

2.1. Create web monitoring

Configuration—Host—Web Monitoring—Create Web Monitoring

Insert picture description here

Click to create web monitoring
Insert picture description here

2.2. Add web scene information

Name: zabbix_html_status

Application set: web

Update interval: 5m (10s is recommended for learning environment)

Try this time: 3 (when the number of failures is equal to 3, it will be abnormal)

Client: Other (the optional client version is too low, choose other here)

User agent string: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36 (fill in the client-side string here, you can just find a page f12 see)

Insert picture description here

2.3. Fill in steps

2.3.1. Step One

retrieve data

Step one can be the landing page

We use the incognito mode to get some of the following values

URL:http://192.168.81.210/zabbix/index.php

Requirement string: 30 days (the requirement here is a unique character on the page)

Insert picture description here

The page step configuration information is as follows

Name: Login

URL:http://192.168.81.210/zabbix/index.php

Required string: 30 days

Required status code: 200

After filling in, click add

Insert picture description here

Insert picture description here

2.3.2. Step two

Get the data first

Get URL

Enter zabbix login password to enter the home page

URL:http://192.168.81.210/zabbix/index.php

Insert picture description here

Get the transmitted data

name=Admin&password=zabbix&autologin=1&enter=Sign+in

Insert picture description here

Page step configuration

Name: Home

URL:http://192.168.81.210/zabbix/index.php

Original release: name=Admin&password=zabbix&autologin=1&enter=Sign+in (the data to be transmitted)

Extension: After the original release configuration is completed, clicking on the form data will generate beautiful data by itself

Insert picture description here

Required string: Dashboard

Status code: 200

Insert picture description here

Be sure to click to follow the jump

Insert picture description here

2.3.3. Step Three

retrieve data

Click on the host-press f12 to see

URL:http://192.168.81.210/zabbix/hosts.php?ddreset=1

Insert picture description here

Step configuration

Name: Host Configuration

URL:http://192.168.81.210/zabbix/hosts.php

Required string: Create host

Status code: 200

Insert picture description here
Insert picture description here

2.3.4. All steps are configured

Click add to finish

Insert picture description here

Insert picture description here

2.4. View web monitoring data

Click monitoring-web monitoring

Insert picture description here

Click on the name to enter to see the details, there are response speed and graphic display

Insert picture description here
Insert picture description here

3. Set alarms

We can monitor the access speed of the page. When a request for a page exceeds 1 second, we will call the police in response, because a request will come out instantly. If it does not come out, it means that the website is really problematic.

3.1. Create a trigger

Name: Zabbix page response is too slow

Expression: {Zabbix server:web.test.time[zabbix_html_status,host configuration,resp].last()}>1

Insert picture description here

Response time is the monitoring item of page response time

Insert picture description here

3.2. Trigger an alarm

[root@zabbix-server ~]# ab -n 100000 -c 10 http://192.168.81.210/zabbix/hosts.php

Momentary warning

Insert picture description here

3.3. Check the alarm message

Report-Action Log
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44953658/article/details/115229606