Server monitoring method and device, electronic equipment and storage medium

By adopting a nested execution monitoring script structure in the server monitoring system, the problem of data cannot be reported normally due to timeout or failure of monitoring script execution is solved, and effective monitoring of the server and data integrity are guaranteed.

CN119668974APending Publication Date: 2025-03-21CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411696570.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

In the existing server monitoring methods, monitoring scripts are prone to abnormalities such as execution timeout or execution failure, resulting in the monitoring data being unable to be reported normally, affecting the effective monitoring of the server.

Method used

It adopts a nested execution monitoring script structure, which is divided into the first layer of monitoring script and the second layer of monitoring script. The first layer monitoring script is used to call and obtain the task execution status of the second layer monitoring script, including task execution success, timeout and failure.

Benefits of technology

Ensure that no matter whether the monitoring task is successfully executed, timed out or failed, the monitoring platform can receive the monitoring situation and data returned by the monitoring script, ensuring the integrity of the monitoring data, making it convenient for the monitoring platform to process it in a timely manner, and achieving effective monitoring of the server.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119668974A_ABST
    Figure CN119668974A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a server monitoring method and device, electronic equipment and a storage medium, and the method comprises the steps: issuing a first-layer monitoring script to a monitored server, calling a second-layer monitoring script by adopting the first-layer monitoring script, and enabling the second-layer monitoring script to be used for executing a monitoring task, the first-layer monitoring script is adopted to obtain a task execution condition returned by the second-layer monitoring script, the task execution condition comprises at least one of task execution success, task execution timeout and task execution failure, the first-layer monitoring script is adopted to determine a monitoring result corresponding to the task execution condition, and the monitoring result is returned to the monitoring platform. According to the embodiment of the invention, no matter the execution of the monitoring task is successful, overtime or failed, the monitoring platform can receive the monitoring condition and the monitoring data returned by the monitoring script, so that normal monitoring and abnormal monitoring data of the script can be reported in time, the integrity of the monitoring data is ensured, and effective monitoring of the server is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of server technology, and specifically relates to a server monitoring method, a server monitoring device, an electronic device, and a computer-readable storage medium. Background Art

[0002] The stable operation of the server is the key to ensuring business continuity and data security. In order to ensure that the server and the services running on it can work continuously and efficiently, it is particularly important to monitor the server's operating status in real time.

[0003] At present, the monitoring method commonly used in the industry is to periodically execute monitoring scripts on the monitored servers and send the monitoring data output by the monitoring scripts to the monitoring platform, so as to handle the abnormal situation of the server according to the monitoring data. However, due to the high execution frequency of monitoring scripts, the monitored server usually sets a timeout when starting the monitoring script. If the monitoring script execution time times out, the monitoring script will be forced to stop running, resulting in the inability to report the monitoring data normally, and the monitoring platform cannot obtain the server's operating status information. In addition to the timeout problem, when the monitoring script fails to execute, its output result may appear in a disordered format or abnormal data, which will also cause the monitoring data to be unable to be reported normally. In other words, the current monitoring script is prone to abnormal conditions of execution timeout or execution failure, resulting in the inability to report the monitoring data normally, further affecting the effective monitoring of the server. Summary of the invention

[0004] In view of this, the present invention aims to propose a server monitoring method, device, electronic device and storage medium to solve the problem that the current monitoring script is prone to abnormal conditions of execution timeout or execution failure, resulting in the inability to report monitoring data normally, and the monitoring platform is unable to obtain the server's operating status information, affecting the effective monitoring of the server.

[0005] According to a first aspect of the present invention, there is provided a server monitoring method, which is applied to a monitoring platform, wherein the monitoring platform communicates with a monitored server, and the method comprises:

[0006] Sending a first-layer monitoring script to the monitored server;

[0007] Using the first layer monitoring script to call the second layer monitoring script; wherein the second layer monitoring script is used to perform monitoring tasks;

[0008] The first-layer monitoring script is used to obtain the task execution status returned by the second-layer monitoring script; wherein the task execution status includes at least one of task execution success, task execution timeout, and task execution failure;

[0009] The first layer monitoring script is used to determine the monitoring result corresponding to the task execution status, and the monitoring result is transmitted back to the monitoring platform.

[0010] Optionally, sending the first-layer monitoring script to the monitored server includes:

[0011] In response to the call request of the monitored server, a monitoring script is determined; the monitoring script includes a first-layer monitoring script and a second-layer monitoring script;

[0012] A first-layer monitoring script is determined from the monitoring scripts, and the first-layer monitoring script is sent to the monitored server.

[0013] Optionally, the using the first-layer monitoring script to call the second-layer monitoring script includes:

[0014] Adding a preset timeout instruction to the monitoring script to obtain a second-layer monitoring script; the preset timeout instruction is used to control the second-layer monitoring script to perform the monitoring task within a preset time period;

[0015] The first layer monitoring script is used to initiate a call to the second layer monitoring script, and the second layer monitoring script is executed.

[0016] Optionally, the using the first-layer monitoring script to obtain the task execution status returned by the second-layer monitoring script includes:

[0017] The second-layer monitoring script is used to perform a monitoring task on the server within a preset time period, determine the task execution status, and send a return code corresponding to the task execution status to the first-layer monitoring script;

[0018] Using the first layer monitoring script to receive the return code of the second layer monitoring script;

[0019] The first-layer monitoring script is used to obtain the task execution status of the second-layer monitoring script according to the return code.

[0020] Optionally, the using the first-layer monitoring script to determine the monitoring result corresponding to the task execution status, and transmitting the monitoring result back to the monitoring platform includes:

[0021] The first-layer monitoring script is used to detect that the second-layer monitoring script has finished executing, and a unified script return code is generated;

[0022] The first layer monitoring script is used to obtain monitoring data corresponding to the task execution status, and the monitoring data is determined as the monitoring result to be transmitted back to the monitoring platform;

[0023] The first layer monitoring script is used to transmit the monitoring result and the script return code back to the monitoring platform.

[0024] Optionally, the using the first-layer monitoring script to obtain monitoring data corresponding to the task execution status, and determining the monitoring data as monitoring results to be transmitted back to the monitoring platform, includes:

[0025] If the task execution status is successful, the first layer monitoring script is used to obtain the task monitoring data of the second layer monitoring script, and the task monitoring data is determined as the first monitoring result to be transmitted back to the monitoring platform;

[0026] If the task execution status is task execution timeout or task execution failure, the first layer monitoring script is used to generate abnormal monitoring data of the second layer monitoring script, and the abnormal monitoring data is determined as the second monitoring result to be transmitted back to the monitoring platform.

[0027] According to a second aspect of the present invention, there is provided a server monitoring device, which is applied to a monitoring platform, wherein the monitoring platform communicates with a monitored server, and the device comprises:

[0028] A script sending module, used for sending the first layer monitoring script to the monitored server;

[0029] A script calling module, used to call a second-layer monitoring script using the first-layer monitoring script; wherein the second-layer monitoring script is used to execute a monitoring task;

[0030] A monitoring execution module, used to use the first layer monitoring script to obtain the task execution status returned by the second layer monitoring script; wherein the task execution status includes at least one of task execution success, task execution timeout and task execution failure;

[0031] The result determination module is used to use the first-layer monitoring script to determine the monitoring result corresponding to the task execution status, and transmit the monitoring result back to the monitoring platform.

[0032] Optionally, the script issuing module includes:

[0033] A first determining submodule is used to determine a monitoring script in response to a call request of the monitored server; the monitoring script includes a first-layer monitoring script and a second-layer monitoring script;

[0034] The sending submodule is used to determine the first-layer monitoring script from the monitoring scripts and send the first-layer monitoring script to the monitored server.

[0035] Optionally, the script calling module includes:

[0036] A processing submodule, used for adding a preset timeout instruction to the monitoring script to obtain a second-layer monitoring script; the preset timeout instruction is used to control the second-layer monitoring script to perform the monitoring task within a preset time period;

[0037] The calling submodule is used to use the first-layer monitoring script to initiate the call of the second-layer monitoring script and execute the second-layer monitoring script.

[0038] Optionally, the monitoring execution module includes:

[0039] A second determination submodule is used to use the second-layer monitoring script to perform a monitoring task on the server within a preset time period, determine the task execution status, and send a return code corresponding to the task execution status to the first-layer monitoring script;

[0040] A receiving submodule, configured to receive a return code of the second layer monitoring script using the first layer monitoring script;

[0041] The acquisition submodule is used to use the first-layer monitoring script to obtain the task execution status of the second-layer monitoring script according to the return code.

[0042] Optionally, the result determination module includes:

[0043] A generating submodule, used to detect the end of execution of the second layer monitoring script by using the first layer monitoring script, and generate a unified script return code;

[0044] A third determination submodule is used to obtain monitoring data corresponding to the task execution status using the first layer monitoring script, and determine the monitoring data as monitoring results to be transmitted back to the monitoring platform;

[0045] The feedback submodule is used to use the first layer monitoring script to transmit the monitoring result and the script return code back to the monitoring platform.

[0046] Optionally, the third determining submodule includes:

[0047] A first result unit is used for, if the task execution status is successful, using the first layer monitoring script to obtain the task monitoring data of the second layer monitoring script, and determining the task monitoring data as a first monitoring result to be transmitted back to the monitoring platform;

[0048] The second result unit is used to use the first-layer monitoring script to generate abnormal monitoring data of the second-layer monitoring script if the task execution status is task execution timeout or task execution failure, and determine the abnormal monitoring data as the second monitoring result to be sent back to the monitoring platform.

[0049] According to another aspect of the present invention, there is also provided an electronic device, comprising:

[0050] processor;

[0051] a memory for storing instructions executable by the processor;

[0052] Wherein, the processor is configured to execute the instructions to implement the server monitoring method as described above.

[0053] According to another aspect of the present invention, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the server monitoring method described above are implemented.

[0054] The server monitoring method provided by the embodiment of the present invention is as follows: the monitoring platform sends a first-layer monitoring script to the monitored server, and uses the first-layer monitoring script to call the second-layer monitoring script, the second-layer monitoring script is used to execute the monitoring task, and the first-layer monitoring script is used to obtain the task execution status returned by the second-layer monitoring script, the task execution status includes at least one of successful task execution, task execution timeout and task execution failure, and the first-layer monitoring script is used to determine the monitoring result corresponding to the task execution status, and the monitoring result is transmitted back to the monitoring platform. The embodiment of the present invention divides the monitoring script into a nested structure of a first-layer monitoring script for monitoring the process and a second-layer monitoring script for executing the monitoring task, so that no matter whether the monitoring task is executed successfully, times out or fails, the monitoring platform can receive the monitoring status and monitoring data returned by the monitoring script, ensuring that both normal monitoring and abnormal monitoring data of the script itself can be reported in time, thereby ensuring the integrity of the monitoring data, facilitating timely processing by the monitoring platform, and realizing effective monitoring of the server. BRIEF DESCRIPTION OF THE DRAWINGS

[0055] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0056] Figure 1 is a flow chart of the steps of a server monitoring method provided by an embodiment of the present invention;

[0057] Figure 2 yes Figure 1 A flowchart of step 101 in the server monitoring method provided in an embodiment of the present invention;

[0058] Figure 3 yes Figure 1 A flowchart of step 102 in the server monitoring method provided in an embodiment of the present invention;

[0059] Figure 4 yes Figure 1 The flowchart of step 103 in the server monitoring method provided by the embodiment of the present invention;

[0060] Figure 5 yes Figure 1 A flowchart of step 104 in the server monitoring method provided in an embodiment of the present invention;

[0061] Figure 6 It is a structural schematic diagram of a server monitoring device provided by an embodiment of the present invention;

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

[0063] To make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in the embodiments of the present invention, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can be implemented. The division of the following embodiments is for the convenience of description, and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined and referenced with each other without contradiction.

[0064] Reference Figure 1 , shows a flow chart of the steps of a server monitoring method provided by an embodiment of the present invention, which is applied to a monitoring platform, wherein the monitoring platform communicates with a monitored server, and the method may include:

[0065] Step 101: Send the first-layer monitoring script to the monitored server.

[0066] In an embodiment of the present invention, in order to solve the problem that the current monitoring script is prone to abnormal conditions such as execution timeout or execution failure, resulting in the inability to report monitoring data normally, the monitoring platform is unable to obtain the server's operating status information, and the problem of affecting effective monitoring of the server, this embodiment adopts a nested execution monitoring script structure to realize the monitoring of the monitoring script's own operating status. Regardless of whether the monitoring task is executed successfully, times out or fails, the monitoring platform can receive the monitoring status and monitoring data returned by the monitoring script, ensuring that both normal monitoring and the script's own abnormal monitoring data can be reported in a timely manner, thereby ensuring the integrity of the monitoring data.

[0067] It should be noted that in this embodiment, the monitoring platform establishes a communication connection with the monitored server to ensure that the monitoring platform can send monitoring scripts to the server to be monitored. Multiple monitoring scripts are pre-configured in the monitoring platform. The monitoring platform selects the appropriate monitoring script according to the requirements of the monitoring task and sends it to the server to be monitored.

[0068] Specifically, the monitoring platform sends a first-layer monitoring script to the monitored server. The first-layer monitoring script is any monitoring script pre-configured in the monitoring platform. The monitoring script in the monitoring platform is divided into two layers of calling branches, including a first-layer calling branch and a second-layer calling branch. The first-layer calling branch is used to initialize the monitoring task, and the second-layer calling branch is used to execute the specific monitoring logic of the server. In this embodiment, the first-layer monitoring script is a script for initializing the monitoring task, which is used for information interaction between the server to be tested and the monitoring platform. The first-layer monitoring script is used to call the second-layer monitoring script, and the second-layer monitoring script is used to respond to the call of the first-layer monitoring script and execute the actual monitoring task of the server to be monitored.

[0069] Step 102, using the first layer monitoring script to call the second layer monitoring script; wherein the second layer monitoring script is used to execute the monitoring task.

[0070] In an embodiment of the present invention, the monitoring platform controls the monitoring script to enter the first-layer calling branch, and uses the first-layer monitoring script to call the second-layer monitoring script. The second-layer monitoring script is used to execute monitoring tasks. The monitoring tasks of the server usually include multiple aspects to ensure the normal operation and performance optimization of the server, such as system resource monitoring, process monitoring, log monitoring, performance monitoring and security monitoring, etc., which are specifically used to monitor CPU usage, memory usage, running status of key processes, process resource usage, system log files, application log files, server response time, throughput, etc. This embodiment does not specifically limit the monitoring tasks. The monitoring tasks on the server are all executed by the second-layer monitoring script called by the first-layer monitoring script.

[0071] Specifically, the monitoring platform initiates a second-layer call branch within the first-layer call branch, and uses the first-layer monitoring script to call the second-layer monitoring script. The second-layer monitoring script adds internal parameters to the monitoring script to ensure that the monitoring script is used to execute the second-layer call logic, wherein the internal parameters are call parameters pre-defined by the monitoring platform, and are used to distinguish between the monitoring script used for the first-layer call branch and the monitoring script used for the second-layer call branch, that is, the second-layer monitoring script carries call parameters, and the first-layer monitoring script does not carry call parameters.

[0072] Step 103, using the first layer monitoring script to obtain the task execution status returned by the second layer monitoring script; wherein the task execution status includes at least one of task execution success, task execution timeout, and task execution failure.

[0073] In an embodiment of the present invention, the second-layer monitoring script executes the monitoring logic of the second-layer calling branch, executes the monitoring task of the server, and uses the first-layer monitoring script to obtain the task execution status returned by the second-layer monitoring script. The task execution status includes at least one of successful task execution, task execution timeout, and task execution failure. The second-layer monitoring script in the second-layer calling branch runs the business-related monitoring logic and collects business monitoring data. The monitoring task execution process may succeed, fail, or time out. If the second-layer monitoring script successfully executes the monitoring task and collects the monitoring data of the server, the task execution is successful. If the second-layer monitoring script fails to complete the monitoring task due to execution timeout, the task execution times out. If the second-layer monitoring script fails to complete the monitoring task due to its own script abnormality, the task execution fails. Regardless of whether the second-layer monitoring script task execution is successful, the task execution times out, or the task execution fails, the first-layer monitoring script can obtain the script execution status of the second-layer monitoring script.

[0074] Step 104, using the first-level monitoring script to determine the monitoring results corresponding to the task execution status, and transmitting the monitoring results back to the monitoring platform.

[0075] In an embodiment of the present invention, the first-layer monitoring script can obtain the script execution status of the second-layer monitoring script. The monitoring platform uses the first-layer monitoring script to determine the monitoring results corresponding to the task execution status, and uses the first-layer monitoring script to transmit the monitoring results back to the monitoring platform. Even if the monitoring script fails to execute or times out, since the first-layer monitoring script is used to report the execution status of the monitoring task, the first-layer monitoring script can generate data to be transmitted back to the monitoring platform based on the task execution status of the second-layer monitoring script, thereby ensuring that the monitoring platform obtains the reported monitoring data.

[0076] Specifically, the first-layer monitoring script is used to determine the monitoring results corresponding to the task execution status. The monitoring results include the second-layer monitoring script itself and the situation of the second-layer monitoring script executing the monitoring task. After the first-layer monitoring script exits the second-layer monitoring script call branch, it generates a script return code, thereby returning the script return code and monitoring results to the monitoring platform.

[0077] The server monitoring method provided by the embodiment of the present invention is as follows: the monitoring platform sends a first-layer monitoring script to the monitored server, and uses the first-layer monitoring script to call the second-layer monitoring script, the second-layer monitoring script is used to execute the monitoring task, and the first-layer monitoring script is used to obtain the task execution status returned by the second-layer monitoring script, the task execution status includes at least one of successful task execution, task execution timeout and task execution failure, and the first-layer monitoring script is used to determine the monitoring result corresponding to the task execution status, and the monitoring result is transmitted back to the monitoring platform. The embodiment of the present invention divides the monitoring script into a nested structure of a first-layer monitoring script for monitoring the process and a second-layer monitoring script for executing the monitoring task, so that no matter whether the monitoring task is executed successfully, times out or fails, the monitoring platform can receive the monitoring status and monitoring data returned by the monitoring script, ensuring that both normal monitoring and abnormal monitoring data of the script itself can be reported in time, thereby ensuring the integrity of the monitoring data, facilitating timely processing by the monitoring platform, and realizing effective monitoring of the server.

[0078] Further, see Figure 2 , showing Figure 1 A flowchart of step 101 in a server monitoring method is provided. The method is substantially the same as the server monitoring method provided in the first embodiment of the present invention. Step 101 may include:

[0079] Step 1011, in response to the call request of the monitored server, determining a monitoring script; the monitoring script includes a first-layer monitoring script and a second-layer monitoring script;

[0080] Step 1012: determine a first-layer monitoring script from the monitoring scripts, and send the first-layer monitoring script to the monitored server.

[0081] It should be noted that, in an embodiment of the present invention, the monitoring platform determines a monitoring script in response to a call request from the monitored server. The monitoring script includes a first-layer monitoring script and a second-layer monitoring script, which are respectively used to initialize the monitoring process and execute the monitoring task. The first-layer monitoring script is determined from the monitoring script, and the first-layer monitoring script is sent to the monitored server to ensure that the monitored server can execute the initialization monitoring process.

[0082] Specifically, the monitored server initiates a call request to the monitoring platform, or the monitoring platform determines that the server needs to be monitored based on the running status of the monitored server. The monitoring platform then determines the monitoring script used to perform the monitoring, and directly calls the monitoring script without internal parameters as the first-level monitoring script. The first-level monitoring script is sent to the monitored server, and enters the first-level call branch.

[0083] In the embodiment of the present invention, the monitoring script is divided into a nested structure of a first-layer monitoring script for monitoring the process and a second-layer monitoring script for executing the monitoring task, and the monitoring script is called again inside the monitoring script.

[0084] Further, see Figure 3 , showing Figure 1 A flowchart of step 103 in a server monitoring method is provided. The method is substantially the same as the server monitoring method provided in the first embodiment of the present invention. Step 102 may include:

[0085] Step 1021, adding a preset timeout instruction to the monitoring script to obtain a second-layer monitoring script; the preset timeout instruction is used to control the second-layer monitoring script to perform the monitoring task within a preset time period;

[0086] Step 1022: Use the first layer monitoring script to initiate a call to the second layer monitoring script, and execute the second layer monitoring script.

[0087] It should be noted that, in the embodiment of the present invention, a preset timeout instruction is added to the monitoring script to obtain a second-layer monitoring script, and the preset timeout instruction is used to control the second-layer monitoring script to execute the monitoring task within the preset duration, ensuring that the monitoring task can be completed within the specified time. By adding a preset timeout instruction to instruct the second-layer monitoring script to complete the monitoring task within the specified time, resource occupation and monitoring delay caused by long-term execution are avoided. Through timeout control, the execution efficiency of the monitoring task is improved to ensure that the monitoring task can be completed in time. The first-layer monitoring script is used to initiate the call of the second-layer monitoring script, so as to execute the second-layer monitoring script, ensuring that the second-layer monitoring script can execute specific monitoring logic and collect business monitoring data.

[0088] It should be noted that when initiating the call of the second-layer monitoring script in the first-layer monitoring script, the second-layer monitoring script is attached with a timeout command, namely, the timeout command. The timeout command is used to control the second-layer monitoring script to end within a specified time. The specified timeout time refers to the time limit set by the timeout command. The time limit is less than the timeout time required by the monitoring platform to ensure that the first-layer script execution does not time out. By setting a timeout time less than the timeout time required by the monitoring platform, it is ensured that the first-layer script can be completed within the timeout time required by the monitoring platform, avoiding the timeout of the first-layer script due to the long execution time of the second-layer script, and improving the reliability and stability of the monitoring task.

[0089] In this embodiment, when the second-layer monitoring script is called, the second-layer monitoring script adds a calling parameter, namely an internal parameter. The internal parameter is used to identify that the monitoring script executes the second-layer calling branch logic. By adding the internal parameter, different calling branches are distinguished to ensure that the monitoring script executes the correct calling logic.

[0090] The embodiment of the present invention initiates the call of the second-layer monitoring script through the first-layer monitoring script, thereby ensuring that the monitoring task can be executed in layers. By executing the second-layer monitoring script, it is ensured that the monitoring task can execute specific monitoring logic, thereby realizing timeout control and hierarchical calling of the monitoring task, improving the execution efficiency of the monitoring task, and ensuring effective monitoring data reporting.

[0091] Further, see Figure 4 , showing Figure 1 A flowchart of step 103 in a server monitoring method is provided. The method is substantially the same as the server monitoring method provided in the first embodiment of the present invention. Step 103 may include:

[0092] Step 1031, using the second-layer monitoring script to perform the monitoring task on the server within a preset time, determine the task execution status, and send a return code corresponding to the task execution status to the first-layer monitoring script;

[0093] Step 1032, using the first layer monitoring script to receive a return code from the second layer monitoring script;

[0094] Step 1033: Use the first-layer monitoring script to obtain the task execution status of the second-layer monitoring script according to the return code.

[0095] It should be noted that, in the embodiment of the present invention, a second-layer monitoring script is used to perform monitoring tasks on the server within a preset time period, determine the task execution status, and send a return code corresponding to the task execution status to the first-layer monitoring script. The monitoring task is executed by the second-layer monitoring script to ensure that the monitoring task can be carried out within the specified time, and the second-layer monitoring script feeds back the task execution status through the return code to ensure that the first-layer monitoring script can understand the task execution results in a timely manner. The first-layer monitoring script is used to receive the return code of the second-layer monitoring script. The return code is used to identify the task execution status, and is divided into a non-0 code indicating success and a 0 code indicating failure. The task execution status includes at least one of successful task execution, task execution timeout, and task execution failure. In this embodiment, the return code of the second-layer monitoring script includes a non-0 code for successful task execution, and a 0 code for task execution timeout and task execution failure.

[0096] In this embodiment, the first-layer monitoring script can learn about the execution status of the monitoring task through the return code, and the first-layer monitoring script is used to obtain the task execution status of the second-layer monitoring script according to the return code. According to the return code, the first-layer monitoring script can determine whether the task execution is successful and take corresponding processing measures. The specific acquisition of monitoring data corresponding to the task execution status will not be repeated here.

[0097] The embodiment of the present invention determines the task execution status through the return code of the second-layer monitoring script, ensuring that the first-layer monitoring script can accurately understand the task execution result. The first-layer monitoring script can flexibly handle different results, ensuring the traceability of the monitoring data.

[0098] Further, see Figure 5 , showing Figure 1 A flowchart of step 104 in a server monitoring method is provided. The method is substantially the same as the server monitoring method provided in the first embodiment of the present invention. Step 104 may include:

[0099] Step 1041, using the first layer monitoring script to detect that the second layer monitoring script has finished executing, and generating a unified script return code;

[0100] Step 1042, using the first layer monitoring script to obtain monitoring data corresponding to the task execution status, and determining the monitoring data as monitoring results to be transmitted back to the monitoring platform;

[0101] Step 1043: Use the first-layer monitoring script to transmit the monitoring result and the script return code back to the monitoring platform.

[0102] It should be noted that, in the embodiment of the present invention, the first-layer monitoring script is used to detect the completion of the execution of the second-layer monitoring script, and a unified script return code, i.e., code 0, is generated to ensure that the monitoring platform can receive the information reported by the monitoring script. The script return code is used to identify the execution result of the entire monitoring task. Specifically, the first-layer monitoring script is used to obtain the monitoring data corresponding to the task execution status, and the monitoring data is determined as the monitoring result to be transmitted back to the monitoring platform. The first-layer monitoring script is used to transmit the monitoring result and the script return code back to the monitoring platform to ensure the integrity and accuracy of the monitoring data.

[0103] In the embodiment of the present invention, regardless of whether the second-layer monitoring script successfully executes the monitoring task, the first-layer monitoring script can obtain the monitoring data corresponding to the execution status of different tasks, ensure the validity of the monitoring data, and determine the monitoring data as the monitoring results to be transmitted back to the monitoring platform, ensuring that the monitoring data can be reported in a timely manner, facilitating subsequent monitoring data analysis and processing.

[0104] Specifically, step 1042 uses the first-layer monitoring script to obtain monitoring data corresponding to the task execution status, and determines the monitoring data as the monitoring result to be transmitted back to the monitoring platform, which may specifically include the following steps:

[0105] If the task execution status is successful, the first layer monitoring script is used to obtain the task monitoring data of the second layer monitoring script, and the task monitoring data is determined as the first monitoring result to be transmitted back to the monitoring platform;

[0106] If the task execution status is task execution timeout or task execution failure, the first layer monitoring script is used to generate abnormal monitoring data of the second layer monitoring script, and the abnormal monitoring data is determined as the second monitoring result to be transmitted back to the monitoring platform.

[0107] It should be noted that in the above steps, if the task execution status is successful, the first-layer monitoring script is used to obtain the task monitoring data of the second-layer monitoring script, and the task monitoring data is determined as the first monitoring result to be transmitted back to the monitoring platform. That is, when the second-layer monitoring script successfully executes the monitoring task, the task monitoring data is determined as the first monitoring result to be transmitted back to the monitoring platform, ensuring that the monitoring data can be reported in time. If the task execution status is a task execution timeout or task execution failure, the first-layer monitoring script is used to generate the abnormal monitoring data of the second-layer monitoring script, and the abnormal monitoring data is determined as the second monitoring result to be transmitted back to the monitoring platform, that is, when the second-layer monitoring script fails to execute the monitoring task, by generating abnormal monitoring data, it is ensured that in the case of a timeout or failure of the monitoring task, the abnormal situation can be reported in time, and the monitoring platform can be informed of the abnormal situation and handle it in time.

[0108] Reference Figure 6 , shows a schematic diagram of the structure of a server monitoring device provided by an embodiment of the present invention, which is applied to a monitoring platform, the monitoring platform communicates with a monitored server, and the device includes:

[0109] The script sending module 201 is used to send the first layer monitoring script to the monitored server;

[0110] A script calling module 202, configured to use the first layer monitoring script to call a second layer monitoring script; wherein the second layer monitoring script is used to execute a monitoring task;

[0111] The monitoring execution module 203 is used to use the first layer monitoring script to obtain the task execution status returned by the second layer monitoring script; wherein the task execution status includes at least one of task execution success, task execution timeout and task execution failure;

[0112] The result determination module 204 is used to determine the monitoring result corresponding to the task execution status using the first-layer monitoring script, and transmit the monitoring result back to the monitoring platform.

[0113] Furthermore, the script issuing module 201 includes:

[0114] A first determining submodule is used to determine a monitoring script in response to a call request of the monitored server; the monitoring script includes a first-layer monitoring script and a second-layer monitoring script;

[0115] The sending submodule is used to determine the first-layer monitoring script from the monitoring scripts and send the first-layer monitoring script to the monitored server.

[0116] Furthermore, the script calling module 202 includes:

[0117] A processing submodule, used for adding a preset timeout instruction to the monitoring script to obtain a second-layer monitoring script; the preset timeout instruction is used to control the second-layer monitoring script to perform the monitoring task within a preset time period;

[0118] The calling submodule is used to use the first-layer monitoring script to initiate the call of the second-layer monitoring script and execute the second-layer monitoring script.

[0119] Furthermore, the monitoring execution module 203 includes:

[0120] A second determination submodule is used to use the second-layer monitoring script to perform a monitoring task on the server within a preset time period, determine the task execution status, and send a return code corresponding to the task execution status to the first-layer monitoring script;

[0121] A receiving submodule, configured to receive a return code of the second layer monitoring script using the first layer monitoring script;

[0122] The acquisition submodule is used to use the first-layer monitoring script to obtain the task execution status of the second-layer monitoring script according to the return code.

[0123] Furthermore, the determination result module 204 includes:

[0124] A generating submodule, used to detect the end of execution of the second layer monitoring script by using the first layer monitoring script, and generate a unified script return code;

[0125] A third determination submodule is used to obtain monitoring data corresponding to the task execution status using the first layer monitoring script, and determine the monitoring data as monitoring results to be transmitted back to the monitoring platform;

[0126] The feedback submodule is used to use the first layer monitoring script to transmit the monitoring result and the script return code back to the monitoring platform.

[0127] Furthermore, the third determining submodule includes:

[0128] A first result unit is used for, if the task execution status is successful, using the first layer monitoring script to obtain the task monitoring data of the second layer monitoring script, and determining the task monitoring data as a first monitoring result to be transmitted back to the monitoring platform;

[0129] The second result unit is used to use the first-layer monitoring script to generate abnormal monitoring data of the second-layer monitoring script if the task execution status is task execution timeout or task execution failure, and determine the abnormal monitoring data as the second monitoring result to be sent back to the monitoring platform.

[0130] The server monitoring device provided by the embodiment of the present invention, the monitoring platform sends a first-layer monitoring script to the monitored server, uses the first-layer monitoring script to call the second-layer monitoring script, the second-layer monitoring script is used to execute the monitoring task, uses the first-layer monitoring script to obtain the task execution status returned by the second-layer monitoring script, the task execution status includes at least one of successful task execution, task execution timeout and task execution failure, uses the first-layer monitoring script to determine the monitoring result corresponding to the task execution status, and transmits the monitoring result back to the monitoring platform. The embodiment of the present invention divides the monitoring script into a nested structure of a first-layer monitoring script for monitoring the process and a second-layer monitoring script for executing the monitoring task, so that no matter whether the monitoring task is executed successfully, times out or fails, the monitoring platform can receive the monitoring status and monitoring data returned by the monitoring script, ensuring that both normal monitoring and abnormal monitoring data of the script itself can be reported in time, ensuring the integrity of the monitoring data, facilitating timely processing by the monitoring platform, and realizing effective monitoring of the server.

[0131] Reference Figure 7 , an embodiment of the present invention further provides an electronic device, such as Figure 7 As shown, it includes a processor 301, a communication interface 302, a memory 303 and a communication bus 304, wherein the processor 301, the communication interface 302, and the memory 303 communicate with each other through the communication bus 304.

[0132] A processor 301, a memory 303 for storing processor executable instructions;

[0133] The processor 301 is configured to execute the instructions to implement the server monitoring method as described below:

[0134] Sending a first-layer monitoring script to the monitored server;

[0135] Using the first layer monitoring script to call the second layer monitoring script; wherein the second layer monitoring script is used to perform monitoring tasks;

[0136] The first-layer monitoring script is used to obtain the task execution status returned by the second-layer monitoring script; wherein the task execution status includes at least one of task execution success, task execution timeout, and task execution failure;

[0137] The first layer monitoring script is used to determine the monitoring result corresponding to the task execution status, and the monitoring result is transmitted back to the monitoring platform.

[0138] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0139] The communication interface is used for communication between the above terminal and other devices.

[0140] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0141] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0142] In another embodiment of the present invention, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the server monitoring method described in any of the above embodiments is implemented.

[0143] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0144] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0145] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0146] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A server monitoring method, characterized in that: Applied to a monitoring platform, the monitoring platform communicates with a monitored server, the method comprising: Sending a first-layer monitoring script to the monitored server; Using the first layer monitoring script to call the second layer monitoring script; wherein the second layer monitoring script is used to perform monitoring tasks; The first-layer monitoring script is used to obtain the task execution status returned by the second-layer monitoring script; wherein the task execution status includes at least one of task execution success, task execution timeout, and task execution failure; The first layer monitoring script is used to determine the monitoring result corresponding to the task execution status, and the monitoring result is transmitted back to the monitoring platform.

2. The method according to claim 1, characterized in that: The sending of the first layer monitoring script to the monitored server includes: In response to the call request of the monitored server, a monitoring script is determined; the monitoring script includes a first-layer monitoring script and a second-layer monitoring script; A first-layer monitoring script is determined from the monitoring scripts, and the first-layer monitoring script is sent to the monitored server.

3. The method according to claim 1, characterized in that The using the first layer monitoring script to call the second layer monitoring script includes: Adding a preset timeout instruction to the monitoring script to obtain a second-layer monitoring script; the preset timeout instruction is used to control the second-layer monitoring script to perform the monitoring task within a preset time period; The first-layer monitoring script is used to initiate a call to the second-layer monitoring script, and the second-layer monitoring script is executed.

4. The method according to claim 1, characterized in that: The using the first layer monitoring script to obtain the task execution status returned by the second layer monitoring script includes: The second-layer monitoring script is used to perform a monitoring task on the server within a preset time period, determine the task execution status, and send a return code corresponding to the task execution status to the first-layer monitoring script; Using the first layer monitoring script to receive the return code of the second layer monitoring script; The first-layer monitoring script is used to obtain the task execution status of the second-layer monitoring script according to the return code.

5. The method according to claim 1, characterized in that The using the first-layer monitoring script to determine the monitoring result corresponding to the task execution status, and transmitting the monitoring result back to the monitoring platform, includes: The first-layer monitoring script is used to detect that the second-layer monitoring script has finished executing, and a unified script return code is generated; The first layer monitoring script is used to obtain monitoring data corresponding to the task execution status, and the monitoring data is determined as the monitoring result to be transmitted back to the monitoring platform; The first layer monitoring script is used to transmit the monitoring result and the script return code back to the monitoring platform.

6. The method according to claim 5, characterized in that The using the first-layer monitoring script to obtain monitoring data corresponding to the task execution status, and determining the monitoring data as monitoring results to be transmitted back to the monitoring platform, includes: If the task execution status is successful, the first layer monitoring script is used to obtain the task monitoring data of the second layer monitoring script, and the task monitoring data is determined as the first monitoring result to be transmitted back to the monitoring platform; If the task execution status is task execution timeout or task execution failure, the first layer monitoring script is used to generate abnormal monitoring data of the second layer monitoring script, and the abnormal monitoring data is determined as the second monitoring result to be transmitted back to the monitoring platform.

7. A server monitoring device, characterized in that: Applied to a monitoring platform, the monitoring platform communicates with a monitored server, the device comprises: A script sending module, used for sending the first layer monitoring script to the monitored server; A script calling module, used to call a second-layer monitoring script using the first-layer monitoring script; wherein the second-layer monitoring script is used to execute a monitoring task; A monitoring execution module, used to use the first layer monitoring script to obtain the task execution status returned by the second layer monitoring script; wherein the task execution status includes at least one of task execution success, task execution timeout and task execution failure; The result determination module is used to use the first-layer monitoring script to determine the monitoring result corresponding to the task execution status, and transmit the monitoring result back to the monitoring platform.

8. The device according to claim 7, characterized in that The script issuing module includes: A first determining submodule is used to determine a monitoring script in response to a call request of the monitored server; the monitoring script includes a first-layer monitoring script and a second-layer monitoring script; The sending submodule is used to determine the first-layer monitoring script from the monitoring scripts and send the first-layer monitoring script to the monitored server.

9. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the instructions to implement the server monitoring method according to any one of claims 1 to 6.

10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the server monitoring method according to any one of claims 1 to 6 is implemented.