Gateway operation detection method and device, electronic equipment and storage medium
By obtaining the gateway's functional module configuration files, periodically checking the Hypertext Transfer Protocol service and multi-threaded message queue module, and automatically saving and notifying abnormal information, the system instability caused by gateway program abnormalities was resolved, improving the gateway's operational reliability and rapid recovery capability.
Patent Information
- Application Number
- CN202210113000.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-30
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2042-01-30
AI Technical Summary
In existing technologies, gateway program malfunctions cannot be detected in a timely manner, leading to abnormal system functions, affecting user experience, and potentially causing user losses.
By obtaining the functional module configuration files of the target gateway, the detection cycle and method are determined, and the normal operation of the functional modules is checked periodically, including the anomaly detection of the Hypertext Transfer Protocol Service module and the multi-threaded message queue module. Anomaly information is automatically saved and the responsible person is notified, and automatic repair is performed according to the restart rules.
A self-checking mechanism for gateway operation has been implemented, which improves the reliability and rapid recovery capability of the gateway and reduces the impact on users in abnormal situations.
Smart Images

Figure CN114579376B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer, and particularly relate to a gateway running detection method and device, electronic equipment and storage medium. BACKGROUND
[0002] When a gateway program running appears abnormal and needs to wait for the gateway program to be unable to provide normal services to the outside, manual troubleshooting and restart operations are performed. When the program appears abnormal, the service of the program cannot work normally. If the program cannot detect the abnormality in time, the entire system function will be abnormal, which may affect user experience, and even cause certain user loss and great impact. SUMMARY
[0003] Embodiments of the present application provide a gateway running detection method and device, electronic equipment and storage medium.
[0004] In a first aspect, some embodiments of the present application provide a gateway running detection method, which comprises: obtaining a configuration file of a function module of a target gateway; determining a detection period and a detection mode of the function module according to the configuration file; and periodically detecting whether the function module runs normally according to the detection period and the detection mode.
[0005] In some embodiments, the function module comprises a hypertext transfer protocol service module, and periodically detecting whether the function module runs normally according to the detection period and the detection mode comprises: initiating a hypertext transfer protocol simulation request according to the detection period; determining whether the hypertext transfer protocol service module receives the hypertext transfer protocol simulation request within a first preset time after the initiation of the hypertext transfer protocol simulation request; and in response to the hypertext transfer protocol service module not receiving the hypertext transfer protocol simulation request within the first preset time after the initiation of the hypertext transfer protocol simulation request, determining that the hypertext transfer protocol service module runs abnormally.
[0006] In some embodiments, the function module comprises a multi-threaded message queue module, and periodically detecting whether the function module runs normally according to the detection period and the detection mode comprises: selecting two threads to initiate simulation messages according to the detection period; determining whether the multi-threaded message queue module receives the simulation messages within a second preset time after the initiation of the simulation messages; and in response to the multi-threaded message queue module not receiving the simulation messages within the second preset time after the initiation of the simulation messages, determining that the multi-threaded message queue module communication is abnormal.
[0007] In some embodiments, the method further comprises: in response to detecting that the function module runs abnormally, saving abnormal information of the function module running abnormally; in response to receiving an abnormal information query request for the function module, returning a query result; and displaying and / or notifying a pre-set associated person according to the query result.
[0008] In some embodiments, the configuration file further comprises a restart rule; and the method further comprises: in response to detecting that the function module is abnormal, determining whether to restart the function module according to the restart rule.
[0009] In the second aspect, some embodiments of the present application provide a gateway operation detection device, comprising: an acquisition unit configured to acquire a configuration file of a function module of a target gateway; a determination unit configured to determine a detection period and a detection manner of the function module according to the configuration file; and a detection unit configured to periodically detect whether the function module is normal according to the detection period and the detection manner.
[0010] In some embodiments, the function module comprises a hypertext transfer protocol service module, and the detection unit is further configured to: initiate a hypertext transfer protocol simulation request according to the detection period; determine whether the hypertext transfer protocol service module receives the hypertext transfer protocol simulation request within a first preset time after initiating the hypertext transfer protocol simulation request; and in response to the hypertext transfer protocol service module not receiving the hypertext transfer protocol simulation request within the first preset time after initiating the hypertext transfer protocol simulation request, determine that the hypertext transfer protocol service module is abnormal.
[0011] In some embodiments, the function module comprises a multi-threaded message queue module, and the detection unit is further configured to: select two threads to initiate a simulation message according to the detection period; determine whether the multi-threaded message queue module receives the simulation message within a second preset time after initiating the simulation message; and in response to the multi-threaded message queue module not receiving the simulation message within the second preset time after initiating the simulation message, determine that the multi-threaded message queue module has a communication abnormality.
[0012] In some embodiments, the device further comprises: a saving unit configured to, in response to detecting that the function module is abnormal, save abnormal information of the function module; a returning unit configured to, in response to receiving an abnormal information query request for the function module, return a query result; and a display unit configured to display and / or notify a pre-set associated person according to the query result.
[0013] In some embodiments, the configuration file further comprises a restart rule; and the device further comprises: a restarting unit configured to, in response to detecting that the function module is abnormal, determine whether to restart the function module according to the restart rule.
[0014] In the third aspect, some embodiments of the present application provide a device, comprising: one or more processors; and a storage device having one or more programs stored thereon, when the one or more programs are executed by the one or more processors, the one or more processors implement the method of the first aspect.
[0015] In a fourth aspect, some embodiments of the present application provide a computer readable medium having stored thereon a computer program which, when executed by a processor, implements the method of the first aspect.
[0016] The gateway running detection method, device, electronic device and storage medium provided by the embodiments of the present application provide a self-checking mechanism for gateway running by obtaining the configuration file of the function module of the target gateway, determining the detection period and detection mode of the function module according to the configuration file, and periodically detecting whether the function module is running normally according to the detection period and detection mode, thereby improving the reliability of gateway running. BRIEF DESCRIPTION OF DRAWINGS
[0017] Other features, objects and advantages of the present application will become more apparent from the following detailed description of non-limiting embodiments thereof, read in conjunction with the accompanying drawings:
[0018] Figure 1 is a flowchart of one embodiment of the gateway running detection method according to the present application;
[0019] Figure 2 is a schematic diagram of an exception detection process in one optional implementation of the gateway running detection method according to the present application;
[0020] Figure 3 is a schematic diagram of exception information storage and query in one optional implementation of the gateway running detection method according to the present application;
[0021] Figure 4 is a structural schematic diagram of one embodiment of the gateway running detection device according to the present application;
[0022] Figure 5 is a structural schematic diagram of a computer system suitable for use as an execution subject to implement some embodiments of the present application. DETAILED DESCRIPTION
[0023] The present application will be further described below in conjunction with the drawings and embodiments. It should be understood that the specific embodiments described herein are merely intended to explain the related application, but not to limit the application. In addition, it should be noted that only the parts related to the application are shown in the drawings for ease of description.
[0024] It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict. The present application will be described in detail below with reference to the drawings and in conjunction with the embodiments.
[0025] With continued reference to Figure 1 , a flowchart 100 of one embodiment of the gateway running detection method according to the present application is shown. The gateway running detection method comprises the following steps:
[0026] In step 101, a configuration file of a function module of a target gateway is acquired.
[0027] In this embodiment, the gateway operation detection method execution subject can first acquire the configuration file of the function module of the target gateway. The target gateway can include an edge gateway, and the configuration file stores configuration information and related settings of the function module, such as a detection period and a detection manner of the function module.
[0028] In step 102, the detection period and the detection manner of the function module are determined according to the configuration file.
[0029] In this embodiment, the execution subject can read the configuration file to determine the detection period and the detection manner of the function module. Because the running conditions of different function modules of the gateway are different, the detection period and the detection manner of the function module need to be set. The detection manner can include testing the function of the module or detecting the running parameters thereof.
[0030] In step 103, whether the function module is running normally is periodically detected according to the detection period and the detection manner.
[0031] In this embodiment, the execution subject can periodically detect whether the function module is running normally according to the detection period and the detection manner determined in step 102. Periodically detecting the function module can ensure that errors or abnormal conditions such as program non-response are detected in time.
[0032] In some optional implementation manners of this embodiment, the function module includes a hypertext transfer protocol service (HTTP server) module, and periodically detecting whether the function module is running normally includes: initiating a hypertext transfer protocol (HTTP) simulation request according to the detection period; determining whether the HTTP server module receives the HTTP simulation request within a first preset time after the HTTP simulation request is initiated; and in response to the HTTP server module not receiving the HTTP simulation request within the first preset time after the HTTP simulation request is initiated, determining that the HTTP server module is running abnormally. In this implementation manner, the first preset time can be set according to actual needs, for example, can be set to 1 second. This implementation manner realizes periodic detection of the HTTP server module, and improves the reliability of the HTTP server module.
[0033] In some optional implementations of the embodiment, the function module includes a multi-thread message queue module, and the function module is periodically detected according to the detection period and the detection mode, including: selecting two threads to initiate simulated messages according to the detection period; determining whether the multi-thread message queue module receives the simulated messages within a second preset time after the simulated messages are initiated; and in response to the multi-thread message queue module not receiving the simulated messages within the second preset time after the simulated messages are initiated, determining that the communication of the multi-thread message queue module is abnormal. In the implementation, the second preset time can be set according to actual needs, for example, can be set to 1 second. The implementation realizes periodic detection of the multi-thread message queue module, and improves the reliability of the multi-thread message queue module.
[0034] In some optional implementations of the embodiment, the configuration file further includes a restart rule, and the method further includes: in response to detecting that the function module is abnormal, determining whether to restart the function module according to the restart rule. In the implementation, a daemon process can also be configured for the program, which can restart the program that stops running to complete the function of restarting. By adding the periodic self-checking mechanism of the gateway module, the program is automatically restarted once a serious error or program unresponsiveness is detected, the gateway is actively self-repaired, and the service of the program is quickly restored. The abnormality detection process of the implementation can be referred to Figure 2 .
[0035] In some optional implementations of the embodiment, the method further includes: in response to detecting that the function module is abnormal, saving abnormal information of the function module; in response to receiving an abnormal information query request for the function module, returning a query result; and displaying and / or notifying a pre-set associated person according to the query result. As shown in Figure 3 , the abnormal information can be saved in a queue for query after an abnormality occurs, and the program can provide an interface (such as an http interface) so that the saved abnormal information can be queried at any time; the client can display or notify the relevant person according to the query result and the like. The implementation realizes quick notification of responsibility, can quickly troubleshoot and locate problems according to the abnormal type, and further improves the running reliability of the gateway.
[0036] The method provided by the above embodiments of the application includes: obtaining a configuration file of a function module of a target gateway; determining a detection period and a detection mode of the function module according to the configuration file; and periodically detecting whether the function module is running normally according to the detection period and the detection mode, which provides a self-checking mechanism for the running of the gateway and improves the running reliability of the gateway.
[0037] Further referring to Figure 4 , as an implementation of the method shown in the above figures, the application provides an embodiment of a gateway running detection device, and the device embodiment and the method embodiment are the sameFigure 1 The method embodiment shown corresponds to the device, which can be applied in various electronic devices.
[0038] As shown in Figure 4 The gateway running detection device 400 of the embodiment includes an acquisition unit 401, a determination unit 402, and a detection unit 403. The acquisition unit is configured to acquire a configuration file of a function module of a target gateway. The determination unit is configured to determine a detection period and a detection manner of the function module according to the configuration file. The detection unit is configured to periodically detect whether the function module is running normally according to the detection period and the detection manner.
[0039] In the embodiment, the specific processing of the acquisition unit 401, the determination unit 402, and the detection unit 403 of the gateway running detection device 400 can refer to steps 101, 102, and 103 in the corresponding embodiment. Figure 1
[0040] In some optional implementations of the embodiment, the function module includes a hypertext transfer protocol service module, and the detection unit is further configured to: initiate a hypertext transfer protocol simulation request according to the detection period; determine whether the hypertext transfer protocol service module receives the hypertext transfer protocol simulation request within a first preset time after the initiation of the hypertext transfer protocol simulation request; and in response to the hypertext transfer protocol service module not receiving the hypertext transfer protocol simulation request within the first preset time after the initiation of the hypertext transfer protocol simulation request, determine that the hypertext transfer protocol service module is running abnormally.
[0041] In some optional implementations of the embodiment, the function module includes a multi-threaded message queue module, and the detection unit is further configured to: select two threads to initiate a simulation message according to the detection period; determine whether the multi-threaded message queue module receives the simulation message within a second preset time after the initiation of the simulation message; and in response to the multi-threaded message queue module not receiving the simulation message within the second preset time after the initiation of the simulation message, determine that the multi-threaded message queue module has a communication abnormality.
[0042] In some optional implementations of the embodiment, the device further includes: a saving unit configured to, in response to detecting that the function module is running abnormally, save abnormality information of the function module; a returning unit configured to, in response to receiving an abnormality information query request for the function module, return a query result; and a display unit configured to display and / or notify a pre-set associated person according to the query result.
[0043] In some optional implementations of the embodiment, the configuration file further includes a restart rule, and the device further includes a restart unit configured to, in response to detecting that the function module is running abnormally, determine whether to restart the function module according to the restart rule.
[0044] The device provided by the above embodiment of the present application acquires the configuration file of the function module of the target gateway, determines the detection period and detection mode of the function module according to the configuration file, and detects whether the function module is running normally according to the detection period and detection mode, thereby providing a self-checking mechanism for gateway running and improving the reliability of gateway running.
[0045] Reference will now be made to the following description Figure 5 which shows a structural schematic diagram of a computer system 500 suitable for use in implementing the execution subject of the embodiments of the present application. Figure 5 The execution subject shown is merely an example and should not bring any limitation to the functions and use range of the embodiments of the present application.
[0046] As shown in Figure 5 , the computer system 500 includes a central processing unit (CPU) 501 which can perform various appropriate actions and processes according to programs stored in a read-only memory (ROM) 502 or loaded from a storage portion 508 into a random access memory (RAM) 503. Various programs and data required for the operation of the system 500 are also stored in the RAM 503. The CPU 501, the ROM 502 and the RAM 503 are connected to each other through a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0047] The following components can be connected to the I / O interface 505: an input portion 506 including, for example, a keyboard and a mouse; an output portion 507 including, for example, a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage portion 508 including, for example, a hard disk; and a communication portion 509 including, for example, a network interface card such as a LAN card, a modem, and the like. The communication portion 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the I / O interface 505 as necessary. A removable recording medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, and the like is attached to the drive 510 as necessary, so that a computer program read out therefrom is installed in the storage portion 508 as necessary.
[0048] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer readable medium, the computer program comprising program code for performing the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via the communication section 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-described functions defined in the methods of the present application are performed. It should be noted that the computer readable medium described in the present application can be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable medium may, for example, be but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any suitable combination of the above. More specific examples of the computer readable medium can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer readable medium can be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus or device. In the present application, the computer readable signal medium can include a data signal carried in a baseband or as part of a carrier wave, in which the computer readable program code is carried. Such a propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the above. The computer readable signal medium can also be any computer readable medium that can send, propagate or transfer the program for use by or in connection with an instruction execution system, apparatus or device. The program code contained on the computer readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, optical cable, RF or the like, or any suitable combination of the above.
[0049] Computer program code for carrying out operations of the present application can be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code can execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computer (for example, through the Internet using an Internet Service Provider).
[0050] The computer program instructions can also be loaded onto a computer or other programmable information processing apparatus to cause a series of operations to be performed on the computer or other programmable information processing apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable information processing apparatus implement the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0051] The units described in the embodiments of the present application can be implemented by software, or by hardware. The units described can also be implemented by a processor, for example, can be described as: a processor includes an obtaining unit, a determining unit and a detecting unit. In some cases, the names of the units do not constitute a limitation on the units themselves, for example, the obtaining unit can also be described as: a unit configured to obtain the configuration file of the function module of the target gateway.
[0052] As another aspect, the application also provides a computer readable medium, which can be included in the apparatus described in the above embodiments, or exist independently without being assembled into the apparatus. The computer readable medium carries one or more programs, which, when executed by the apparatus, cause the apparatus to: acquire a configuration file of a function module of a target gateway; determine a detection period and a detection mode of the function module according to the configuration file; and periodically detect whether the function module is operating normally according to the detection period and the detection mode.
[0053] The above description is merely preferred embodiments of the application and a description of the principles of the technology used. It should be understood by those skilled in the art that the scope of the application involved in the application is not limited to the technical solutions formed by the specific combinations of the above technical features, and should also cover other technical solutions formed by any combinations of the above technical features or equivalent features without departing from the above inventive concept. For example, the above features can be replaced with the technical features disclosed in the application (but not limited to) having similar functions to form technical solutions.
Claims
1. A gateway operation detection method, comprising: obtaining a configuration file of a function module of a target gateway; determining a detection period and a detection manner of the function module according to the configuration file; periodically detecting whether the function module is operating normally according to the detection period and the detection manner; the function module comprises a multi-thread message queue module, and the periodically detecting whether the function module is operating normally according to the detection period and the detection manner comprises: selecting two threads to initiate a simulation message according to the detection period; judging whether the multi-thread message queue module receives the simulation message within a second preset time after the simulation message is initiated; in response to the multi-thread message queue module not receiving the simulation message within the second preset time after the simulation message is initiated, determining that the multi-thread message queue module has a communication exception.
2. The method of claim 1, wherein, the function module comprises a hypertext transfer protocol service module, and the periodically detecting whether the function module is operating normally according to the detection period and the detection manner comprises: initiating a hypertext transfer protocol simulation request according to the detection period; judging whether the hypertext transfer protocol service module receives the hypertext transfer protocol simulation request within a first preset time after the hypertext transfer protocol simulation request is initiated; in response to the hypertext transfer protocol service module not receiving the hypertext transfer protocol simulation request within the first preset time after the hypertext transfer protocol simulation request is initiated, determining that the hypertext transfer protocol service module has an operation exception.
3. The method of claim 1, wherein, the method further comprises: in response to detecting that the function module has an operation exception, saving exception information of the operation exception of the function module; in response to receiving an exception information query request for the function module, returning a query result; displaying and / or notifying a pre-set associated person according to the query result.
4. The method of any one of claims 1-3, wherein, the configuration file further comprises a restart rule; and the method further comprises: in response to detecting that the function module has an operation exception, determining whether to restart the function module according to the restart rule. 5.A gateway operation detection apparatus, comprising: an obtaining unit configured to obtain a configuration file of a function module of a target gateway; a determining unit configured to determine a detection period and a detection manner of the function module according to the configuration file; a detecting unit configured to periodically detect whether the function module is operating normally according to the detection period and the detection manner; the function module comprises a multi-thread message queue module, and the detecting unit is further configured to: select two threads to initiate a simulation message according to the detection period; judge whether the multi-thread message queue module receives the simulation message within a second preset time after the simulation message is initiated; in response to the multi-thread message queue module not receiving the simulation message within the second preset time after the simulation message is initiated, determine that the multi-thread message queue module has a communication exception.
6. The apparatus of claim 5, wherein, the function module comprises a hypertext transfer protocol service module, and the detecting unit is further configured to: initiate a hypertext transfer protocol simulation request according to the detection period; determining whether the HTTP service module receives the HTTP simulation request within a first preset time after the HTTP simulation request is initiated; in response to the HTTP service module not receiving the HTTP simulation request within the first preset time after the HTTP simulation request is initiated, determining that the HTTP service module is abnormal. 7.An electronic device, comprising: one or more processors; a memory device having stored thereon one or more programs; the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-4. 8.A computer-readable medium having stored thereon a computer program, which, when executed by a processor, implements the method of any of claims 1-4.
Citation Information
Patent Citations
Method, system and device for detecting network connectivity in client
CN103684897A
Discrimination And Display Method Of Abnormal URL InWireless Internet
KR1020020084374A