Monitoring Method, Device, Electronic Device and Storage Medium

By generating the target URL address and using the browser access and web page screenshot tool without interface mode, the data monitoring diagram of Grafana platform is automatically obtained, which solves the problem of low efficiency in manually obtaining charts by operation and maintenance personnel and improves the user experience.

CN114490277BActive Publication Date: 2025-07-25BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210050315.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-17
Publication Date
2025-07-25
Estimated Expiration
2042-01-17

AI Technical Summary

Technical Problem

In the prior art, operation and maintenance personnel need to manually operate to obtain real-time data monitoring diagrams of the Grafana platform, affecting work efficiency and user experience.

Method used

By generating the target URL address, using the browser to access the monitoring server in interfaceless mode and call the web page screenshot tool to automatically obtain the data monitoring diagram.

Benefits of technology

It realizes data monitoring graph acquisition without human participation, improving work efficiency and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114490277B_ABST
    Figure CN114490277B_ABST
Patent Text Reader

Abstract

An embodiment of the present invention relates to a monitoring method, device, electronic device, and storage medium, including: when it is determined that a data monitoring graph is acquired, generating a target URL address, where the target URL address is the address of the data monitoring graph in the monitoring server; sending an access request to the monitoring server in a headless mode through a browser, where the access request carries the target URL address, so that the monitoring server returns the target data monitoring graph to the browser; invoking a preset web page screenshot tool to perform a page screenshot on the browser to obtain the target data monitoring graph. Thus, it is possible to automatically obtain the data monitoring graph without the participation of personnel, with high work efficiency and improved user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of computer technology, and in particular, to a monitoring method, apparatus, electronic device, and storage medium. Background Art

[0002] Monitoring is a very important part of the entire product life cycle. Among them, hardware and basic monitoring are concerned during the product operation and maintenance stage, various middleware and application layer monitoring are concerned during the product R & D stage, and core business indicator monitoring is concerned during the product application stage. Grafana is a cross-platform, open-source metric analysis and visualization tool that can send text-type alarm notifications in a timely manner when an alarm event occurs.

[0003] As can be seen from the above description, in the prior art, monitoring alarms can be achieved through Grafana. However, in some application scenarios, when an alarm event occurs, in addition to wanting to view text-type alarm information, operation and maintenance personnel may also want to view real-time data monitoring graphs. At this time, operation and maintenance personnel can manually log in to the Grafana platform, find the address of the Grafana platform monitoring dashboard, and view the Grafana monitoring panel to obtain real-time data monitoring graphs.

[0004] It can be seen that in the prior art, when an alarm event occurs, operation and maintenance personnel need to take the initiative and obtain data monitoring graphs through manual operations, which is likely to affect the work efficiency of operation and maintenance personnel and the user experience. Summary of the Invention

[0005] In view of this, to solve all or part of the above technical problems, embodiments of the present invention provide a monitoring method, apparatus, electronic device, and storage medium.

[0006] In a first aspect, embodiments of the present invention provide a monitoring method, including:

[0007] When it is determined to obtain a data monitoring graph, generate a target URL address, where the target URL address is the address of the target data monitoring graph to be obtained in the monitoring server;

[0008] Send an access request to the monitoring server in a headless mode through a browser, where the access request carries the target URL address, so that the monitoring server returns the target data monitoring graph to the browser;

[0009] Call a preset web page screenshot tool to take a screenshot of the browser page to obtain the target data monitoring graph.

[0010] Optionally, before calling the preset web page screenshot tool to take a screenshot of the browser page, it further includes:

[0011] Run a preset JS script, where the JS script is used to instruct to perform a page scrolling operation on the page of the browser;

[0012] During the process of running the JS script, obtain the size information of the target data monitoring chart;

[0013] Reset the size of the browser page based on the size information of the target data monitoring chart.

[0014] Optionally, the determining to obtain a data monitoring chart includes:

[0015] When receiving an alarm event from the monitoring server, determine to obtain a data monitoring chart;

[0016] Or,

[0017] When receiving a data monitoring chart acquisition request from the outside, determine to obtain a data monitoring chart.

[0018] Optionally, the generating of the target URL address includes:

[0019] Determine the target monitoring data information;

[0020] Concatenate the target monitoring data information with the domain name of the monitoring server to obtain the target URL address.

[0021] Optionally, in the case of determining to obtain a data monitoring chart when receiving an alarm event from the monitoring server, the determining of the target monitoring data information includes:

[0022] Based on the alarm information of the alarm event, determine the corresponding target monitoring data information.

[0023] Optionally, in the case of determining to obtain a data monitoring chart when receiving a data monitoring chart acquisition request from the outside, the determining of the target monitoring data information includes:

[0024] Parse the target monitoring data information from the data monitoring chart acquisition request.

[0025] In a second aspect, an embodiment of the present invention provides a monitoring device, including:

[0026] An address generation module, configured to generate a target URL address when determining to obtain a data monitoring chart, where the target URL address is the address of the target data monitoring chart to be obtained in the monitoring server;

[0027] A request sending module, configured to send an access request to the monitoring server in a headless mode through a browser, where the access request carries the target URL address, so that the monitoring server returns the target data monitoring chart to the browser;

[0028] A monitoring graph output module, which is used to call a preset web page screenshot tool to take a screenshot of the page of the browser to obtain the target data monitoring graph.

[0029] Optionally, the device further includes:

[0030] A script running module, which is used to run a preset JS script before calling the preset web page screenshot tool to take a screenshot of the page of the browser, and the JS script is used to instruct to perform a page scrolling operation on the page of the browser;

[0031] An information determination module, which is used to obtain the size information of the target data monitoring graph during the process of running the JS script;

[0032] A size reset module, which is used to reset the size of the browser page based on the size information of the target data monitoring graph.

[0033] Optionally, the address generation module is specifically used for:

[0034] When receiving an alarm event from the monitoring server, determine to obtain a data monitoring graph;

[0035] Or,

[0036] When receiving a data monitoring graph acquisition request from the outside, determine to obtain a data monitoring graph.

[0037] Optionally, the address generation module includes:

[0038] An information determination sub-module, which is used to determine the target monitoring data information;

[0039] An address splicing sub-module, which is used to splice the target monitoring data information with the domain name of the monitoring server to obtain a target URL address.

[0040] Optionally, the information determination sub-module is specifically used for:

[0041] In the case of determining to obtain a data monitoring graph when receiving an alarm event from the monitoring server, determine the corresponding target monitoring data information based on the alarm information of the alarm event.

[0042] Optionally, the information determination sub-module is specifically used for:

[0043] In the case of determining to obtain a data monitoring graph when receiving a data monitoring graph acquisition request from the outside, parse the target monitoring data information from the data monitoring graph acquisition request.

[0044] In a third aspect, an embodiment of the present invention provides an electronic device, including: a processor and a memory, where the processor is configured to execute a monitoring program stored in the memory to implement the monitoring method according to any one of the first aspects.

[0045] In a fourth aspect, an embodiment of the present invention provides a storage medium storing one or more programs, where the one or more programs can be executed by one or more processors to implement the monitoring method according to any one of the first aspects.

[0046] The technical solution provided by the embodiment of the present invention, when it is determined to obtain a data monitoring graph, generates a target URL address, where the target URL address is the address of the target data monitoring graph to be obtained in the monitoring server, and sends an access request to the monitoring server in a headless mode through a browser, and the access request carries the target URL address, so that the monitoring server returns the target data monitoring graph to the browser, and calls a preset web page screenshot tool to take a page screenshot of the browser to obtain the target data monitoring graph. It realizes that when it is determined to obtain a data monitoring graph, it can automatically generate the target URL address for accessing the data monitoring graph, and since the target URL address is accessed in a headless mode through the browser and the browser is automatically page-screenshot to obtain the target data monitoring graph, therefore, during the entire process of obtaining the target data monitoring graph, no human intervention is required, improving work efficiency and enhancing the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] Figure 1 It is a flowchart of an embodiment of a monitoring method provided by an embodiment of the present invention;

[0048] Figure 2 It is a flowchart of another embodiment of a monitoring method provided by an embodiment of the present invention;

[0049] Figure 3 It is a block diagram of an embodiment of a monitoring device provided by an embodiment of the present invention;

[0050] Figure 4 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0051] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Apparently, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0052] The following further explains the monitoring method provided by the present invention with specific embodiments in conjunction with the accompanying drawings. The embodiments do not constitute a limitation to the embodiments of the present invention.

[0053] See Figure 1 , which is a flowchart of an embodiment of a monitoring method provided by an embodiment of the present invention. As Figure 1 shown, the process may include the following steps:

[0054] S101. When it is determined to obtain a data monitoring graph, generate a target URL (Uniform Resource Locator) address, where the target URL address is the address of the target data monitoring graph to be obtained in the monitoring server.

[0055] In one embodiment, when an alarm event from the monitoring server is received, it is determined to obtain a data monitoring graph. Among them, the alarm event may be an abnormal event such as abnormal traffic data or abnormal background data. The alarm event often contains alarm information, such as location, time, event and other alarm information.

[0056] Among them, the above monitoring server may be the Grafana platform. The Grafana platform is an open-source metric analysis and visualization analysis platform. When the monitored data metrics exceed the set alarm threshold, that is, when the alarm event occurs, the Grafana platform will trigger an alarm and send the alarm event to the execution entity (such as the client) of the embodiment of the present invention.

[0057] In this embodiment, the specific implementation of generating the target URL address may include: determining the corresponding target monitoring data information according to the alarm information of the alarm event, and splicing the target monitoring data information with the domain name of the monitoring server to obtain the target URL address.

[0058] For example, assume that the current time is 15:00:00 on September 14, 2021, and assume that an alarm event is received from the monitoring server at the current time. This alarm event indicates that abnormal traffic data occurred in the Beijing computer room during the period from 12:00:00 on September 14, 2021 to 15:00:00 on September 14, 2021. According to the above description, at this time, it can be determined to obtain the traffic data monitoring graph of the Beijing computer room during the period from 12:00:00 on September 14, 2021 to 15:00:00 on September 14, 2021 (that is, the target data monitoring graph to be obtained). Further, determine the corresponding target monitoring data information according to the alarm information of the above alarm event, including the location is the Beijing computer room, the time period is from 12:00:00 on September 14, 2021 to 15:00:00 on September 14, 2021, and the event is traffic query. After that, splice the target monitoring data information and the domain name of the monitoring server "http: / / exmple.grafana.com" to obtain the following target URL address: http: / / exmple.grafana.com / d / KNnIXQWGk / liu-liang-cha-xun?var-idc=bj&from=1631592000&to=1631602800.

[0059] In the above target URL address, the from parameter and the to parameter represent the 13-bit timestamp converted from the standard time.

[0060] In another embodiment, when a data monitoring graph acquisition request is received from the outside, it is determined to obtain the data monitoring graph. Specifically, the user can use Flask to develop an Application Programming Interface (API), such as http: / / 127.0.0.1:5000, so that the outside can pass in the data monitoring graph acquisition request through this interface. Here, Flask is a web framework of Python. When the user passes in the data monitoring graph acquisition request through the above interface, the user can also input the target monitoring data information (hereinafter referred to as the target monitoring data information) to be viewed through the web page. That is, the above data monitoring graph acquisition request can carry the target monitoring data information input by the user.

[0061] Accordingly, in this embodiment, the specific implementation of generating the target URL address may include: parsing the target monitoring data information from the data monitoring graph acquisition request, and splicing the target monitoring data information with the domain name of the monitoring server to obtain the target URL address.

[0062] For example, assume that the client receives a data monitoring graph acquisition request passed in by the user through the API interface. This data monitoring graph acquisition request carries the following target monitoring data information: the location is the Beijing computer room, the time period is from 12:00:00 on September 14, 2021 to 15:00:00 on September 14, 2021, and the event is traffic query, which is used to represent that the user wants to view the traffic data monitoring graph of the Beijing computer room during the time period from 12:00:00 on September 14, 2021 to 15:00:00 on September 14, 2021. After that, the client can parse the above target data monitoring information from the received data monitoring graph acquisition request. Then, the client splices the target monitoring data information with the domain name of the monitoring server "http: / / exmple.grafana.com" to obtain the following target URL address: http: / / exmple.grafana.com / d / KNnIXQWGk / liu-liang-cha-xun?var-idc=bj&from=1631592000&to=1631602800.

[0063] Through this processing method, the client can automatically generate the target URL address for accessing the data monitoring graph when an alarm event occurs or when the user requests to obtain the data monitoring graph, and there is no need for the user to manually log in to the monitoring server to obtain the data monitoring graph, thus saving user operations, improving work efficiency, and enhancing the user experience.

[0064] S102. Send an access request to the monitoring server in a headless mode through the browser. The access request carries the target URL address, so that the monitoring server returns the target data monitoring graph to the browser.

[0065] S103. Invoke a preset web page screenshot tool to take a page screenshot of the browser to obtain the target data monitoring graph.

[0066] The following is a unified description of S102 and S103:

[0067] In an embodiment, the client can send an access request to the monitoring server based on the target URL address through the browser, so that the monitoring server responds to the access request and returns the target data monitoring graph.

[0068] Specifically, in practice, the client can start a browser by calling the library of selenium.webdriver. Selenium is a tool for testing web applications. Further, since it is only necessary to return the target data monitoring graph to the user without presenting the acquisition process of the target data monitoring graph to the user, optionally, the client can run the browser in a headless mode and implement S102 and S103 by taking screenshots of the browser page.

[0069] Among them, the headless mode of the browser can be set by the chrome_options.add_argument('headless') method, the accessed browser can be set by the webdriver.Chrome() method, and the above-mentioned spliced target URL address can be accessed by the driver.get(url) method.

[0070] The web page screenshot tool can be the screenshot tool built into the electronic device or an application installed on the electronic device with screenshot function, such as WeChat, QQ, etc. The embodiments of the present invention do not limit this. It can be understood that by calling the preset web page screenshot tool to take a screenshot of the browser page, the obtained picture includes the target data monitoring graph.

[0071] Further, in practice, there is usually a large amount of monitoring information deployed on the monitoring server. Therefore, the content displayed on the browser page is often only a part of the complete data monitoring graph, which results in that if the browser page is directly screenshot, only part of the data monitoring graph can be intercepted. Accordingly, the embodiments of the present invention provide a method capable of intercepting the complete data monitoring graph. See Figure 2 which is the flowchart of the embodiment of another monitoring method provided by the embodiments of the present invention. The Figure 2 shown process describes how to intercept the complete data monitoring graph. As Figure 2 shown, the process may include the following steps:

[0072] S201. Run a preset JS script, which is used to instruct to perform a page scrolling operation on the browser page.

[0073] S202. During the running of the JS script, obtain the size information of the target data monitoring graph.

[0074] S203. Reset the size of the browser page based on the size information of the target data monitoring graph.

[0075] S204. Call the preset web page screenshot tool to take a screenshot of the browser page.

[0076] S205. Obtain the target data monitoring chart.

[0077] The following provides a unified description of S201 to S205:

[0078] The above page scrolling operation can be a pull-up operation or a pull-down operation on the browser page, or a left swipe operation or a right swipe operation on the browser page.

[0079] In one embodiment, the client can perform a page scrolling operation on the browser page by running a preset JS script. Further, during the process of running the JS script, the client can obtain the size information of the target data monitoring chart. Here, the size information can include width and height, and then reset the size of the browser page according to the size information of the target data monitoring chart.

[0080] Optionally, the client can set the size of the browser page to be greater than or equal to the size of the target data monitoring chart. Through this kind of processing, the browser page can accommodate the complete target data monitoring chart.

[0081] Optionally, the client can reset the size of the browser page by using the driver.set_window_size(width, height) method.

[0082] From the above description, it can be seen that by executing S203, the browser page can accommodate the complete target data monitoring chart, that is, the content displayed on the browser page includes the complete target data monitoring chart. Based on this, by calling a preset web page screenshot tool to take a screenshot of the browser page, the complete target data monitoring chart can be captured.

[0083] In addition, after capturing the complete target data monitoring chart, the screenshot can be saved locally, or uploaded to the server, or returned to the interface calling end in binary data format. After receiving the screenshot, the interface calling end can push the alarm information containing the screenshot to the user through Email or Webhook, etc. The embodiments of the present invention do not limit this.

[0084] In addition, optionally, when starting to run the above JS script, the time.sleep() method is called simultaneously to postpone the set duration, such as 1 second, and then the next operation, that is, S203, is executed. Through this kind of processing, it can be effectively ensured that S203 is executed after the JS script has been executed.

[0085] Similarly, optionally, when starting to take a screenshot of a browser page with a set size, the time.sleep() method is called simultaneously to postpone for a set duration, such as 1 second, and then the next operation, that is, S205, is executed. Through this kind of processing, it can be ensured that S205 is executed after the screenshot of the browser page has been completed.

[0086] So far, the Figure 2 relevant description of the shown process is completed.

[0087] From Figure 2 the shown process, it can be seen that in the technical solution of the present invention, when the browser is run in a headless mode, a preset JS script is run. During the running of the JS script, the size information of the target data monitoring chart is obtained. Based on the size information of the target data monitoring chart, the size of the browser page is reset. Then, by calling a preset web page screenshot tool, a page screenshot of the browser is taken, and the obtained picture, that is, the target data monitoring chart, is output. By resetting the size of the browser page according to the size information of the target data monitoring chart, the browser page can display the complete data monitoring chart. Furthermore, by taking a page screenshot of the browser, a complete target data monitoring chart can be obtained at one time.

[0088] It should be noted that in the technical solution of the present invention, Python can be used as the development language, and correspondingly, the selenium framework can be selected to implement functions such as simulated login, page access, and screenshot. Also, JavaScript can be used as the development language, and correspondingly, the Puppeteer framework can be selected to implement the same functions. The embodiments of the present invention do not limit this.

[0089] From Figure 1 the shown process, it can be seen that in the technical solution of the present invention, when it is determined to obtain a data monitoring chart, a target URL address is generated. The target URL address is the address of the target data monitoring chart to be obtained in the monitoring server. The browser sends an access request to the monitoring server in a headless mode, and the access request carries the target URL address, so that the monitoring server returns the target data monitoring chart to the browser. Then, a preset web page screenshot tool is called to take a page screenshot of the browser to obtain the target data monitoring chart. It realizes that when it is determined to obtain a data monitoring chart, the target URL address for accessing the data monitoring chart can be automatically generated. And since the target URL address is accessed by the browser in a headless mode and the browser is automatically page-screenshot to obtain the target data monitoring chart, therefore, during the entire process of obtaining the target data monitoring chart, no human participation is required, which improves work efficiency and enhances the user experience.

[0090] Corresponding to the foregoing embodiments of the monitoring method, the present invention also provides a block diagram of an embodiment of a monitoring device.

[0091] See Figure 3 , which is a block diagram of an embodiment of a monitoring device provided by an embodiment of the present invention. As Figure 3 shown, the device includes:

[0092] An address generation module 301, configured to generate a target URL address when it is determined to obtain a data monitoring graph, where the target URL address is the address of the target data monitoring graph to be obtained in the monitoring server;

[0093] A request sending module 302, configured to send an access request to the monitoring server in a headless mode through a browser, where the access request carries the target URL address, so that the monitoring server returns the target data monitoring graph to the browser;

[0094] A monitoring graph output module 303, configured to call a preset web page screenshot tool to perform a page screenshot on the browser to obtain the target data monitoring graph.

[0095] Optionally, the device further includes (not shown in the figure):

[0096] A script running module, configured to run a preset JS script before calling the preset web page screenshot tool to perform a page screenshot on the browser, where the JS script is used to instruct to perform a page scrolling operation on the page of the browser;

[0097] An information determination module, configured to obtain the size information of the target data monitoring graph during the process of running the JS script;

[0098] A size reset module, configured to reset the size of the browser page based on the size information of the target data monitoring graph.

[0099] Optionally, the address generation module 301 is specifically configured to:

[0100] When receiving an alarm event from the monitoring server, determine to obtain a data monitoring graph;

[0101] Or,

[0102] When receiving a data monitoring graph acquisition request from the outside, determine to obtain a data monitoring graph.

[0103] Optionally, the address generation module 301 includes (not shown in the figure):

[0104] An information determination sub-module, configured to determine target monitoring data information;

[0105] An address splicing sub-module, configured to splice the target monitoring data information with the domain name of the monitoring server to obtain a target URL address.

[0106] Optionally, the information determination sub-module is specifically configured to:

[0107] When it is determined to obtain a data monitoring graph when receiving an alarm event from the monitoring server, based on the alarm information of the alarm event, determine the corresponding target monitoring data information.

[0108] Optionally, the information determination sub-module is specifically configured to:

[0109] When it is determined to obtain a data monitoring graph when receiving a data monitoring graph acquisition request from the outside, parse the target monitoring data information from the data monitoring graph acquisition request.

[0110] Figure 4 It is a schematic structural diagram of an electronic device provided by an embodiment of the present invention. Figure 4 The illustrated electronic device 400 includes: at least one processor 401, a memory 402, at least one network interface 404, and other user interfaces 403. Each component in the electronic device 400 is coupled together through a bus system 405. It can be understood that the bus system 405 is used to realize the connection and communication between these components. In addition to the data bus, the bus system 405 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, in Figure 4 all kinds of buses are labeled as the bus system 405.

[0111] Among them, the user interface 403 may include a display, a keyboard, or a pointing device (for example, a mouse, a trackball), a touchpad, or a touch screen, etc.

[0112] It can be understood that the memory 402 in the embodiments of the present invention can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchlink dynamic random access memory (SLDRAM), and direct rambus random access memory (DRRAM). The memory 402 described herein is intended to include but not be limited to these and any other suitable types of memories.

[0113] In some embodiments, the memory 402 stores the following elements, executable units, or data structures, or subsets thereof, or extended sets thereof: the operating system 4021 and the application program 4022.

[0114] Among them, the operating system 4021 includes various system programs, such as the framework layer, the core library layer, the driver layer, etc., and is used to implement various basic services and process hardware-based tasks. The application program 4022 includes various application programs, such as a media player and a browser, etc., and is used to implement various application services. The program for implementing the method of the embodiments of the present invention can be included in the application program 4022.

[0115] In the embodiments of the present invention, by invoking the programs or instructions stored in the memory 402, specifically, the programs or instructions stored in the application program 4022, the processor 401 is used to execute the method steps provided in each method embodiment, for example, including:

[0116] When it is determined to obtain a data monitoring chart, a target URL address is generated, and the target URL address is the address of the target data monitoring chart to be obtained in the monitoring server;

[0117] Send an access request to the monitoring server in a headless mode through a browser, and the access request carries the target URL address, so that the monitoring server returns the target data monitoring chart to the browser;

[0118] Call a preset web page screenshot tool to take a screenshot of the browser page to obtain the target data monitoring chart.

[0119] Optionally, before calling the preset web page screenshot tool to take a screenshot of the browser page, it further includes:

[0120] Run a preset JS script, and the JS script is used to instruct to perform a page scrolling operation on the browser page;

[0121] During the process of running the JS script, obtain the size information of the target data monitoring chart;

[0122] Reset the size of the browser page based on the size information of the target data monitoring chart.

[0123] Optionally, the determining to obtain a data monitoring chart includes:

[0124] When an alarm event from the monitoring server is received, determine to obtain a data monitoring chart;

[0125] Or,

[0126] When a data monitoring chart acquisition request from the outside is received, determine to obtain a data monitoring chart.

[0127] Optionally, the generating of the target URL address includes:

[0128] Determine the target monitoring data information;

[0129] Concatenate the target monitoring data information with the domain name of the monitoring server to obtain the target URL address.

[0130] Optionally, in the case of determining to obtain a data monitoring chart when an alarm event from the monitoring server is received, the determining of the target monitoring data information includes:

[0131] Based on the alarm information of the alarm event, determine the corresponding target monitoring data information.

[0132] Optionally, in the case of determining to obtain a data monitoring chart when a data monitoring chart acquisition request from the outside is received, the determining of the target monitoring data information includes:

[0133] Parse the target monitoring data information from the request for the data monitoring graph.

[0134] The method disclosed in the embodiments of the present invention can be applied to or implemented by the processor 401. The processor 401 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit in hardware or instructions in software form in the processor 401. The above-mentioned processor 401 may be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present invention. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present invention can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of hardware and software units in the decoding processor. The software unit may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 402, and the processor 401 reads the information in the memory 402 and combines its hardware to complete the steps of the above method.

[0135] It can be understood that these embodiments described herein can be implemented using hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in this application, or a combination thereof.

[0136] For software implementation, the techniques described herein can be implemented by units that execute the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented within the processor or external to the processor.

[0137] The electronic device provided in this embodiment can be an electronic device as shown in Figure 4 and can execute all steps of the monitoring method as shown in Figure 1-2 to achieve the technical effects of the monitoring method in Figure 1-2 For specific details, please refer to Figure 1-2 the relevant description. For the sake of brevity, it will not be elaborated here.

[0138] The embodiment of the present invention also provides a storage medium (computer-readable storage medium). The storage medium stores one or more programs. Among them, the storage medium can include volatile memory, such as random access memory; the memory can also include non-volatile memory, such as read-only memory, flash memory, hard disk or solid-state drive; the memory can also include a combination of the above types of memory.

[0139] When one or more programs in the storage medium can be executed by one or more processors to implement the above-mentioned monitoring method executed on the electronic device side.

[0140] The processor is used to execute the monitoring program stored in the memory to implement the following steps of the monitoring method executed on the electronic device side:

[0141] When it is determined to obtain a data monitoring graph, generate a target URL address, where the target URL address is the address of the target data monitoring graph to be obtained in the monitoring server;

[0142] Send an access request to the monitoring server in a headless mode through a browser, where the access request carries the target URL address, so that the monitoring server returns the target data monitoring graph to the browser;

[0143] Call a preset web page screenshot tool to take a page screenshot of the browser to obtain the target data monitoring graph.

[0144] Optionally, before calling the preset web page screenshot tool to take a page screenshot of the browser, it further includes:

[0145] Run a preset JS script, where the JS script is used to instruct to perform a page scrolling operation on the page of the browser;

[0146] During the process of running the JS script, obtain the size information of the target data monitoring graph;

[0147] Reset the size of the browser page based on the size information of the target data monitoring graph.

[0148] Optionally, the determining to obtain the data monitoring graph includes:

[0149] When receiving an alarm event from the monitoring server, determine to obtain the data monitoring graph;

[0150] Or,

[0151] When receiving a data monitoring graph acquisition request from the outside, determine to obtain the data monitoring graph.

[0152] Optionally, the generating the target URL address includes:

[0153] Determine the target monitoring data information;

[0154] Concatenate the target monitoring data information with the domain name of the monitoring server to obtain the target URL address.

[0155] Optionally, in the case of determining to obtain the data monitoring graph when receiving an alarm event from the monitoring server, the determining the target monitoring data information includes:

[0156] Based on the alarm information of the alarm event, determine the corresponding target monitoring data information.

[0157] Optionally, in the case of determining to obtain the data monitoring graph when receiving a data monitoring graph acquisition request from the outside, the determining the target monitoring data information includes:

[0158] Parse the target monitoring data information from the data monitoring graph acquisition request.

[0159] Those skilled in the art should also be able to further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the present invention.

[0160] The steps of the methods or algorithms described in connection with the embodiments disclosed herein may be implemented in hardware, software modules executed by a processor, or a combination of both. The software modules may be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium well-known in the art.

[0161] The specific embodiments described above have further elaborated on the object, technical solution, and beneficial effects of the present invention. It should be understood that the above description is only the specific embodiments of the present invention and is not used to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims

1. A monitoring method, characterized in that, including: When it is determined to obtain a data monitoring graph, generate a target URL address, where the target URL address is the address of the target data monitoring graph to be obtained in the monitoring server; Send an access request to the monitoring server in a headless mode through a browser, where the access request carries the target URL address, so that the monitoring server returns the target data monitoring graph to the browser; Call a preset web page screenshot tool to take a screenshot of the browser page to obtain the target data monitoring graph; The determination of obtaining a data monitoring graph includes: When receiving an alarm event from the monitoring server, determine to obtain a data monitoring graph; The generation of the target URL address includes: Based on the alarm information of the alarm event, determine the corresponding target monitoring data information; Concatenate the target monitoring data information with the domain name of the monitoring server to obtain the target URL address.

2. The method according to claim 1, characterized in that, Before the step of calling a preset web page screenshot tool to take a screenshot of the browser page, it further includes: Run a preset JS script, where the JS script is used to instruct to perform a page scrolling operation on the browser page; During the process of running the JS script, obtain the size information of the target data monitoring graph; Reset the size of the browser page based on the size information of the target data monitoring graph.

3. A monitoring device, characterized in that, including: An address generation module, configured to generate a target URL address when it is determined to obtain a data monitoring graph, where the target URL address is the address of the target data monitoring graph to be obtained in the monitoring server; A request sending module, configured to send an access request to the monitoring server in a headless mode through a browser, where the access request carries the target URL address, so that the monitoring server returns the target data monitoring graph to the browser; A monitoring graph output module, configured to call a preset web page screenshot tool to take a screenshot of the browser page to obtain the target data monitoring graph; The determination of obtaining a data monitoring graph includes: When receiving an alarm event from the monitoring server, determine to obtain a data monitoring graph; The generation of the target URL address includes: Based on the alarm information of the alarm event, determine the corresponding target monitoring data information; Concatenate the target monitoring data information with the domain name of the monitoring server to obtain the target URL address.

4. The device according to claim 3, characterized in that The device further includes: A script running module, configured to run a preset JS script before the step of calling a preset web page screenshot tool to take a screenshot of the browser page, where the JS script is used to instruct to perform a page scrolling operation on the browser page; An information determination module, configured to obtain the size information of the target data monitoring graph during the process of running the JS script; A size reset module, configured to reset the size of the browser page based on the size information of the target data monitoring graph.

5. An electronic device, characterized in that, including: A processor and a memory, where the processor is configured to execute a monitoring program stored in the memory to implement the monitoring method according to any one of claims 1 to 2.

6. A storage medium, characterized in that, The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the monitoring method described in any one of claims 1 to 2.

Citation Information

Patent Citations

  • Webpage screenshot method and device, storage medium and processor

    CN110020240A

  • System and method of improving computer network system

    US20200153690A1