Process Monitoring Method, System, Computer Device, and Storage Medium
By generating and managing configuration files to monitor and handle process exceptions, the problems of poor monitoring flexibility, poor compatibility and single exception handling in the prior art are solved, and flexible, diverse and efficient process monitoring and exception handling are achieved.
Patent Information
- Application Number
- CN202211210086.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2042-09-30
AI Technical Summary
The prior art has poor flexibility, poor compatibility, fixed monitoring cycle, single exception handling method, poor maintenance, poor maintenance, and unavailability.
A process monitoring method is provided, by obtaining the configuration information of the monitored process, generating a configuration file stored in a preset path, and blocking and monitoring the monitored process based on the configuration file until the configuration file is deleted. The method also includes traversing the configuration file linked list, deleting the configuration file to achieve normal operation of the process, and processing according to preset exception handling rules when the process information is abnormal.
It realizes adaptability and flexible processing of process information exceptions, dynamically join or delete monitoring processes, is compatible with multiple keep-alive detection methods, flexible monitoring cycles, and diverse exception handling methods, which improves the stability and maintainability of the system.
Smart Images

Figure CN115509861B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of process monitoring, and particularly to a process monitoring method, system, computer device, and storage medium. Background Art
[0002] The server is the core of the entire network system and computer platform, and many important data are stored on the server. As the steward of the server, the baseboard management controller can use sensors to monitor the status of computers, network servers, or other hardware drive devices. The stability and robustness of the baseboard management controller affect the stability and robustness of the entire server system. Therefore, it is very necessary to monitor the processes of the baseboard management controller and the operating system.
[0003] In the prior art, the current process monitoring of the baseboard management controller and even the entire operating system is only limited to a single watchdog monitoring. When the watchdog times out, the entire operating system is reset, or only the process of feeding the dog is monitored. By default, as long as the process of feeding the dog is normal, the entire system will still run normally. However, in actual application scenarios, the runaway of a certain process does not necessarily mean the runaway of the entire system, let alone the abnormality of the process of feeding the dog. At the same time, the normal process of feeding the dog does not mean that every process is normal. In the prior art, when a certain process is abnormal, the entire operating system is blindly reset, causing the entire system to stop working immediately, which will result in the loss of a lot of important data of the operating system. Technical personnel cannot obtain abnormal data and cannot analyze the reasons for the abnormality of the operating system.
[0004] In summary, the existing methods for monitoring the baseboard management controller and even the operating system processes have the following defects: 1. Poor flexibility, unable to dynamically add or delete monitored processes; 2. Poor compatibility, unable to adaptively monitor the characteristics of different functional processes; 3. Fixed monitoring period; 4. Single abnormal handling method; 5. Poor maintainability, unable to obtain abnormal data information.
[0005] Therefore, there is an urgent need to propose a process monitoring method, system, computer device, and storage medium that can solve the above technical defects. Summary of the Invention
[0006] Based on this, in view of the above technical problems, it is necessary to provide a process monitoring method, system, and computer device that can adaptively and flexibly process the monitored process with abnormal process information.
[0007] On the one hand, a process monitoring method is provided. The method is applied to an operating system and includes:
[0008] Obtain the configuration information of the monitored process, generate a configuration file stored in a preset path, and block the monitored process based on the configuration file until the configuration file in the preset path is deleted. There is at least one monitored process;
[0009] Traverse the configuration files in the preset path to generate a configuration file linked list. When accessing the configuration files in the configuration file linked list, delete the configuration files in the preset path to enable the normal operation of the monitored process;
[0010] Obtain the process information of the monitored process. When the process information of the monitored process is abnormal, or the process information of the monitored process cannot be obtained, process the monitored process according to the preset process exception handling rules.
[0011] In one embodiment, the method further includes: allocating a monitoring thread for the monitored process. If the monitoring thread learns that the operating system resources are insufficient, send asynchronous notification information to the queue of the monitored process, so that when the monitored process detects the asynchronous notification information, send a resource exception handling request, where the processing request carries the asynchronous notification information; according to the processing request, based on the asynchronous notification information, obtain the process information of the monitored process. When the process information of the monitored process is abnormal, or the process information of the monitored process cannot be obtained, process the monitored process according to the preset process exception handling rules.
[0012] In one embodiment, the method further includes: periodically traversing the configuration files in the preset path; obtaining the configuration information of the configuration files. When the configuration information of the configuration files changes, determine whether the monitored process is an existing monitored process based on the configuration files; if the monitored process is an existing monitored process, update the configuration files in the preset path based on the configuration files with the changed configuration information; if the monitored process is not an existing monitored process, add the configuration files with the changed configuration information to the configuration file linked list.
[0013] In one embodiment, obtaining the configuration information of the monitored process and generating a configuration file stored in a preset path includes: obtaining the configuration information of the monitored process, where the configuration information includes: process name, process identifier, action command, start timestamp, monitoring requirements, keep-alive method, keep-alive period, and dependency relationship; generating a configuration file based on the configuration information and naming the configuration file with the process name; storing the configuration file in the preset path, and there is at least one preset path.
[0014] In one embodiment, when the process information of the monitored process is abnormal, the monitored process is processed according to a preset process exception handling rule, including: when the process information of the monitored process is abnormal, obtaining the exception information of the monitored process and generating a log based on the exception information; after the log is generated, determining whether the configuration information of the monitored process includes a dependency relationship; when the configuration information of the monitored process includes a dependency relationship, processing the process having a dependency relationship with the monitored process, and after the process having a dependency relationship with the monitored process is processed, processing the monitored process according to a preset process exception handling rule, where the preset process exception handling rule includes resetting the monitored process or resetting the operating system.
[0015] In one embodiment, when traversing the configuration files in the preset path to generate a configuration file linked list, the method further includes: when the preset path is not unique, generating a preset path linked list based on the preset path; sequentially obtaining one by one the configuration files in the preset path in the preset path linked list and generating a configuration file linked list based on the configuration files; or, obtaining the configuration files in the preset path according to the priority of the preset monitored process and generating a configuration file linked list based on the configuration files.
[0016] In one embodiment, before obtaining the configuration information of the monitored process and generating a configuration file stored in the preset path, the method further includes: initializing a watchdog and starting the monitored process.
[0017] On the other hand, a process monitoring system is provided. The system is applied to an operating system and includes:
[0018] A configuration information acquisition unit for obtaining the configuration information of the monitored process, generating a configuration file stored in a preset path, and blocking the monitored process based on the configuration file until the configuration file in the preset path is deleted, where the monitored process is at least one;
[0019] A configuration file linked list generation unit, which is communicatively connected to the configuration information acquisition unit, for traversing the configuration files in the preset path to generate a configuration file linked list, and when accessing the configuration files in the configuration file linked list, deleting the configuration files in the preset path to enable the normal operation of the monitored process;
[0020] An exception handling unit for obtaining the process information of the monitored process, and when the process information of the monitored process is abnormal or the process information of the monitored process cannot be obtained, processing the monitored process according to a preset process exception handling rule.
[0021] On the other hand, a computer device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:
[0022] Obtain the configuration information of the monitored process, generate a configuration file stored in a preset path, and block the monitored process based on the configuration file until the configuration file in the preset path is deleted, where the monitored process is at least one;
[0023] Traverse the configuration files in the preset path to generate a configuration file linked list. When accessing the configuration files in the configuration file linked list, delete the configuration files in the preset path to enable the normal operation of the monitored process;
[0024] Obtain the process information of the monitored process. When the process information of the monitored process is abnormal, or when the process information of the monitored process cannot be obtained, process the monitored process according to the preset process exception handling rules.
[0025] On another hand, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0026] Obtain the configuration information of the monitored process, generate a configuration file stored in a preset path, and block the monitored process based on the configuration file until the configuration file in the preset path is deleted, where the monitored process is at least one;
[0027] Traverse the configuration files in the preset path to generate a configuration file linked list. When accessing the configuration files in the configuration file linked list, delete the configuration files in the preset path to enable the normal operation of the monitored process;
[0028] Obtain the process information of the monitored process. When the process information of the monitored process is abnormal, or when the process information of the monitored process cannot be obtained, process the monitored process according to the preset process exception handling rules.
[0029] The above process monitoring method, system, computer device and storage medium, the method is applied to an operating system, and the method includes: obtaining configuration information of a monitored process, generating a configuration file stored in a preset path, blocking the monitored process based on the configuration file until the configuration file in the preset path is deleted, and the monitored process is at least one; traversing the configuration files in the preset path to generate a configuration file linked list, and when accessing the configuration file in the configuration file linked list, deleting the configuration file in the preset path to enable the normal operation of the monitored process; obtaining process information of the monitored process, and when the process information of the monitored process is abnormal or the process information of the monitored process cannot be obtained, processing the monitored process according to a preset process exception handling rule. The above process monitoring method has the following beneficial effects: First, it can dynamically add or remove the monitoring of a certain process, with high flexibility; second, it does not limit the interaction method between the monitored process and the operating system monitoring process, and is compatible with various keep-alive detection methods, with good compatibility; third, it is not limited to the cycle of the watchdog, and can adaptively adjust the monitoring cycle of the monitored process individually, with high flexibility of the monitoring cycle; fourth, it can select a suitable processing method based on the process state of the monitored process, instead of directly restarting the entire operating system as in the traditional method as long as one of the monitored processes has a problem, and the exception handling methods are diverse; fifth, when the process information of the monitored process is abnormal, the abnormal process information will be collected for the improvement of the subsequent system. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 FIG. is an application environment diagram of the process monitoring method in an embodiment;
[0031] Figure 2 FIG. is a flowchart of the process monitoring method in an embodiment;
[0032] Figure 3 FIG. is a flowchart of the process monitoring method in an embodiment;
[0033] Figure 4 FIG. is a flowchart of the process monitoring method in an embodiment;
[0034] Figure 5 FIG. is a structural block diagram of the process monitoring system in an embodiment;
[0035] Figure 6 FIG. is an internal structure diagram of a computer device in an embodiment. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0036] To make the objectives, technical solutions and advantages of this application more clear and understandable, the following further elaborates on this application in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely for explaining this application and are not used to limit this application.
[0037] The process monitoring method provided by this application can be applied to an application environment as Figure 1 shown. Among them, the terminal 102 communicates with the server 104 through the network. The monitored process to be monitored is set through the terminal 102 and sent to the server 104. Among them, the terminal 102 can be but is not limited to various personal computers, laptop computers, smart phones, tablet computers, and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.
[0038] In one embodiment, as Figure 2 shown, a process monitoring method is provided. The method is applied to an operating system, and the operating system is set in the server 104. Taking the example where the method is applied to the server in FIG. 1 for illustration, the method includes the following steps:
[0039] The baseboard management controller starts the system monitoring process and initializes the watchdog.
[0040] The monitored process of the baseboard manager starts. The monitored process forms its configuration information into a configuration file, writes it with the process name as the file name of the configuration file to a preset path, and blocks the monitored process based on the generated configuration file until the configuration file in the preset path is deleted. Among them, the configuration information includes: process name, process identifier, action command, start timestamp, monitoring requirement, keep-alive method, keep-alive period, and dependency relationship. Specifically, the action command includes start command, stop command, restart command, etc.; the start timestamp includes the first start time of the monitored process, that is, after the configuration file is deleted, the monitored process will reset its own start time, and the system monitoring process will also update the timestamp of reading the configuration information of the configuration file to the configuration file linked list for calculating the subsequent interaction time; the monitoring requirement is whether the monitored process needs to be monitored. When the monitored process needs to be temporarily monitored or temporarily removed from monitoring, the monitoring requirement field can be modified and then the monitoring requirement configuration information is regenerated. The system monitoring process will read the configuration file and update it to the configuration file linked list in the next monitoring cycle; the keep-alive method is the interaction mechanism between the monitored process and the system monitoring process to confirm whether the monitored process is still in a normal state. The keep-alive method includes but is not limited to pipe, message, file, and shared memory interaction; the keep-alive period is how often the monitored process hopes to be monitored by itself, that is, how often the monitored process and the system monitoring process interact; the dependency relationship indicates whether the monitored process depends on other services. If there is a dependency, before processing the monitored process according to the preset process exception handling rules, the process that the monitored process depends on should be processed first. It should be understood that the configuration file described in this application is generated by the monitored process, and the configuration file linked list is generated, modified, and updated by the system monitoring process.
[0041] The baseboard management controller traverses the configuration files in the preset path based on the system monitoring process to generate a configuration file linked list. When accessing each configuration file, it deletes the configuration file in the preset path.
[0042] After the monitored process detects that the configuration file used to block itself is deleted, it starts to run normally and indicates its active state to the system monitoring process according to the keep-alive method and keep-alive period in its corresponding configuration information.
[0043] The system monitoring process selects the corresponding processing method based on the keep-alive method, keep-alive period, and monitoring requirement (that is, whether it needs to be monitored, or whether it needs to be monitored within a certain period of time) of the monitored process. If the configuration information of the monitored process shows that it needs to be monitored, it monitors the monitored process according to the corresponding keep-alive method and keep-alive period.
[0044] When the system monitoring process monitors that the monitored process is in a false dead state or fails to monitor the monitored process based on the keep-alive method and keep-alive period of the monitored process, that is, when the process information of the monitored process is abnormal, the monitored process is processed according to the process exception handling rules. It should be understood that the preset process exception handling rules can be pre-stored in the configuration file of the monitored process, or an index relationship can be established between the process exception handling rules and the monitored process, without directly storing the process exception handling rules in the configuration file of the monitored process.
[0045] The system monitoring process traverses the configuration file linked list to check whether the configuration files in the configuration file linked list and the configuration information of the configuration files are updated; if the configuration files in the configuration file linked list are updated, it is determined based on the configuration file whether the monitored process corresponding to the configuration file is an existing monitored process; if the monitored process is an existing monitored process, the configuration file in the preset path is updated based on the configuration file whose configuration information has changed; if the monitored process is not an existing monitored process, the configuration file whose configuration information has changed is added to the configuration file linked list.
[0046] Based on the above process monitoring method, the stability of the baseboard management controller can be improved, the resource consumption when the process is abnormal can be reduced, the flexibility and diversity of process processing can be improved, and further the robustness of the baseboard management controller can be realized.
[0047] In one embodiment, as Figure 3 shown, a process monitoring method is provided. The method is applied to an operating system, and there is no limitation on the version and category of the operating system. The method includes:
[0048] Obtain the configuration information of the monitored process, generate a configuration file stored in a preset path, block the monitored process based on the configuration file until the configuration file in the preset path is deleted, and the monitored process is at least one;
[0049] Traverse the configuration files in the preset path to generate a configuration file linked list. When accessing the configuration files in the configuration file linked list, delete the configuration files in the preset path to enable the normal operation of the monitored process;
[0050] Obtain the process information of the monitored process. When the process information of the monitored process is abnormal, or when the process information of the monitored process cannot be obtained, the monitored process is processed according to the preset process exception handling rules.
[0051] In one of the embodiments, as Figure 4As shown, the method further includes: allocating a monitoring thread for the monitored process; if the monitoring thread learns that the operating system resources are insufficient, sending asynchronous notification information to the queue of the monitored process, so that when the monitored process detects the asynchronous notification information, it sends a resource exception handling request, where the asynchronous notification information is carried in the handling request; according to the handling request, based on the asynchronous notification information, obtaining the process information of the monitored process, and when the process information of the monitored process is abnormal, or the process information of the monitored process cannot be obtained, handling the monitored process according to a preset process exception handling rule.
[0052] In one embodiment, the method further includes: periodically traversing the configuration files under the preset path; obtaining the configuration information of the configuration files, and when the configuration information of the configuration files changes, determining whether the monitored process is an existing monitored process based on the configuration files; if the monitored process is an existing monitored process, updating the configuration files under the preset path based on the configuration files with the changed configuration information; if the monitored process is not an existing monitored process, adding the configuration files with the changed configuration information to the configuration file linked list.
[0053] In one embodiment, obtaining the configuration information of the monitored process and generating a configuration file stored under the preset path includes: obtaining the configuration information of the monitored process, where the configuration information includes: process name, process identifier, action command, startup timestamp, monitoring requirements, keep-alive method, keep-alive period, and dependency relationship; generating a configuration file based on the configuration information and naming the configuration file with the process name; storing the configuration file under the preset path, and the preset path is at least one.
[0054] In one embodiment, when the process information of the monitored process is abnormal, handling the monitored process according to a preset process exception handling rule includes: when the process information of the monitored process is abnormal, obtaining the exception information of the monitored process and generating a log according to the exception information; after the log is generated, determining whether the configuration information of the monitored process includes a dependency relationship; when the configuration information of the monitored process includes a dependency relationship, handling the process having a dependency relationship with the monitored process, and after the process having a dependency relationship with the monitored process is handled, handling the monitored process according to a preset process exception handling rule, and the preset process exception handling rule includes resetting the monitored process or resetting the operating system.
[0055] In one embodiment, when traversing the configuration files under the preset path to generate a linked list of configuration files, the method further includes: when the preset path is not unique, generating a linked list of preset paths based on the preset path; sequentially obtaining the configuration files under the preset paths in the linked list of preset paths one by one, and generating a linked list of configuration files based on the configuration files; or, obtaining the configuration files under the preset path according to the priority of the monitored process preset, and generating a linked list of configuration files based on the configuration files.
[0056] In one embodiment, before obtaining the configuration information of the monitored process and generating a configuration file stored under the preset path, the method further includes: initializing a watchdog and starting the monitored process.
[0057] It should be understood that although Figure 3-4 the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise clearly stated in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, Figure 3-4 at least a part of the steps in
[0058] In one embodiment, as Figure 5 shown, a process control system is provided, including: a configuration information acquisition unit, a configuration file linked list generation unit, and an exception handling unit, where:
[0059] The configuration information acquisition unit is used to obtain the configuration information of the monitored process, generate a configuration file stored under the preset path, and block the monitored process based on the configuration file until the configuration file under the preset path is deleted, and the monitored process is at least one;
[0060] The configuration file linked list generation unit is communicatively connected to the configuration information acquisition unit and is used to traverse the configuration files under the preset path to generate a linked list of configuration files. When accessing the configuration files in the linked list of configuration files, the configuration files under the preset path are deleted to enable the normal operation of the monitored process;
[0061] An exception handling unit obtains the process information of the monitored process. When the process information of the monitored process is abnormal, or when the process information of the monitored process cannot be obtained, the monitored process is processed according to a preset process exception handling rule.
[0062] In one embodiment, the system further includes: a thread allocation unit and a resource exception handling request sending unit. The thread allocation unit is used to allocate a monitoring thread for the monitored process. The resource exception handling request sending unit is used to send asynchronous notification information to the queue of the monitored process if the monitoring thread learns that the operating system resources are insufficient, so that when the monitored process detects the asynchronous notification information, it sends a resource exception handling request, where the processing request carries the asynchronous notification information. The exception handling unit is used to obtain the process information of the monitored process based on the asynchronous notification information according to the processing request. When the process information of the monitored process is abnormal, or when the process information of the monitored process cannot be obtained, the monitored process is processed according to a preset process exception handling rule.
[0063] In one embodiment, the system further includes a traversal unit. The traversal unit is used to periodically traverse the configuration files under the preset path. The configuration information acquisition unit is further used to obtain the configuration information of the configuration files. When the configuration information of the configuration files changes, it is determined whether the monitored process is an existing monitored process based on the configuration files. If the monitored process is an existing monitored process, the configuration files under the preset path are updated based on the configuration files whose configuration information has changed. If the monitored process is not an existing monitored process, the configuration files whose configuration information has changed are added to the configuration file linked list.
[0064] In one embodiment, the configuration file linked list generation unit is further used to obtain the configuration information of the monitored process. The configuration information includes: process name, process identifier, action command, start timestamp, monitoring requirements, keep-alive method, keep-alive period, and dependency relationship. A configuration file is generated based on the configuration information and named with the process name. The configuration file is stored under the preset path, and the preset path is at least one.
[0065] In one embodiment, the exception handling unit is further configured to, when the process information of the monitored process is abnormal, obtain the exception information of the monitored process, generate a log according to the exception information; after the log is generated, determine whether the configuration information of the monitored process includes a dependency relationship; when the configuration information of the monitored process includes a dependency relationship, process the process having a dependency relationship with the monitored process, and after the process having a dependency relationship with the monitored process is processed, process the monitored process according to a preset process exception handling rule, where the preset process exception handling rule includes resetting the monitored process or resetting the operating system.
[0066] In one embodiment, the configuration file linked list generation unit is further configured to, when the preset path is not unique, generate a preset path linked list based on the preset path; sequentially obtain the configuration files under the preset paths in the preset path linked list one by one, and generate a configuration file linked list based on the configuration files; or, obtain the configuration files under the preset path according to the priority of the preset monitored process, and generate a configuration file linked list based on the configuration files.
[0067] In one embodiment, the system further includes an initialization startup unit for initializing the watchdog and starting the monitored process.
[0068] For the specific limitations of the process monitoring system, reference may be made to the limitations on the process monitoring method in the foregoing text, which will not be elaborated here. Each module in the foregoing process monitoring system can be implemented in whole or in part by software, hardware, and their combination. The foregoing modules can be embedded in the processor of the computer device in hardware form or independent thereof, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to the foregoing modules.
[0069] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as Figure 6As shown in the figure. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a process monitoring method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, a trackball, or a touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0070] Those skilled in the art can understand that Figure 6 the structure shown in the figure is only a block diagram of some structures related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine some components, or have different component arrangements.
[0071] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:
[0072] Obtain the configuration information of the monitored process, generate a configuration file stored in a preset path, block the monitored process based on the configuration file until the configuration file in the preset path is deleted, and the monitored process is at least one;
[0073] Traverse the configuration files in the preset path to generate a configuration file linked list. When accessing the configuration files in the configuration file linked list, delete the configuration files in the preset path to enable the normal operation of the monitored process;
[0074] Obtain the process information of the monitored process. When the process information of the monitored process is abnormal, or the process information of the monitored process cannot be obtained, the monitored process is processed according to a preset process exception handling rule.
[0075] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0076] Allocate a monitoring thread for the monitored process. If the monitoring thread learns that the operating system resources are insufficient, it sends an asynchronous notification message to the queue of the monitored process, so that when the monitored process detects the asynchronous notification message, it sends a resource exception handling request, where the asynchronous notification message is carried in the handling request. Based on the asynchronous notification message in the handling request, obtain the process information of the monitored process. When the process information of the monitored process is abnormal, or the process information of the monitored process cannot be obtained, the monitored process is processed according to the preset process exception handling rules.
[0077] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0078] Periodically traverse the configuration files in the preset path; obtain the configuration information of the configuration files. When the configuration information of the configuration files changes, determine whether the monitored process is an existing monitored process based on the configuration files; if the monitored process is an existing monitored process, update the configuration files in the preset path based on the configuration files with the changed configuration information; if the monitored process is not an existing monitored process, add the configuration files with the changed configuration information to the configuration file linked list.
[0079] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0080] Obtain the configuration information of the monitored process, where the configuration information includes: process name, process identifier, action command, start timestamp, monitoring requirements, keep-alive method, keep-alive period, and dependency relationship; generate a configuration file based on the configuration information and name the configuration file with the process name; store the configuration file in the preset path, and the preset path is at least one.
[0081] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0082] When the process information of the monitored process is abnormal, obtain the abnormal information of the monitored process and generate a log according to the abnormal information. After the log is generated, determine whether the configuration information of the monitored process includes a dependency relationship. When the configuration information of the monitored process includes a dependency relationship, process the processes that have a dependency relationship with the monitored process. After the processes that have a dependency relationship with the monitored process are processed, process the monitored process according to the preset process exception handling rules, and the preset process exception handling rules include resetting the monitored process or resetting the operating system.
[0083] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0084] When the preset path is not unique, a preset path linked list is generated based on the preset path; the configuration files under the preset paths in the preset path linked list are sequentially obtained one by one, and a configuration file linked list is generated based on the configuration files; or, according to the priority of the monitored process preset, the configuration files under the preset path are obtained, and a configuration file linked list is generated based on the configuration files.
[0085] In one embodiment, when the processor executes the computer program, the following steps are further implemented:
[0086] Initialize the watchdog and start the monitored process.
[0087] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0088] Obtain the configuration information of the monitored process, generate a configuration file stored under the preset path, and block the monitored process based on the configuration file until the configuration file under the preset path is deleted, where the monitored process is at least one;
[0089] Traverse the configuration files under the preset path to generate a configuration file linked list. When accessing the configuration files in the configuration file linked list, delete the configuration files under the preset path to enable the normal operation of the monitored process;
[0090] Obtain the process information of the monitored process. When the process information of the monitored process is abnormal, or when the process information of the monitored process cannot be obtained, the monitored process is processed according to the preset process exception handling rules.
[0091] In one embodiment, when the computer program is executed by the processor, the following steps are further implemented:
[0092] Allocate a monitoring thread for the monitored process. If the monitoring thread learns that the operating system resources are insufficient, an asynchronous notification message is sent to the queue of the monitored process, so that when the monitored process detects the asynchronous notification message, a resource exception handling request is sent, where the processing request carries the asynchronous notification message; according to the processing request, based on the asynchronous notification message, obtain the process information of the monitored process. When the process information of the monitored process is abnormal, or when the process information of the monitored process cannot be obtained, the monitored process is processed according to the preset process exception handling rules.
[0093] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0094] Periodically traverse the configuration files under the preset path; obtain the configuration information of the configuration files, and when the configuration information of the configuration files changes, then based on the configuration files, determine whether the monitored process is an existing monitored process; if the monitored process is an existing monitored process, then update the configuration files under the preset path based on the configuration files whose configuration information has changed; if the monitored process is not an existing monitored process, then add the configuration files whose configuration information has changed to the configuration file linked list.
[0095] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0096] Obtain the configuration information of the monitored process, where the configuration information includes: process name, process identifier, action command, start timestamp, monitoring requirements, keep-alive method, keep-alive period, and dependency relationship; generate a configuration file based on the configuration information, and name the configuration file with the process name; store the configuration file to the preset path, and the preset path is at least one.
[0097] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0098] When the process information of the monitored process is abnormal, obtain the abnormal information of the monitored process, and generate a log according to the abnormal information; after the log is generated, determine whether the configuration information of the monitored process includes a dependency relationship; when the configuration information of the monitored process includes a dependency relationship, then process the processes that have a dependency relationship with the monitored process, and after the processes that have a dependency relationship with the monitored process are processed, according to the preset process exception handling rules, process the monitored process, and the preset process exception handling rules include resetting the monitored process, or resetting the operating system.
[0099] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0100] When the preset path is more than one, generate a preset path linked list based on the preset path; sequentially obtain one by one the configuration files under the preset paths in the preset path linked list, and generate a configuration file linked list based on the configuration files; or, according to the priority of the monitored processes preset, obtain the configuration files under the preset path, and generate a configuration file linked list based on the configuration files.
[0101] In one embodiment, when the computer program is executed by a processor, the following steps are further implemented:
[0102] Initialize the watchdog and start the monitored process.
[0103] Those of ordinary skill in the art can understand that all or part of the processes in the above-described embodiment methods can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above-described method embodiments. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.
[0104] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0105] The above-described embodiments merely represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation on the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A process monitoring method, characterized in that, the method is applied to an operating system, and the method includes: obtaining the configuration information of the monitored process, generating a configuration file stored in a preset path, and blocking the monitored process based on the configuration file until the configuration file in the preset path is deleted, where the monitored process is at least one; traversing the configuration files in the preset path to generate a configuration file linked list. When accessing the configuration file in the configuration file linked list, delete the configuration file in the preset path to enable the normal operation of the monitored process; obtain the process information of the monitored process. When the process information of the monitored process is abnormal, or when the process information of the monitored process cannot be obtained, process the monitored process according to a preset process exception handling rule; the method further includes: allocating a monitoring thread for the monitored process. If the monitoring thread learns that the operating system resources are insufficient, send an asynchronous notification message to the queue of the monitored process, so that when the monitored process detects the asynchronous notification message, send a resource exception handling request, where the processing request carries the asynchronous notification message; according to the processing request, based on the asynchronous notification message, obtain the process information of the monitored process. When the process information of the monitored process is abnormal, or when the process information of the monitored process cannot be obtained, process the monitored process according to a preset process exception handling rule; periodically traverse the configuration files in the preset path; obtain the configuration information of the configuration file. When the configuration information of the configuration file changes, judge whether the monitored process is an existing monitored process based on the configuration file; if the monitored process is an existing monitored process, update the configuration file in the preset path based on the configuration file whose configuration information has changed; if the monitored process is not an existing monitored process, add the configuration file whose configuration information has changed to the configuration file linked list.
2. The process monitoring method according to claim 1, characterized in that, obtaining the configuration information of the monitored process and generating a configuration file stored in a preset path includes: obtaining the configuration information of the monitored process, where the configuration information includes: process name, process identifier, action command, start timestamp, monitoring requirement, keep-alive method, keep-alive period, and dependency relationship; generating a configuration file based on the configuration information and naming the configuration file with the process name; storing the configuration file to the preset path, where the preset path is at least one.
3. The process monitoring method according to claim 2, characterized in that, when the process information of the monitored process is abnormal, processing the monitored process according to a preset process exception handling rule includes: when the process information of the monitored process is abnormal, obtaining the exception information of the monitored process and generating a log according to the exception information; after the log is generated, judge whether the configuration information of the monitored process includes a dependency relationship; When the configuration information of the monitored process includes a dependency relationship, the process having a dependency relationship with the monitored process is processed. After the process having a dependency relationship with the monitored process is processed, the monitored process is processed according to a preset process exception handling rule, and the preset process exception handling rule includes resetting the monitored process or resetting the operating system.
4. The process monitoring method according to claim 3, wherein, when traversing the configuration files in the preset path to generate a configuration file linked list, the method further includes: when the preset path is not unique, generating a preset path linked list based on the preset path; sequentially obtaining one by one the configuration files in the preset path in the preset path linked list, and generating a configuration file linked list based on the configuration files; or, obtaining the configuration files in the preset path according to the priority of the monitored process preset, and generating a configuration file linked list based on the configuration files.
5. The process monitoring method according to any one of claims 1 to 4, wherein, before obtaining the configuration information of the monitored process and generating a configuration file stored in the preset path, the method further includes: initializing a watchdog and starting the monitored process.
6. A process monitoring system for implementing the process monitoring method according to any one of claims 1 to 5, wherein, the system is applied to an operating system, and the system includes: a configuration information acquisition unit for acquiring the configuration information of the monitored process, generating a configuration file stored in the preset path, and blocking the monitored process based on the configuration file until the configuration file in the preset path is deleted, and the monitored process is at least one; a configuration file linked list generation unit, the configuration file linked list generation unit is communicatively connected to the configuration information acquisition unit for traversing the configuration files in the preset path to generate a configuration file linked list. When accessing the configuration files in the configuration file linked list, the configuration files in the preset path are deleted to enable the normal operation of the monitored process; an exception handling unit for acquiring the process information of the monitored process. When the process information of the monitored process is abnormal or the process information of the monitored process cannot be obtained, the monitored process is processed according to a preset process exception handling rule.
7. A computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein, when the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
8. A computer storage medium, on which a computer program is stored, wherein, when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Process monitoring method and process monitoring device
CN102722431A
Fault detecting method and information processing apparatus
US20090300424A1