Process monitoring method and device

Through the monitoring and management of the BMC process, the problem of monitoring the running status of the BMC process is solved, the stable operation of the server is ensured, and the reliability and stability of the BMC are improved.

CN118779180APending Publication Date: 2024-10-15INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410939222.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

Existing technology cannot effectively monitor the running status of the Baseboard Management Controller (BMC) process, causing the server to crash due to failure to detect problems in time, affecting the stability and reliability of the server.

Method used

By receiving the registration information of the process to be monitored, monitor the BMC process according to the preset monitoring categories, traverse the process status information, and determine whether multiple monitoring conditions are met, such as the number of file descriptors, memory usage, and CPU usage, etc., and determine The target process is restarted or logged to ensure the stable operation of BMC.

Benefits of technology

It achieves continuous and stable monitoring of the BMC process, avoids downtime caused by resource leaks or excessive occupancy, and improves the stability and reliability of the server.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779180A_ABST
    Figure CN118779180A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a process monitoring method and device, and the method comprises the steps: receiving the registration information of each to-be-monitored process in a to-be-monitored process set; respectively monitoring each to-be-monitored process in the to-be-monitored process set according to a plurality of preset monitoring categories, and traversing each to-be-monitored process in the to-be-monitored process set when the current monitoring category is a target monitoring category in the plurality of preset monitoring categories, monitoring each to-be-monitored process in the to-be-monitored process set according to the registration information of the currently traversed to-be-monitored process and the target monitoring category; and determining a process meeting at least one monitoring condition in the plurality of monitoring conditions in the to-be-monitored process set as a target process. By means of the method and device, the problem that the running state of the BMC process cannot be monitored in the related technology is solved, and then the effect of ensuring continuous and stable running of the BMC is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computers, and more specifically, to a method and device for process monitoring. Background Art

[0002] The Baseboard Management Controller (BMC) is a small operating system independent of the server system. It is mainly used for server remote management, monitoring, deployment, restart and other operations, and plays an important role in the stable operation of the server.

[0003] However, as server systems become more and more complex, the monitored components are also varied, which has led to the gradual upgrading of the communication interfaces of the components and the increasing complexity of the BMC code implementation. When the BMC runs for a long time, problems such as segment memory leaks, file descriptors, and CPU occupancy may occur. Once these problems occur, the BMC will stop monitoring the server, causing the server to crash because the problem cannot be discovered in time, which in turn affects the services on the server.

[0004] There is currently no effective solution to the above problems. Summary of the invention

[0005] The embodiments of the present application provide a method and device for process monitoring, so as to at least solve the problem in the related art that the running status of the BMC process cannot be monitored.

[0006] According to one embodiment of the present application, a process monitoring method is provided, which is applied to a baseboard management controller, including: receiving registration information of each process to be monitored in a set of processes to be monitored, wherein the registration information of the process to be monitored includes: an identity of the process to be monitored, a category to be monitored of the process to be monitored, and attribute information of the category to be monitored; monitoring each process to be monitored in the set of processes to be monitored according to a plurality of preset monitoring categories, wherein, when a current monitoring category is a target monitoring category in a plurality of preset monitoring categories, traversing each process to be monitored in the set of processes to be monitored, and monitoring each process to be monitored in the set of processes to be monitored according to the registration information of the process to be monitored currently traversed and the target monitoring category; determining a process in the set of processes to be monitored that satisfies at least one monitoring condition among a plurality of monitoring conditions as a target process, wherein each monitoring category in the plurality of preset monitoring categories corresponds to a monitoring condition.

[0007] In an exemplary embodiment, each process to be monitored in the set of processes to be monitored is monitored according to the registration information of the process to be monitored currently traversed and the target monitoring category, including: according to the to-be-monitored category in the registration information of each process to be monitored, determining the target process to be monitored whose to-be-monitored category is the target monitoring category in the set of processes to be monitored, and obtaining a set of target processes to be monitored, wherein the set of target monitoring processes includes at least one target monitoring process; performing the following operations on the i-th target process to be monitored in the set of target processes to be monitored, wherein i is an integer greater than or equal to 1: traversing each process status information under the specified path of the i-th target process to be monitored, and when the process status information currently traversed is the current process status information and the current process status information is the process status information corresponding to the target monitoring category, determining the current process status information as the target process status information; monitoring the target monitoring category of each target process to be monitored in the set of target processes to be monitored according to the target process status information of each target process to be monitored and the registration information of each target process to be monitored.

[0008] In an exemplary embodiment, the target monitoring category of each target process to be monitored in the target process set is monitored according to the target process status information of each target process to be monitored and the registration information of each target process to be monitored, including: obtaining the attribute information of the target monitoring category from the registration information of the i-th target process to be monitored; monitoring the target monitoring category of the i-th target process to be monitored according to the attribute information of the target monitoring category and / or the target process status information.

[0009] In an exemplary embodiment, the target monitoring category of the i-th target process to be monitored is monitored according to the attribute information of the target monitoring category and / or the target process status information, including: when the target monitoring category is to determine whether the process to be monitored is in place, determining whether there is an in-place mark in the target process status information; when the in-place mark does not exist in the target process status information, determining that the i-th target process to be monitored satisfies a first monitoring condition, and the multiple monitoring conditions include the first monitoring condition.

[0010] In an exemplary embodiment, the target monitoring category of the i-th target process to be monitored is monitored according to the attribute information of the target monitoring category and / or the target process status information, including: when the target monitoring category is to monitor the number of file descriptors of the process to be monitored, obtaining a descriptor threshold in the registration information of the i-th target process to be monitored, wherein the attribute information of the target monitoring category includes the descriptor threshold; when the number of file descriptors of the i-th target process to be monitored in the target process status information is greater than or equal to the descriptor threshold, determining that the i-th target process to be monitored satisfies a second monitoring condition, and the multiple monitoring conditions include the second monitoring condition.

[0011] In an exemplary embodiment, the target monitoring category of the i-th target process to be monitored is monitored according to the attribute information of the target monitoring category and / or the target process status information, including: when the target monitoring category is to monitor the memory occupancy of the process to be monitored, obtaining a memory occupancy threshold value from the registration information of the i-th target process to be monitored; when the memory occupancy of the i-th target process to be monitored in the target process status information is greater than or equal to the memory occupancy threshold value, determining that the i-th target process to be monitored satisfies a third monitoring condition, and the multiple monitoring conditions include the third monitoring condition.

[0012] In an exemplary embodiment, the target monitoring category of the i-th target process to be monitored is monitored according to the attribute information of the target monitoring category and / or the target process status information, including: when the target monitoring category is to monitor the processor usage of the process to be monitored, obtaining a processor usage threshold from the registration information of the i-th target process to be monitored; when the processor usage of the i-th target process to be monitored in the target process status information is greater than or equal to the processor usage threshold, determining that the i-th target process to be monitored satisfies a fourth monitoring condition, and the fourth monitoring condition is included in the multiple monitoring conditions.

[0013] In an exemplary embodiment, after determining a process in the set of processes to be monitored that satisfies at least one of multiple monitoring conditions as a target process, the method further includes: performing a restart operation on the target process; and / or recording the identity of the target process in a target log.

[0014] According to another embodiment of the present application, a process monitoring device is provided, comprising: a receiving module, for receiving registration information of each process to be monitored in a set of processes to be monitored, wherein the registration information of the process to be monitored comprises: an identity of the process to be monitored, a category to be monitored of the process to be monitored, and attribute information of the category to be monitored; a monitoring module, for monitoring each process to be monitored in the set of processes to be monitored according to a plurality of preset monitoring categories, wherein, in a case where a current monitoring category is a target monitoring category in a plurality of preset monitoring categories, traversing each process to be monitored in the set of processes to be monitored, and monitoring each process to be monitored in the set of processes to be monitored according to the registration information of the process to be monitored currently traversed and the target monitoring category; a determining module, for determining a process in the set of processes to be monitored that satisfies at least one monitoring condition among a plurality of monitoring conditions as a target process, wherein each monitoring category in the plurality of preset monitoring categories corresponds to a monitoring condition.

[0015] According to another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0016] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0017] According to another embodiment of the present application, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in any of the above method embodiments are implemented.

[0018] Through the present application, the registration information of each process to be monitored in the set of processes to be monitored is received; each process to be monitored in the set of processes to be monitored is monitored according to multiple preset monitoring categories, wherein, when the current monitoring category is a target monitoring category in multiple preset monitoring categories, each process to be monitored in the set of processes to be monitored is traversed, and each process to be monitored in the set of processes to be monitored is monitored according to the registration information and the target monitoring category of the currently traversed process to be monitored; and a process in the set of processes to be monitored that meets at least one monitoring condition among multiple monitoring conditions is determined as a target process.

[0019] Since the process to be monitored and the type of the process to be monitored are registered to the basic management controller, the basic management controller can monitor the process to be monitored according to the registration information, thereby realizing the monitoring of the baseboard management controller. Therefore, the problem that the BMC process running status cannot be monitored in the related art can be solved, and the effect of ensuring the continuous and stable operation of the BMC can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a schematic diagram of the connection between the BMC and the monitoring component on the server according to an embodiment of the present application;

[0021] Figure 2 It is a hardware structure block diagram of a server device of a process monitoring method according to an embodiment of the present application;

[0022] Figure 3 is a flowchart of a method for process monitoring according to an embodiment of the present application;

[0023] Figure 4 is a flowchart of an in-situ monitoring process according to an embodiment of the present application;

[0024] Figure 5 is a flowchart of a file descriptor monitoring process according to an embodiment of the present application;

[0025] Figure 6 is a flowchart of memory usage monitoring process according to an embodiment of the present application;

[0026] Figure 7 is a flowchart of a processor usage monitoring process according to an embodiment of the present application;

[0027] Figure 8 is a flowchart of BMC process monitoring according to an embodiment of the present application;

[0028] Fig. 9 It is a structural block diagram of a process monitoring device according to an embodiment of the present application. DETAILED DESCRIPTION

[0029] A server is a dedicated computer that provides certain services to clients in a network environment. It is a high-performance computer system used to store, process and provide network services. BMC is a small embedded system that is mainly used to monitor the overall operation of the server. It is a management controller unique to the server. On the motherboard of the server, BMC and the server are two independent systems. In other words, BMC is a small operating system independent of the server system, which is used for remote management, monitoring, deployment, restart and other operations of the server. BMC is not affected by the server power on and off. It starts running when the power is turned on and is independent of the business system.

[0030] BMC monitors many devices on the server. Figure 1 is a schematic diagram of the connection between the BMC and the monitoring component on the server according to an embodiment of the present application, such as Figure 1 As shown in the figure, the BMC is connected to the non-volatile memory (flash) through the serial peripheral interface (SPI), connected to various I2C devices through the serial communication protocol (I2C) channel, monitors some pins through the general input and output port (GPIO), connected to the display or other graphic devices through the video transmission (RGB) interface, connected to other computers or devices through the serial communication (COM) interface, connected to the analog sensor through the analog-to-digital conversion (ADC) interface, connected to the storage device through the memory card (SD) interface, connected to the dedicated network card (Dedicated NIC) through the Ethernet communication interface (RMII / RGMII), and connected to the integrated circuit chip (PCH) through channels such as the high-speed serial interface (PCIE), the universal interface (USB), the low-speed interface (LPC), and the monitoring protocol (PECI), so as to obtain some information on the system side, such as the central processing unit (CPU), the memory chip (DIMM), the physical interface network card (Shared NIC), etc.

[0031] As server systems become more and more complex, the monitored components are also varied, and the communication interfaces of the components are gradually upgraded. The BMC code implementation is becoming more and more complex, and more problems will arise. When the BMC runs for a long time, in certain specific cases, segmentation errors, memory leaks, file descriptors, CPU occupancy and other problems may occur. These problems will cause the BMC to stop running, making it impossible to obtain the running status of the monitored server in real time, resulting in server downtime, affecting the business on the server, and even causing irreversible damage to the hardware. Therefore, ensuring the normal operation of the BMC is crucial to the stability and reliability of the server.

[0032] In summary, the present application proposes a process monitoring method, which monitors the running status of the BMC process by analyzing the / proc / pid file under the system, thereby ensuring the continuous and stable operation of the BMC and improving the stability and reliability of the server.

[0033] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0034] In order to help better understand the present application, some words in the embodiments are explained below:

[0035] BMC: Baseboard Management Controller, a microcontroller used to monitor and manage computer system hardware. It is usually integrated on the motherboard of a server or other computing device, and can remotely monitor hardware status, perform remote restarts, collect sensor data, and other functions.

[0036] pid: Processor id, process identification number, also known as process number. In a computer system, each process is assigned a unique identification number to distinguish different processes.

[0037] InspurProcmanager: A process management tool used to manage and monitor processes in the system. This tool can help users view the processes running in the system, end unnecessary processes, adjust the priority of processes, and other operations, thereby improving the performance and stability of the system. The InspurProcmanager process is usually run on the Inspur server or other devices, and can be operated and managed through the terminal or graphical interface.

[0038] IPMIMain: is a monitoring software used to monitor the status and performance of server hardware. It is usually used together with the server's IPMI (Intelligent Platform Management Interface) to monitor the server's temperature, fan speed, voltage and other hardware parameters in real time to ensure the stable operation of the server. IPMIMain can also provide alarm and notification functions to promptly notify the administrator to handle the problem when the hardware has a problem, playing an important role in server management and maintenance.

[0039] fd: File Descriptor, a file descriptor, is an integer value used in the operating system to identify and operate files or other I / O resources.

[0040] CPU: Central Processing Unit, is the main processor in a computer system, responsible for executing computer instructions and controlling the operation of the computer. CPU is one of the core components in a computer system.

[0041] Recvqueue: A receiving queue used to store the registration information of the receiving process. In this queue, the registration information of different receiving processes can be stored so that the monitoring thread can access and process this information as needed.

[0042] / proc / pid: is a special folder used to represent the processes running in the system. Each process has a unique identifier in the system, called a process ID (pid). The / proc / pid folder contains relevant information about the process, such as the process status, command line parameters, environment variables, file descriptors, etc. By viewing the / proc / pid folder, you can understand the running status of the process and monitor and manage the process.

[0043] Top: A command-line utility for real-time monitoring of system operation. It can display a list of running processes in the system and sort them by indicators such as CPU usage or memory usage to help users quickly locate processes that consume large system resources. With the top command, users can view the system's operating status in real time to adjust the allocation of system resources and optimize system performance in a timely manner.

[0044] It should be noted that the terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0045] The method embodiments provided in the embodiments of the present application can be executed in a server device or a similar computing device. Taking running on a server device as an example, Figure 2 1 is a hardware structure block diagram of a server device of a process monitoring method according to an embodiment of the present application. Figure 2 As shown, the server device may include one or more ( Figure 2 Only one is shown in the figure) a processor 202 (the processor 202 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 204 for storing data, wherein the server device may also include a transmission device 206 and an input / output device 208 for communication functions. It can be understood by those skilled in the art that Figure 2 The structure shown is only for illustration and does not limit the structure of the above server device. Figure 2 More or fewer components as shown, or with Figure 2 Different configurations are shown.

[0046] The memory 204 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for process monitoring in the embodiment of the present application. The processor 202 executes various functional applications and data processing by running the computer program stored in the memory 204, that is, to implement the above method. The memory 204 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 204 may further include a memory remotely arranged relative to the processor 202, and these remote memories may be connected to the server device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0047] The transmission device 206 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the server device. In one example, the transmission device 206 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 206 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0048] In this embodiment, a method for process monitoring is provided. Figure 3 is a flowchart of a method for process monitoring according to an embodiment of the present application, such as Figure 3 As shown, the process includes the following steps:

[0049] Step S302, receiving registration information of each process to be monitored in the set of processes to be monitored, wherein the registration information of the process to be monitored includes: an identity of the process to be monitored, a category to be monitored of the process to be monitored, and attribute information of the category to be monitored;

[0050] The above registration information can be the monitoring configuration information of the process to be monitored, such as the identity (pid) of the process to be monitored, the category to be monitored, the preset threshold corresponding to the monitoring category, the operation to be performed when the threshold is exceeded, etc.; during the BMC startup process, the InspurProcmanager process is started before IPMIMain, and the recvqueue receiving process registration is created, and different categories of monitoring threads are created to monitor the process to be detected, for example, whether the monitoring process exists, the number of process fd operations, the process memory usage, and the process cpu usage information; at the same time, after each process is started, the pid, monitoring category, threshold, action after exceeding the threshold, and other information are registered to the InspurProcmanger process, so that the InspurProcmanger process monitors each registered process.

[0051] Step S304, monitoring each process to be monitored in the set of processes to be monitored according to a plurality of preset monitoring categories, wherein, when the current monitoring category is a target monitoring category in a plurality of preset monitoring categories, traversing each process to be monitored in the set of processes to be monitored, and monitoring each process to be monitored in the set of processes to be monitored according to the registration information of the currently traversed process to be monitored and the target monitoring category;

[0052] The above monitoring categories can be the content that needs to be monitored set by the user according to actual needs, such as process presence, number of process file descriptors, memory usage, CPU usage, etc.; according to the current monitoring category, traverse each monitored process in the set of monitored processes to realize the monitoring of the process.

[0053] Specifically, according to the to-be-monitored category in the registration information of each of the to-be-monitored processes, the target to-be-monitored process whose to-be-monitored category is the target monitoring category is determined in the to-be-monitored process set to obtain a target to-be-monitored process set, wherein the target monitoring process set includes at least one target monitoring process; the following operations are performed on the i-th target to-be-monitored process in the target to-be-monitored process set, wherein i is an integer greater than or equal to 1: each process status information under the specified path of the i-th target to-be-monitored process is traversed, and when the currently traversed process status information is the current process status information and the current process status information is the process status information corresponding to the target monitoring category, the current process status information is determined as the target process status information; the target monitoring category of each of the target to-be-monitored processes in the target to-be-monitored process set is monitored according to the target process status information of each of the target to-be-monitored processes and the registration information of each of the target to-be-monitored processes.

[0054] The above-mentioned target processes to be monitored can be all processes to be monitored, or some of the monitored processes; the above-mentioned specified path can be a specified folder, such as / proc / pid / , which contains relevant information of the process, such as the process status, command line parameters, environment variables, file descriptors, etc., or it can be a specified instruction, such as top, which can monitor the operation of the system in real time, check the CPU usage, etc.; according to the monitoring category, determine the processes that need to be monitored in the monitoring category, obtain the target monitoring process set, traverse the specified paths of each process to be monitored according to the identity representation of each monitored process in the target monitoring process set, obtain the process status information of each process to be monitored, and monitor each process to be monitored according to the process status information and the registration information of each process, so as to perform corresponding operations.

[0055] By pre-setting registration information and real-time monitoring of each process, abnormal processes in the system can be discovered in time, such as those occupying too many resources and operating abnormally, so that users can take timely measures to adjust resource allocation and deal with related problems, thereby avoiding affecting the entire BMC and improving the stability and security of the BMC.

[0056] Step S306: Determine a process in the set of processes to be monitored that satisfies at least one monitoring condition among a plurality of monitoring conditions as a target process, wherein each monitoring category in the plurality of preset monitoring categories corresponds to a monitoring condition.

[0057] The above monitoring conditions may be threshold comparison, character judgment, etc., and the above target process may be an abnormal process. By monitoring the monitored processes, it is determined that the monitored process that meets at least one monitoring condition is an abnormal process, so that corresponding operations can be performed on the abnormal process, which helps to optimize the performance and resource utilization of the BMC, protect the security of BMCDE data and information, and improve the reliability and availability of the BMC.

[0058] Optionally, after determining a process in the set of processes to be monitored that satisfies at least one of multiple monitoring conditions as a target process, the method further includes: performing a restart operation on the target process; and / or recording the identity of the target process in a target log.

[0059] After determining the target process, the target is restarted or terminated, and a relevant process log is recorded. The content of the log includes but is not limited to the identity representation of the process, the status information of the process, and the operations performed on the process.

[0060] When a process has a problem but it is not serious, only logs are recorded; when a process has a serious problem, logs are recorded and the process is restarted or terminated at the same time. This can ensure the normal operation of the BMC, enhance the robustness of the BMC, and ensure that the server-side business can run uninterruptedly. At the same time, the recorded logs can help the BMC locate the cause of the problem and speed up the resolution of the problem.

[0061] Through the above steps, the InspurProcmanager daemon is started during the BMC startup process, and recvqueue is created to register the receiving process and different types of monitoring threads are created for monitoring, so that the operation of the BMC process can be monitored and corresponding operations are performed when problems occur in the process, ensuring the normal operation of the BMC, enhancing the robustness of the BMC, and ensuring that the server-side business can run uninterruptedly. The problem of being unable to monitor the running status of the BMC process in related technologies is solved, and the reliability and stability of the BMC are improved.

[0062] The execution subject of the above steps may be a server, a terminal, etc., but is not limited thereto.

[0063] As an optional implementation, the target monitoring category of each target process to be monitored in the target process set is monitored according to the target process status information of each target process to be monitored and the registration information of each target process to be monitored, including: obtaining the attribute information of the target monitoring category from the registration information of the i-th target process to be monitored; monitoring the target monitoring category of the i-th target process to be monitored according to the attribute information of the target monitoring category and / or the target process status information.

[0064] The above-mentioned target monitoring category can be to determine whether the process to be monitored is in place, the number of file descriptors of the monitoring process, the memory occupancy of the process to be monitored, the processor usage of the process to be monitored, etc.; the above-mentioned attribute information can be the threshold corresponding to the monitoring category, such as the occupancy threshold, the descriptor threshold, etc., or the corresponding character string, etc.; according to the monitoring category, the attribute information of the process to be monitored corresponding to the monitoring category is obtained in the registration information of the process to be monitored, so as to monitor the process to be monitored.

[0065] As an optional implementation, the target monitoring category of the i-th target process to be monitored is monitored according to the attribute information of the target monitoring category and / or the target process status information, including: when the target monitoring category is to determine whether the process to be monitored is in place, determining whether there is an in-place mark in the target process status information; when the in-place mark does not exist in the target process status information, determining that the i-th target process to be monitored satisfies a first monitoring condition, and the multiple monitoring conditions include the first monitoring condition.

[0066] The above-mentioned in-place flag can be the R, S, and D characters in the State field in the / proc / pid / stat file, where / proc / pid / stat is a file in the Linux system, used to display statistical information related to the specified process, and the file includes a stat field, the field is R, indicating that the process is running; the field is S, indicating that the process can interrupt sleep (waiting for an event); the field is D, indicating that the process is uninterruptible sleep (usually waiting for IO); the field is T, indicating that the process is stopped; the field is Z, indicating a zombie process; the above-mentioned first monitoring condition can be that the in-place flag does not exist in the process status information; when the in-place flag does not exist in the process status information, it is determined that the process meets the first monitoring condition.

[0067] As an optional implementation, Figure 4 is a flowchart of the process in-situ monitoring process according to an embodiment of the present application, such as Figure 4 The specific on-site monitoring process is as follows:

[0068] Step S401, read the process status information under / proc / pid / stat in sequence, where pid is the processor id of the registered process;

[0069] Step S402, judging whether the process exists according to the read data: the read state information contains a State field, and when the value of the State field is R, S or D, it indicates that the process is in place, and other values ​​indicate that the process is not in place, where: R indicates running; S indicates interruptible sleep (waiting for an event); D indicates uninterruptible sleep (usually waiting for IO); T indicates stopped; Z indicates a zombie process;

[0070] Step S403: If the process is not in place, restart the process and record the corresponding log;

[0071] Step S404, if the process is in place, determine whether it is the last process;

[0072] Step S405, if it is not the last process, continue to poll other processes; if it is the last process, end the process in-place monitoring processing.

[0073] As an optional implementation, the target monitoring category of the i-th target process to be monitored is monitored according to the attribute information of the target monitoring category and / or the target process status information, including: when the target monitoring category is to monitor the number of file descriptors of the process to be monitored, obtaining a descriptor threshold in the registration information of the i-th target process to be monitored, wherein the attribute information of the target monitoring category includes the descriptor threshold; when the number of file descriptors of the i-th target process to be monitored in the target process status information is greater than or equal to the descriptor threshold, determining that the i-th target process to be monitored satisfies a second monitoring condition, and the multiple monitoring conditions include the second monitoring condition.

[0074] The above-mentioned number of file descriptors can be obtained through / proc / pid / fd, where a file descriptor is an integer value used to identify and access files or other I / O resources. Each open file, socket or pipe has a unique file descriptor, and the program can use this file descriptor to read, write or operate the corresponding file or resource; the above-mentioned second monitoring condition may be that the number of file descriptors of the process is greater than or equal to a preset descriptor threshold, where the preset descriptor thresholds of different processes may be the same or different, and the descriptor threshold of each process may be one or more. In the case of multiple descriptor thresholds, different descriptor thresholds may correspond to different processing methods after exceeding the threshold; when the number of file descriptors of the process is greater than or equal to the preset descriptor threshold, it is determined that the process meets the second monitoring condition.

[0075] As an optional implementation, Figure 5 is a flowchart of the file descriptor monitoring process according to an embodiment of the present application, such as Figure 5 As shown, the specific file descriptor monitoring process is as follows:

[0076] Step S501, cyclically scan the number of / proc / pid / fd to calculate the number of fds of the current process;

[0077] Step S502, determine whether the number of fds currently in use exceeds 85% of the set value (the first descriptor threshold). If it exceeds 85%, restart the process and record a log containing process information, the number of fds, and the percentage of fds used.

[0078] Step S503, if the number of fds of the process does not exceed 85% of the set value, further determine whether it exceeds 50% of the set value (the second descriptor threshold). If it exceeds 50%, only logs containing process information, number of fds and percentage of fd usage are recorded, and continue to monitor the next process;

[0079] Step S504, determine whether it is the last process, if not, continue to poll other processes;

[0080] Step S505: If it is the last process, the file descriptor monitoring process is terminated.

[0081] As an optional implementation, the target monitoring category of the i-th target process to be monitored is monitored according to the attribute information of the target monitoring category and / or the target process status information, including: when the target monitoring category is to monitor the memory occupancy of the process to be monitored, obtaining a memory occupancy threshold from the registration information of the i-th target process to be monitored; when the memory occupancy of the i-th target process to be monitored in the target process status information is greater than or equal to the memory occupancy threshold, determining that the i-th target process to be monitored satisfies a third monitoring condition, and the multiple monitoring conditions include the third monitoring condition.

[0082] The above-mentioned memory usage can be obtained through the Vmsize field in the / proc / pid / status file, where this field indicates the size of memory being used by the process; the above-mentioned third monitoring condition may be that the memory usage of the process is greater than or equal to a preset memory usage threshold, where the preset memory usage thresholds of different processes may be the same or different, and the memory usage threshold of each process may be one or more. In the case of multiple memory usage thresholds, different memory usage thresholds may correspond to different processing methods after exceeding the threshold; when the memory usage of the process is greater than or equal to the preset memory usage threshold, it is determined that the process meets the third monitoring condition.

[0083] Optionally, when all target processes to be monitored do not exceed the memory usage threshold and the target processes to be monitored are judged, the total memory usage of all target processes to be monitored is calculated in the / proc / meminfo file, and it is judged whether the total memory usage exceeds a preset value. If the total memory usage exceeds the preset value of the total memory, the BMC is restarted and detailed logs are recorded, such as the identity of each process and the memory usage. The specific calculation formula is:

[0084] Total memory usage = (MemTotal-MemFree-MemBuffers-MemCached) / MemTotal;

[0085] Among them, MemTotal is the total memory of BMC; MemFree is the amount of available memory; MemBuffers and MemCached are the amounts of reclaimable memory.

[0086] By monitoring the total memory usage of each process in the BMC and performing corresponding operations on the BMC when it exceeds the preset value, such as restarting the BMC or interrupting certain processes, the BMC performance degradation or even crash caused by excessive memory usage is avoided, the BMC failure or interruption time is effectively reduced, the stability and reliability of the BMC are improved, and the continuous and stable operation of the BMC is ensured.

[0087] As an optional implementation, Figure 6 is a flow chart of memory usage monitoring processing according to an embodiment of the present application, such as Figure 6 As shown in the figure, the specific memory usage monitoring process is as follows:

[0088] Step S60 1, loop through the / proc / pid / status file, read the Vmsize field therein, and obtain the memory size being used by the process;

[0089] Step S602, determining whether the memory size used by the current process exceeds 85% of the set value, if it exceeds 85%, restarting the process and recording a log containing process information;

[0090] Step S603, if the memory size used by the process does not exceed 85% of the set value, further determine whether it exceeds 50% of the set value. If it exceeds 50% of the set value, record a log containing the memory usage of the process and continue to monitor the next process;

[0091] Step S604, if the memory size used by the process memory does not exceed 50% of the set value, determine whether it is the last process;

[0092] Step S605, if it is not the last process, continue to monitor the next process;

[0093] Step S606, if it is the last process, the memory usage of all processes is calculated in the / proc / meminfo file;

[0094] Step S607, determining whether the memory usage of all processes exceeds 85% of the total memory. If it exceeds 85% of the total memory, a detailed log is recorded and the BMC is restarted.

[0095] Step S608: If it does not exceed 85% of the total memory, the memory usage monitoring process is terminated.

[0096] As an optional implementation, the target monitoring category of the i-th target process to be monitored is monitored according to the attribute information of the target monitoring category and / or the target process status information, including: when the target monitoring category is to monitor the processor usage of the process to be monitored, obtaining a processor usage threshold from the registration information of the i-th target process to be monitored; when the processor usage of the i-th target process to be monitored in the target process status information is greater than or equal to the processor usage threshold, determining that the i-th target process to be monitored satisfies a fourth monitoring condition, and the fourth monitoring condition is included in the multiple monitoring conditions.

[0097] The above-mentioned processor usage (CPU usage) can be viewed through the top command; the above-mentioned fourth monitoring condition can be that the processor usage of the process is greater than or equal to the preset processor usage threshold, wherein the preset processor usage thresholds of different processes may be the same or different, and the processor usage threshold of each process may be one or more. In the case of multiple processor usage thresholds, different processor usage thresholds may correspond to different processing methods after exceeding the threshold; when the processor usage of the process is greater than or equal to the preset processor usage threshold, it is determined that the process meets the fourth monitoring condition.

[0098] As an optional implementation, Figure 7 is a flowchart of the processor usage monitoring process according to an embodiment of the present application, such as Figure 7 As shown in the figure, the specific processor usage monitoring process is as follows:

[0099] Step S701, cyclically checking the CPU usage in top;

[0100] Step S702: if the CPU usage of the process exceeds 85% of the set value, restart the process and record a log containing detailed information;

[0101] Step S703, if the CPU usage of the process does not exceed 85% of the set value, then determine whether the CPU usage of the process exceeds 50% of the set value;

[0102] Step S704, if it exceeds 50% of the set value, then record the log and continue to monitor the next process;

[0103] Step S705, if it does not exceed 50% of the set value, determine whether it is the last process;

[0104] Step S706, if it is not the last process, continue to monitor the next process;

[0105] Step S707: If it is the last process, check the overall CPU usage through top. If the overall CPU usage exceeds 85%, record the log and restart the BMC.

[0106] Step S708: If the overall CPU utilization does not exceed 85%, the processor utilization monitoring module is terminated.

[0107] As an optional implementation, Figure 8 is a flowchart of BMC process monitoring according to an embodiment of the present application, such as Figure 8 As shown, the specific process is as follows:

[0108] Step S80 1, during the BMC startup process, start the InspurProcmanager daemon process;

[0109] Step S802, creating a recvqueue to register the receiving process and creating different types of monitoring threads for monitoring, and at the same time, receiving IPMIMain monitoring registration information;

[0110] Step S803, sequentially performing process presence monitoring processing, file descriptor monitoring processing, memory usage monitoring processing, and processor usage monitoring processing on the monitored process.

[0111] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in each embodiment of the present application.

[0112] In this embodiment, a process monitoring device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0113] Fig. 9 is a structural block diagram of a process monitoring device according to an embodiment of the present application, such as Fig. 9As shown, the device includes: a receiving module 902, which is used to receive registration information of each process to be monitored in the set of processes to be monitored, wherein the registration information of the process to be monitored includes: an identity identifier of the process to be monitored, a category to be monitored of the process to be monitored, and attribute information of the category to be monitored; a monitoring module 904, which is used to monitor each process to be monitored in the set of processes to be monitored according to a plurality of preset monitoring categories, wherein, in the case where the current monitoring category is a target monitoring category in a plurality of preset monitoring categories, traverse each process to be monitored in the set of processes to be monitored, and monitor each process to be monitored in the set of processes to be monitored according to the registration information of the process to be monitored currently traversed and the target monitoring category; a determining module 906, which is used to determine a process in the set of processes to be monitored that satisfies at least one monitoring condition in a plurality of monitoring conditions as a target process, wherein each monitoring category in the plurality of preset monitoring categories corresponds to a monitoring condition.

[0114] In an exemplary embodiment, the device is also used to determine, in the set of processes to be monitored, target processes to be monitored whose to-be-monitored categories are the target monitoring categories based on the to-be-monitored categories in the registration information of each of the processes to be monitored, to obtain a set of target processes to be monitored, wherein the set of target monitoring processes includes at least one target monitoring process; perform the following operations on the i-th target process to be monitored in the set of target processes to be monitored, wherein i is an integer greater than or equal to 1: traverse each process status information under a specified path of the i-th target process to be monitored, and when the currently traversed process status information is the current process status information and the current process status information is the process status information corresponding to the target monitoring category, determine the current process status information as the target process status information; monitor the target monitoring category of each of the target processes to be monitored in the set of target processes to be monitored based on the target process status information of each of the target processes to be monitored and the registration information of each of the target processes to be monitored.

[0115] In an exemplary embodiment, the device is also used to obtain attribute information of the target monitoring category in the registration information of the i-th target process to be monitored; and monitor the target monitoring category of the i-th target process to be monitored based on the attribute information of the target monitoring category and / or the target process status information.

[0116] In an exemplary embodiment, the device is also used to determine whether there is an in-place flag in the target process status information when the target monitoring category is to determine whether the process to be monitored is in place; when the in-place flag does not exist in the target process status information, determine that the i-th target process to be monitored satisfies a first monitoring condition, and the multiple monitoring conditions include the first monitoring condition.

[0117] In an exemplary embodiment, the device is also used to obtain a descriptor threshold in the registration information of the i-th target process to be monitored, when the target monitoring category is to monitor the number of file descriptors of the process to be monitored, wherein the attribute information of the target monitoring category includes the descriptor threshold; and when the number of file descriptors of the i-th target process to be monitored in the target process status information is greater than or equal to the descriptor threshold, determine that the i-th target process to be monitored satisfies a second monitoring condition, and the multiple monitoring conditions include the second monitoring condition.

[0118] In an exemplary embodiment, the device is also used to obtain a memory occupancy threshold in the registration information of the i-th target process to be monitored when the target monitoring category is to monitor the memory occupancy of the process to be monitored; and to determine that the i-th target process to be monitored satisfies a third monitoring condition, wherein the third monitoring condition is included in the multiple monitoring conditions, when the memory occupancy of the i-th target process to be monitored in the target process status information is greater than or equal to the memory occupancy threshold.

[0119] In an exemplary embodiment, the device is also used to obtain a processor usage threshold in the registration information of the i-th target process to be monitored when the target monitoring category is to monitor the processor usage of the process to be monitored; and to determine that the i-th target process to be monitored satisfies a fourth monitoring condition, when the processor usage of the i-th target process to be monitored in the target process status information is greater than or equal to the processor usage threshold, and the fourth monitoring condition is included in the multiple monitoring conditions.

[0120] In an exemplary embodiment, the device is further configured to execute a restart operation on the target process; and / or record the identity of the target process in a target log.

[0121] It should be noted that the above modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0122] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when running.

[0123] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0124] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0125] In an exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0126] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps in any one of the above method embodiments are implemented.

[0127] For specific examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementation modes, and this embodiment will not be described in detail herein.

[0128] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0129] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application shall be included in the protection scope of the present application.

Claims

1. A process monitoring method, It is characterized in that Applicable to baseboard management controllers, including: Receive registration information of each process to be monitored in the set of processes to be monitored, wherein the registration information of the process to be monitored includes: an identity identifier of the process to be monitored, a category to be monitored of the process to be monitored, and attribute information of the category to be monitored; Monitor each process to be monitored in the set of processes to be monitored according to a plurality of preset monitoring categories, wherein, when the current monitoring category is a target monitoring category in a plurality of preset monitoring categories, traverse each process to be monitored in the set of processes to be monitored, and monitor each process to be monitored in the set of processes to be monitored according to the registration information of the currently traversed process to be monitored and the target monitoring category; A process in the set of processes to be monitored that satisfies at least one monitoring condition among a plurality of monitoring conditions is determined as a target process, wherein each monitoring category in the plurality of preset monitoring categories corresponds to a monitoring condition.

2. The method according to claim 1, It is characterized in that Monitoring each of the processes to be monitored in the set of processes to be monitored according to the registration information of the currently traversed process to be monitored and the target monitoring category includes: According to the to-be-monitored category in the registration information of each of the to-be-monitored processes, determining in the to-be-monitored process set a target to-be-monitored process whose to-be-monitored category is the target monitoring category, and obtaining a target to-be-monitored process set, wherein the target to-be-monitored process set includes at least one target monitoring process; Perform the following operations on the i-th target process to be monitored in the target process to be monitored set, where i is an integer greater than or equal to 1: Traversing each process status information under the specified path of the i-th target process to be monitored, and when the currently traversed process status information is the current process status information and the current process status information is the process status information corresponding to the target monitoring category, determining the current process status information as the target process status information; The target monitoring category of each of the target processes to be monitored in the set of target processes to be monitored is monitored according to the target process status information of each of the target processes to be monitored and the registration information of each of the target processes to be monitored.

3. The method according to claim 2, It is characterized in that Monitoring the target monitoring category of each of the target processes to be monitored in the set of target processes to be monitored according to the target process status information of each of the target processes to be monitored and the registration information of each of the target processes to be monitored, including: Acquire the attribute information of the target monitoring category from the registration information of the i-th target process to be monitored; The target monitoring category of the i-th target process to be monitored is monitored according to the attribute information of the target monitoring category and / or the target process status information.

4. The method according to claim 3, It is characterized in that Monitoring the target monitoring category of the i-th target process to be monitored according to the attribute information of the target monitoring category and / or the target process state information includes: In the case where the target monitoring category is to determine whether the process to be monitored is in place, determining whether there is an in place mark in the target process status information; When the in-place flag does not exist in the target process status information, it is determined that the i-th target process to be monitored satisfies a first monitoring condition, and the multiple monitoring conditions include the first monitoring condition.

5. The method according to claim 3, It is characterized in that Monitoring the target monitoring category of the i-th target process to be monitored according to the attribute information of the target monitoring category and / or the target process state information includes: In the case where the target monitoring category is to monitor the number of file descriptors of the process to be monitored, obtaining a descriptor threshold in the registration information of the i-th target process to be monitored, wherein the attribute information of the target monitoring category includes the descriptor threshold; When the number of file descriptors of the i-th target process to be monitored in the target process status information is greater than or equal to the descriptor threshold, it is determined that the i-th target process to be monitored meets the second monitoring condition, and the multiple monitoring conditions include the second monitoring condition.

6. The method according to claim 3, It is characterized in that Monitoring the target monitoring category of the i-th target process to be monitored according to the attribute information of the target monitoring category and / or the target process state information includes: In a case where the target monitoring category is to monitor the memory usage of the process to be monitored, obtaining a memory usage threshold value from the registration information of the i-th target process to be monitored; When the memory usage of the i-th target process to be monitored in the target process status information is greater than or equal to the memory usage threshold, it is determined that the i-th target process to be monitored satisfies a third monitoring condition, and the multiple monitoring conditions include the third monitoring condition.

7. The method according to claim 3, It is characterized in that Monitoring the target monitoring category of the i-th target process to be monitored according to the attribute information of the target monitoring category and / or the target process state information includes: In a case where the target monitoring category is to monitor the processor usage of the process to be monitored, obtaining a processor usage threshold value from the registration information of the i-th target process to be monitored; When the processor usage of the i-th target process to be monitored in the target process status information is greater than or equal to the processor usage threshold, it is determined that the i-th target process to be monitored meets the fourth monitoring condition, and the multiple monitoring conditions include the fourth monitoring condition.

8. The method according to any one of claims 1 to 7, It is characterized in that After determining a process in the set of processes to be monitored that satisfies at least one of the multiple monitoring conditions as a target process, the method further includes: Restarting the target process; and / or The identity of the target process is recorded in the target log.

9. A process monitoring device, It is characterized in that Applicable to baseboard management controllers, including: A receiving module, configured to receive registration information of each process to be monitored in the set of processes to be monitored, wherein the registration information of the process to be monitored includes: an identity of the process to be monitored, a category to be monitored of the process to be monitored, and attribute information of the category to be monitored; A monitoring module, for monitoring each process to be monitored in the set of processes to be monitored according to a plurality of preset monitoring categories, wherein, when the current monitoring category is a target monitoring category in a plurality of preset monitoring categories, traversing each process to be monitored in the set of processes to be monitored, and monitoring each process to be monitored in the set of processes to be monitored according to the registration information of the currently traversed process to be monitored and the target monitoring category; A determination module is used to determine a process in the set of processes to be monitored that meets at least one monitoring condition among multiple monitoring conditions as a target process, wherein each monitoring category in the multiple preset monitoring categories corresponds to a monitoring condition.

10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, wherein the computer program implements the steps of the method described in any one of claims 1 to 8 when executed by a processor.