CN111400153A - A method, device and computer-readable storage medium for starting serial port log - Google Patents
A method, device and computer-readable storage medium for starting serial port log Download PDFInfo
- Publication number
- CN111400153A CN111400153A CN202010172440.0A CN202010172440A CN111400153A CN 111400153 A CN111400153 A CN 111400153A CN 202010172440 A CN202010172440 A CN 202010172440A CN 111400153 A CN111400153 A CN 111400153A
- Authority
- CN
- China
- Prior art keywords
- self
- power
- server
- test
- preset
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Withdrawn
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3466—Performance evaluation by tracing or monitoring
- G06F11/3476—Data logging
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/14—Error detection or correction of the data by redundancy in operation
- G06F11/1402—Saving, restoring, recovering or retrying
- G06F11/1415—Saving, restoring, recovering or retrying at system level
- G06F11/1438—Restarting or rejuvenating
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Debugging And Monitoring (AREA)
Abstract
本发明实施例公开了一种串口日志的启动方法、装置和介质,当服务器未在预设启动时间内完成上电自检时,则说明本次上电自检过程存在异常,此时可以重启服务器,并记录重启次数。当预设时间段内服务器的重启次数大于或等于预设阈值时,则说明服务器连续多次重启依然存在上电自检异常,此时可以开启上电自检的日志记录模式,记录服务器上电自检过程的串口日志。该技术方案中,上电自检正常运行时,上电自检的日志记录模式并未开启,服务器按照常规的上电自检过程执行即可,不会花费太长的时间。只有在判定出服务器的上电自检过程出现异常时,才开启上电自检的日志记录模式,以记录上电自检过程的串口日志,从而实现上电自检的故障检测。
The embodiment of the present invention discloses a method, device and medium for starting a serial port log. When the server fails to complete the power-on self-test within a preset start-up time, it means that the current power-on self-test process is abnormal, and the server can be restarted at this time. server, and record the number of restarts. When the number of restarts of the server within the preset time period is greater than or equal to the preset threshold, it means that the server restarts several times in a row and still has a power-on self-test abnormality. At this time, the power-on self-test logging mode can be enabled to record the power-on of the server. Serial log of the self-check process. In this technical solution, when the power-on self-test is running normally, the log recording mode of the power-on self-test is not enabled, and the server can execute the power-on self-test process according to the conventional power-on self-test process, which does not take too long. Only when it is determined that the power-on self-test process of the server is abnormal, the log record mode of power-on self-test is enabled to record the serial port log of the power-on self-test process, so as to realize the fault detection of power-on self-test.
Description
技术领域technical field
本发明涉及服务器技术领域,特别是涉及一种串口日志的启动方法、装置和计算机可读存储介质。The present invention relates to the technical field of servers, and in particular, to a method, a device and a computer-readable storage medium for starting a serial port log.
背景技术Background technique
随着大数据、云计算、人工智能时代的到来,互联网业务量和数据量出现猛烈增长,服务器的运载压力越来越大,这就对于整个系统的链路稳定性的要求越来越高。服务器在上电开机及运行过程中的健康状态都需要被实时监控,在启动和运行过程中,对于轻微的错误而言,通过校验机制可以纠正过来,对服务器运行的影响较小,如果遇到严重故障时,可能会造成系统宕机,由此所引发的后果则是客户的业务中断,数据丢失,造成的损失不可预估。With the advent of the era of big data, cloud computing, and artificial intelligence, the volume of Internet business and data has increased dramatically, and the load on the server has increased, which requires higher and higher link stability of the entire system. The health status of the server needs to be monitored in real time during the power-on and running process. During the startup and running process, for minor errors, the verification mechanism can be used to correct them, which has little impact on the server operation. In the event of a serious failure, it may cause system downtime, which will result in business interruption for customers, data loss, and unpredictable losses.
服务器的运行分为两大阶段,分别是上电自检(Power On Self Test,POST)阶段和系统运行阶段,两个阶段是紧密衔接的。其中POST阶段,服务器开机上电之后,基本输入输出系统(Basic Input Output System,BIOS)会对服务器的硬件进行检测及初始化,这个过程中BIOS起主导作用,当BIOS自检完成之后就会开始寻找并引导系统,此时BIOS会把控制权转交给系统,BIOS的作用就只有中断处理等一些基本的用途。The operation of the server is divided into two stages, namely the Power On Self Test (POST) stage and the system operation stage, and the two stages are closely linked. In the POST stage, after the server is powered on, the Basic Input Output System (BIOS) will detect and initialize the hardware of the server. In this process, the BIOS plays a leading role. After the BIOS self-check is completed, it will start searching for And boot the system, then the BIOS will transfer control to the system, the role of the BIOS only interrupt processing and other basic purposes.
控制权转交给系统之后,服务器出现的一些故障会记录在系统日志和基板控制器(Baseboard Management Controller,BMC)日志中,我们可以分析系统日志和BMC日志进行问题的定位分析。但是,在POST过程中由于BIOS记录并传递给BMC的日志非常少,并且和BIOS本身代码相关的问题没有地方可以记录故障日志,如果在POST过程中出现宕机等严重故障,就没有办法进行故障的分析定位。After the control right is transferred to the system, some faults of the server will be recorded in the system log and the baseboard management controller (BMC) log. We can analyze the system log and the BMC log to locate and analyze the problem. However, during the POST process, there are very few logs recorded by the BIOS and transmitted to the BMC, and there is no place to record the fault log for problems related to the BIOS itself. If there is a serious fault such as downtime during the POST process, there is no way to troubleshoot analytical positioning.
分析此类问题最有效的方式是把BIOS在POST过程中串口日志导出分析,这就需要开启BIOS的debug模式,此模式默认是关闭的。如果要打开,则需要重新开发BIOS版本并刷新到故障服务器上,这样会导致故障现象的消失。The most effective way to analyze such problems is to export and analyze the serial port log of the BIOS during the POST process, which requires enabling the debug mode of the BIOS, which is disabled by default. If you want to open, you need to redevelop the BIOS version and flash to the faulty server, which will cause the disappearance of the fault phenomenon.
可见,如何实现上电自检的故障检测,是本领域技术人员需要解决的问题。It can be seen that how to realize the fault detection of the power-on self-check is a problem to be solved by those skilled in the art.
发明内容SUMMARY OF THE INVENTION
本发明实施例的目的是提供一种串口日志的启动方法、装置和计算机可读存储介质,可以实现上电自检的故障检测。The purpose of the embodiments of the present invention is to provide a method, device and computer-readable storage medium for starting a serial port log, which can realize fault detection of power-on self-check.
为解决上述技术问题,本发明实施例提供一种串口日志的启动方法,包括:To solve the above technical problems, an embodiment of the present invention provides a method for starting a serial port log, including:
当服务器未在预设启动时间内完成上电自检时,则重启所述服务器,并记录重启次数;When the server does not complete the power-on self-test within the preset startup time, restart the server, and record the number of restarts;
判断在预设时间段内所述服务器的重启次数是否大于或等于预设阈值;Determine whether the number of restarts of the server within a preset time period is greater than or equal to a preset threshold;
若是,则开启上电自检的日志记录模式。If so, enable the logging mode for POST.
可选地,所述当服务器未在预设启动时间内完成上电自检时,则重启所述服务器,并记录重启次数包括:Optionally, when the server does not complete the power-on self-check within the preset startup time, restarting the server, and recording the number of restarts includes:
当服务器启动时,判断所述服务器是否在预设启动时间内完成上电自检;When the server starts, determine whether the server completes the power-on self-check within the preset startup time;
若否,则重启所述服务器,并触发预先设置的看门狗程序,利用所述看门狗程序检测所述服务器是否在预设启动时间内完成上电自检;If not, restart the server, trigger a preset watchdog program, and use the watchdog program to detect whether the server completes the power-on self-check within the preset startup time;
相应的,判断在预设时间段内所述服务器的重启次数是否大于或等于预设阈值包括:Correspondingly, judging whether the number of restarts of the server within the preset time period is greater than or equal to the preset threshold includes:
判断在预设时间段内所述看门狗程序被触发的次数是否大于或等于预设阈值。Determine whether the number of times the watchdog program is triggered within a preset time period is greater than or equal to a preset threshold.
可选地,在所述开启上电自检的日志记录模式之后还包括:Optionally, after the logging mode of the power-on self-test is enabled, the method further includes:
判断在第二预设时间段内所述看门狗程序是否被触发;Determine whether the watchdog program is triggered within the second preset time period;
若否,则关闭所述上电自检的日志记录模式。If not, the logging mode of the POST is turned off.
可选地,在所述开启上电自检的日志记录模式之后还包括:Optionally, after the logging mode of the power-on self-test is enabled, the method further includes:
当所述服务器重启并完成上电自检时,判断当前重启时间与上一次服务器重启时间的时间间隔是否大于或等于预设的时间限值;When the server restarts and completes the power-on self-check, determine whether the time interval between the current restart time and the last server restart time is greater than or equal to a preset time limit;
若是,则关闭所述上电自检的日志记录模式。If so, turn off the logging mode of the power-on self-test.
可选地,在所述开启上电自检的日志记录模式之后还包括:Optionally, after the logging mode of the power-on self-test is enabled, the method further includes:
当所述服务器连续两次上电自检未出现异常时,则关闭所述上电自检的日志记录模式。When no abnormality occurs in the power-on self-test of the server for two consecutive times, the log recording mode of the power-on self-test is turned off.
可选地,所述开启上电自检的日志记录模式包括:Optionally, the logging mode for enabling the power-on self-check includes:
将预先设置的上电自检日志记录程序的标志位调整为有效标志位,以便于服务器在上电自检时开启日志记录;Adjust the preset flag bit of the power-on self-check logging program to a valid flag bit, so that the server can enable logging during power-on self-check;
相应的,所述关闭所述上电自检的日志记录模式包括:Correspondingly, the disabling of the logging mode of the power-on self-test includes:
将预先设置的上电自检日志记录程序的标志位调整为无效标志位,以便于服务器在上电自检时日志记录模式处于关闭状态。Adjust the pre-configured POST log recorder flag to an invalid flag so that the logging mode is disabled when the server is POST.
本发明实施例还提供了一种串口日志的启动装置,包括记录单元、判断单元和开启单元;The embodiment of the present invention also provides a device for starting a serial port log, including a recording unit, a judging unit and an opening unit;
所述记录单元,用于当服务器未在预设启动时间内完成上电自检时,则重启所述服务器,并记录重启次数;The recording unit is configured to restart the server when the server does not complete the power-on self-check within the preset startup time, and record the number of restarts;
所述判断单元,用于判断在预设时间段内所述服务器的重启次数是否大于或等于预设阈值;若是,则触发所述开启单元;The judging unit is configured to judge whether the number of restarts of the server within a preset time period is greater than or equal to a preset threshold; if so, trigger the opening unit;
所述开启单元,用于开启上电自检的日志记录模式。The enabling unit is used for enabling the logging mode of the power-on self-test.
可选地,所述记录单元具体用于当服务器启动时,判断所述服务器是否在预设启动时间内完成上电自检;若否,则重启所述服务器,并触发预先设置的看门狗程序,利用所述看门狗程序检测所述服务器是否在预设启动时间内完成上电自检;Optionally, the recording unit is specifically configured to judge whether the server has completed the power-on self-check within a preset startup time when the server is started; if not, restart the server and trigger a preset watchdog. a program, using the watchdog program to detect whether the server completes the power-on self-test within a preset startup time;
相应的,所述判断单元具体用于判断在预设时间段内所述看门狗程序被触发的次数是否大于或等于预设阈值。Correspondingly, the judging unit is specifically configured to judge whether the number of times the watchdog program is triggered within a preset time period is greater than or equal to a preset threshold.
可选地,还包括第二判断单元和关闭单元;Optionally, it also includes a second judgment unit and a closing unit;
所述第二判断单元,用于在所述开启上电自检的日志记录模式之后,判断在第二预设时间段内所述看门狗程序是否被触发;若否,则触发所述关闭单元;The second judging unit is configured to judge whether the watchdog program is triggered within a second preset time period after the log recording mode of the power-on self-check is turned on; if not, trigger the shutdown unit;
所述关闭单元,用于关闭所述上电自检的日志记录模式。The shutdown unit is configured to disable the logging mode of the power-on self-test.
可选地,还包括第三判断单元和关闭单元;Optionally, also includes a third judging unit and a closing unit;
所述第三判断单元,用于在所述开启上电自检的日志记录模式之后,当所述服务器重启并完成上电自检时,判断当前重启时间与上一次服务器重启时间的时间间隔是否大于或等于预设的时间限值;若是,则触发所述关闭单元;The third judgment unit is configured to judge whether the time interval between the current restart time and the last server restart time is when the server restarts and completes the power-on self-test after the log recording mode of the power-on self-test is turned on. greater than or equal to a preset time limit; if so, trigger the shutdown unit;
所述关闭单元,用于关闭所述上电自检的日志记录模式。The shutdown unit is configured to disable the logging mode of the power-on self-test.
可选地,还包括关闭单元;Optionally, it also includes a closing unit;
所述关闭单元,用于在所述开启上电自检的日志记录模式之后,当所述服务器连续两次上电自检未出现异常时,则关闭所述上电自检的日志记录模式。The shutdown unit is configured to disable the log recording mode of the power-on self-test when no abnormality occurs in the server two consecutive power-on self-tests after the log-recording mode of the power-on self-test is turned on.
可选地,所述开启单元具体用于将预先设置的上电自检日志记录程序的标志位调整为有效标志位,以便于服务器在上电自检时开启日志记录;Optionally, the enabling unit is specifically configured to adjust the preset flag bit of the power-on self-check logging program to a valid flag bit, so that the server can start the log record during the power-on self-check;
所述关闭单元具体用于将预先设置的上电自检日志记录程序的标志位调整为无效标志位,以便于服务器在上电自检时日志记录模式处于关闭状态。The closing unit is specifically configured to adjust the preset flag bit of the power-on self-check logging program to an invalid flag bit, so that the log recording mode of the server is in a closed state during the power-on self-check.
本发明实施例还提供了一种串口日志的启动装置,包括:The embodiment of the present invention also provides a device for starting a serial port log, including:
存储器,用于存储计算机程序;memory for storing computer programs;
处理器,用于执行所述计算机程序以实现如上述任意一项所述串口日志的启动方法的步骤。The processor is configured to execute the computer program to implement the steps of the serial port log startup method according to any one of the above.
本发明实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如上述任一项所述串口日志的启动方法的步骤。An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the method for starting a serial port log according to any one of the above is implemented A step of.
由上述技术方案可以看出,当服务器未在预设启动时间内完成上电自检时,则说明本次上电自检过程存在异常,此时可以重启服务器,并记录重启次数。每重启一次服务器,则重启次数加1,判断在预设时间段内服务器的重启次数是否大于或等于预设阈值。在预设时间段内服务器的重启次数大于或等于预设阈值时,则说明服务器连续多次重启依然存在上电自检异常,此时可以开启上电自检的日志记录模式,记录服务器重启后上电自检过程的串口日志。该技术方案中,上电自检正常运行时,上电自检的日志记录模式并未开启,服务器按照常规的上电自检过程执行即可,不会花费太长的时间。只有在判定出服务器的上电自检过程出现异常时,才开启上电自检的日志记录模式,以记录上电自检过程的串口日志,从而实现上电自检的故障检测。It can be seen from the above technical solutions that when the server does not complete the power-on self-test within the preset startup time, it means that the current power-on self-test process is abnormal, and the server can be restarted at this time, and the number of restarts can be recorded. Each time the server is restarted, the number of restarts is incremented by 1, and it is determined whether the number of restarts of the server within the preset time period is greater than or equal to the preset threshold. When the number of restarts of the server within the preset time period is greater than or equal to the preset threshold, it means that the server restarts several times in a row and the power-on self-test is still abnormal. Serial log of the POST process. In this technical solution, when the power-on self-test is running normally, the log recording mode of the power-on self-test is not enabled, and the server can execute the power-on self-test process according to the conventional power-on self-test process, which does not take too long. Only when it is determined that the power-on self-test process of the server is abnormal, the log record mode of power-on self-test is enabled to record the serial port log of the power-on self-test process, so as to realize the fault detection of power-on self-test.
附图说明Description of drawings
为了更清楚地说明本发明实施例,下面将对实施例中所需要使用的附图做简单的介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to explain the embodiments of the present invention more clearly, the following will briefly introduce the accompanying drawings that need to be used in the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention, which are not relevant to ordinary skills in the art. As far as personnel are concerned, other drawings can also be obtained from these drawings on the premise of no creative work.
图1为本发明实施例提供的一种串口日志的启动方法的流程图;1 is a flowchart of a method for starting a serial port log provided by an embodiment of the present invention;
图2为本发明实施例提供的一种串口日志的启动装置的结构示意图;2 is a schematic structural diagram of a device for starting a serial port log provided by an embodiment of the present invention;
图3为本发明实施例提供的一种串口日志的启动装置的硬件结构示意图。FIG. 3 is a schematic diagram of a hardware structure of an apparatus for starting a serial port log according to an embodiment of the present invention.
具体实施方式Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下,所获得的所有其他实施例,都属于本发明保护范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present invention.
为了使本技术领域的人员更好地理解本发明方案,下面结合附图和具体实施方式对本发明作进一步的详细说明。In order to make those skilled in the art better understand the solution of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
接下来,详细介绍本发明实施例所提供的一种串口日志的启动方法。图1为本发明实施例提供的一种串口日志的启动方法的流程图,该方法包括:Next, a method for starting a serial port log provided by an embodiment of the present invention is described in detail. 1 is a flowchart of a method for starting a serial port log provided by an embodiment of the present invention, and the method includes:
S101:当服务器未在预设启动时间内完成上电自检时,则重启服务器,并记录重启次数。S101: When the server does not complete the power-on self-check within the preset startup time, restart the server and record the number of restarts.
预设启动时间可以根据服务器正常运行时上电自检所需要的时间设置。例如,预设启动时间可以设置为6分钟。当服务器正常运行时上电自检过程一般在6分钟之内可以完成。The preset startup time can be set according to the time required for the power-on self-check when the server is running normally. For example, the preset start time can be set to 6 minutes. When the server is running normally, the power-on self-test process can generally be completed within 6 minutes.
当服务器开启后,未在预设启动时间内完成上电自检时,则说明本次上电自检出现了异常。After the server is turned on, if the power-on self-test is not completed within the preset startup time, it means that the power-on self-test is abnormal.
上电自检的异常可能是短暂异常,也可能是故障异常。对于短暂异常,重启服务器可以解决该问题,服务器重启后进入上电自检阶段,可以在预设启动时间内完成上电自检。The abnormality of the power-on self-test may be a short-term abnormality or a fault abnormality. For short-term exceptions, restarting the server can solve the problem. After the server restarts, it enters the power-on self-test phase, and the power-on self-test can be completed within the preset startup time.
对于故障异常,重启服务器往往无法解决该问题,服务器重启后进入上电自检阶段,当服务器仍旧无法在预设启动时间内完成上电自检,此时会再次重启服务器。每重启一次服务器,服务器对应的重启次数加1。For abnormal faults, restarting the server often cannot solve the problem. After the server restarts, it enters the power-on self-check stage. If the server still cannot complete the power-on self-check within the preset startup time, the server will be restarted again. Each time the server is restarted, the number of restarts corresponding to the server is incremented by 1.
S102:判断在预设时间段内服务器的重启次数是否大于或等于预设阈值。S102: Determine whether the number of restarts of the server within a preset time period is greater than or equal to a preset threshold.
服务器只执行一次重启,便可以在预设启动时间内完成上电自检时,则说明上一次上电自检失败是由服务器的短暂异常造成,此时并不需要对上电自检过程进行串口日志的记录。因此,在本发明实施例中,预设阈值的取值一定大于1。例如,可以将预设阈值设置为2。If the server can complete the power-on self-test within the preset startup time after only one restart, it means that the last power-on self-test failure was caused by a short-term abnormality of the server, and the power-on self-test process does not need to be performed at this time. Serial log record. Therefore, in this embodiment of the present invention, the value of the preset threshold must be greater than 1. For example, the preset threshold can be set to 2.
预设时间段可以综合服务器正常运行时上电自检所花费的时间以及预设阈值进行设定,例如,预设时间段可以设置为30分钟。The preset time period can be set based on the time taken for the power-on self-check when the server is running normally and the preset threshold. For example, the preset time period can be set to 30 minutes.
通过设置预设阈值对重启次数进行判断,可以降低服务器短暂异常对上电自检造成的影响。By setting a preset threshold to determine the number of restarts, you can reduce the impact of the server's short-term abnormality on the power-on self-check.
在预设时间段内服务器的重启次数大于或等于预设阈值时,则说明上电自检属于故障异常,此时可以执行S103。在预设时间段内服务器的重启次数小于预设阈值时,则说明服务器可以顺利完成上电自检,此时可以结束操作,服务器进入系统运行阶段。When the number of restarts of the server within the preset time period is greater than or equal to the preset threshold, it indicates that the power-on self-check is abnormal, and at this time, S103 can be executed. When the number of restarts of the server within the preset time period is less than the preset threshold, it means that the server can successfully complete the power-on self-check, and the operation can be ended at this time, and the server enters the system operation stage.
以预设阈值为2,预设时间段为30分钟为例,当服务器第一次重启时,重启次数为1,如果在第一次重启后服务器依旧无法在预设启动时间内完成上电自检,则会第二次重启服务器,此时重启次数为2。第二次重启服务器时,重启次数达到了预设阈值,如果第一次重启服务器和第二次重启服务器的时间间隔小于30分钟,则说明服务器在短时间内执行了连续多次的重启,此时可以执行S103。Taking the preset threshold value of 2 and the preset time period of 30 minutes as an example, when the server restarts for the first time, the number of restarts is 1. If checked, the server will be restarted for the second time, and the number of restarts will be 2. When the server is restarted for the second time, the number of restarts reaches the preset threshold. If the time interval between the first restart of the server and the second restart of the server is less than 30 minutes, it means that the server has restarted several times in a short time. can execute S103.
S103:开启上电自检的日志记录模式。S103: Enable the log recording mode of the power-on self-test.
在本发明实施例中,可以预先设置上电自检日志记录程序,当日志记录模式开启后,上电自检日志记录程序开始运行,从而记录服务器在上电自检过程的串口日志。In this embodiment of the present invention, a power-on self-test log recording program may be preset, and when the log recording mode is enabled, the power-on self-test log record program starts to run, thereby recording the serial port log of the server during the power-on self-test process.
在具体实现中,可以通过设置标志位的方式启动日志记录模式。标志位可以分为有效标志位和无效标志位,例如,可以用数字1代表有效标志位,数字0代表无效标志位。In a specific implementation, the logging mode can be started by setting a flag bit. The flag bits can be divided into valid flag bits and invalid flag bits. For example, the number 1 can be used to represent the valid flag bit, and the number 0 can be used to represent the invalid flag bit.
将上电自检日志记录程序的标志位调整为有效标志位时,服务器在上电自检时会开启日志记录模式,从而记录服务器上电自检过程的串口日志。When the flag bit of the power-on self-test logging program is adjusted to a valid flag bit, the server will enable the logging mode during power-on self-test to record the serial port log of the server's power-on self-test process.
在S101中提及了记录重启次数,其中,记录重启次数的方式可以有多种,一种方式可以采用寄存器进行记录,另一种方式可以设置看门狗程序。看门狗程序可以实现定时检测的功能,启动一次看门狗程序便可以检测服务器重启后是否在预设启动时间内完成上电自检。看门狗程序被启动的次数即为服务器重启次数。Recording the number of restarts is mentioned in S101, wherein, there may be multiple ways to record the number of restarts. One way may be to use a register for recording, and another way may be to set a watchdog program. The watchdog program can realize the function of timing detection. After starting the watchdog program once, it can detect whether the power-on self-test is completed within the preset startup time after the server restarts. The number of times the watchdog program is started is the number of server restarts.
在具体实现中,可以在服务器启动时,判断服务器是否在预设启动时间内完成上电自检;当服务器无法在预设启动时间内完成上电自检时,则重启服务器,并触发预先设置的看门狗程序,利用看门狗程序检测服务器是否在预设启动时间内完成上电自检。In the specific implementation, when the server starts, it can be judged whether the server completes the power-on self-test within the preset starting time; when the server cannot complete the power-on self-test within the preset starting time, the server is restarted and the preset setting is triggered. Use the watchdog program to detect whether the server completes the power-on self-test within the preset startup time.
相应的,可以判断在预设时间段内看门狗程序被触发的次数是否大于或等于预设阈值。当预设时间段内看门狗程序被触发的次数大于或等于预设阈值时,则执行S103。Correspondingly, it can be determined whether the number of times the watchdog program is triggered within the preset time period is greater than or equal to the preset threshold. When the number of times the watchdog program is triggered within the preset time period is greater than or equal to the preset threshold, S103 is executed.
通过设置看门狗程序,既可以对服务器在预设启动时间内是否完成上电自检进行检测,也可以将看门狗程序的启动次数作为服务器重启次数,无需花费额外的存储资源记录服务器的重启次数。By setting the watchdog program, you can not only detect whether the server has completed the power-on self-check within the preset startup time, but also use the number of watchdog program startups as the number of server restarts, without spending extra storage resources to record the server's Number of restarts.
由上述技术方案可以看出,当服务器未在预设启动时间内完成上电自检时,则说明本次上电自检过程存在异常,此时可以重启服务器,并记录重启次数。每重启一次服务器,则重启次数加1,判断在预设时间段内服务器的重启次数是否大于或等于预设阈值。在预设时间段内服务器的重启次数大于或等于预设阈值时,则说明服务器连续多次重启依然存在上电自检异常,此时可以开启上电自检的日志记录模式,记录服务器重启后上电自检过程的串口日志。该技术方案中,上电自检正常运行时,上电自检的日志记录模式并未开启,服务器按照常规的上电自检过程执行即可,不会花费太长的时间。只有在判定出服务器的上电自检过程出现异常时,才开启上电自检的日志记录模式,以记录上电自检过程的串口日志,从而实现上电自检的故障检测。It can be seen from the above technical solutions that when the server does not complete the power-on self-test within the preset startup time, it means that the current power-on self-test process is abnormal, and the server can be restarted at this time, and the number of restarts can be recorded. Each time the server is restarted, the number of restarts is incremented by 1, and it is determined whether the number of restarts of the server within the preset time period is greater than or equal to the preset threshold. When the number of restarts of the server within the preset time period is greater than or equal to the preset threshold, it means that the server restarts several times in a row and the power-on self-test is still abnormal. Serial log of the POST process. In this technical solution, when the power-on self-test is running normally, the log recording mode of the power-on self-test is not enabled, and the server can execute the power-on self-test process according to the conventional power-on self-test process, which does not take too long. Only when it is determined that the power-on self-test process of the server is abnormal, the log record mode of power-on self-test is enabled to record the serial port log of the power-on self-test process, so as to realize the fault detection of power-on self-test.
考虑到在实际应用中,通过管理人员的维修,服务器上电自检的异常并不会一直持续。如果一直开启上电自检的日志记录模式,那每次服务器上电启动后执行上电自检都会花费较长的时间。因此,在本发明实施例中,在开启上电自检的日志记录模式之后,可以在确定出服务器上电自检恢复正常工作状态时,关闭上电自检的日志记录模式。Considering that in practical applications, through the maintenance of the administrator, the abnormality of the server power-on self-check will not last forever. If the power-on self-test logging mode is always enabled, it will take a long time to perform the power-on self-test every time the server is powered on and started. Therefore, in this embodiment of the present invention, after the logging mode of the power-on self-test is enabled, the log-recording mode of the power-on self-test may be turned off when it is determined that the server power-on self-test has returned to a normal working state.
关闭上电自检的日志记录模式的触发条件可以有多种。There can be various triggering conditions to turn off the logging mode of POST.
结合上述介绍的看门狗程序,一种可行方式,可以判断在第二预设时间段内看门狗程序是否被触发。In combination with the above-mentioned watchdog program, a feasible way is to determine whether the watchdog program is triggered within the second preset time period.
服务器未在预设启动时间内完成上电自检时,服务器重启时便会触发看门狗程序。When the server does not complete the power-on self-test within the preset startup time, the watchdog program is triggered when the server restarts.
在实际应用中,除了上电自检异常时服务器重启外,由于业务需求服务器也会执行正常的上电重启。In practical applications, in addition to the server restarting when the power-on self-check is abnormal, the server will also perform a normal power-on restart due to business requirements.
在服务器开启上电自检的日志记录模式之后,当服务器上电重启时进行计时,或者是当服务器第一次触发看门狗程序时开始计时,当第二预设时间段内看门狗程序未被触发时,则说明服务器在第二预设时间段内并未出现上电自检异常的情况,此时可以关闭上电自检的日志记录模式。After the server turns on the log recording mode of power-on self-test, the time is started when the server is powered on and restarted, or when the server triggers the watchdog program for the first time, and the watchdog program starts within the second preset time period. If it is not triggered, it means that the server does not have any abnormality in the power-on self-test within the second preset time period, and the log recording mode of the power-on self-test can be turned off at this time.
其中,第二预设时间段的取值大于S102中预设时间段的取值,例如,可以将第二预设时间段设置为60分钟。The value of the second preset time period is greater than the value of the preset time period in S102, for example, the second preset time period may be set to 60 minutes.
在服务器开启上电自检的日志记录模式之后,以服务器第一次触发看门狗程序时开始计时为例,在60分钟内服务器没有再次触发看门狗程序,则说明服务器的上电自检过程已恢复正常,此时可以关闭上电自检的日志记录模式。After the server turns on the logging mode of the power-on self-test, take the time when the server triggers the watchdog program for the first time as an example. If the server does not trigger the watchdog program again within 60 minutes, it means that the power-on self-test of the server starts. The process has returned to normal, and the logging mode of POST can be turned off at this time.
第二种可行的触发条件可以在开启上电自检的日志记录模式之后,当服务器重启并完成上电自检时,判断当前重启时间与上一次服务器重启时间的时间间隔是否大于或等于预设的时间限值。The second possible trigger condition is to determine whether the time interval between the current restart time and the last server restart time is greater than or equal to the preset time when the server restarts and completes the power-on self-test after the logging mode of the power-on self-test is turned on. time limit.
在服务器开启上电自检的日志记录模式之后,如果服务器仍存在上电自检异常的情况,则服务器在短时间内会执行多次重启操作。因此,当前重启时间与上一次服务器重启时间的时间间隔大于或等于预设的时间限值,则说明服务器的重启属于正常业务需求,并非由于上电自检异常引起的服务器重启,服务器的上电自检过程已恢复正常,此时可以关闭上电自检的日志记录模式。After the server enables the power-on self-test logging mode, if the server still fails the power-on self-test, the server will restart multiple times within a short period of time. Therefore, if the time interval between the current restart time and the last server restart time is greater than or equal to the preset time limit, it means that the server restart is a normal business requirement, not a server restart caused by an abnormal power-on self-check. The self-test process has returned to normal, and the logging mode of the power-on self-test can be turned off at this time.
第三种可行的触发条件可以在开启上电自检的日志记录模式之后,当服务器连续两次上电自检未出现异常时,则关闭上电自检的日志记录模式。The third possible trigger condition is that after the logging mode of the power-on self-test is turned on, when the server has no abnormality in the power-on self-test for two consecutive times, the log-recording mode of the power-on self-test is turned off.
需要说明的是,本发明实施例中,服务器连续两次上电自检未出现异常并非是短时间内服务器执行两次上电自检操作,这两次上电自检可以存在时间间隔,连续两次指的是在时间上前后相邻的两次上电自检。It should be noted that, in this embodiment of the present invention, two consecutive power-on self-checks of the server without abnormality do not mean that the server performs two power-on self-check operations in a short period of time. Twice refers to two power-on self-tests that are adjacent in time.
当连续两次上电自检均未出现异常时,则说明服务器上电自检过程已恢复正常,此时可以关闭上电自检的日志记录模式。If there is no abnormality in two consecutive power-on self-tests, it means that the server power-on self-test process has returned to normal. At this time, you can disable the power-on self-test logging mode.
对于上电自检的日志记录模式的关闭,在具体实现中,可以将预先设置的上电自检日志记录程序的标志位调整为无效标志位,以便于服务器在上电自检时日志记录模式处于关闭状态。For the shutdown of the logging mode of the power-on self-test, in the specific implementation, the preset flag bit of the power-on self-test logging program can be adjusted to an invalid flag bit, so as to facilitate the logging mode of the server during the power-on self-test is closed.
在开启上电自检的日志记录模式之后,通过对服务器上电自检的工作状态进行检测,可以在服务器上电自检恢复正常时,及时的关闭上电自检的日志记录模式,降低了日志记录模式长时间开启对上电自检时间造成的影响。After the power-on self-test logging mode is enabled, by detecting the working status of the server power-on self-test, when the server power-on self-test returns to normal, the power-on self-test logging mode can be turned off in time, reducing the power consumption. The impact of the logging mode being enabled for a long time on the power-on self-test time.
图2为本发明实施例提供的一种串口日志的启动装置的结构示意图,包括记录单元21、判断单元22和开启单元23;2 is a schematic structural diagram of a device for starting a serial port log provided by an embodiment of the present invention, including a
记录单元21,用于当服务器未在预设启动时间内完成上电自检时,则重启服务器,并记录重启次数;The
判断单元22,用于判断在预设时间段内服务器的重启次数是否大于或等于预设阈值;若是,则触发开启单元23;The
开启单元23,用于开启上电自检的日志记录模式。The enabling
可选地,记录单元具体用于当服务器启动时,判断服务器是否在预设启动时间内完成上电自检;若否,则重启服务器,并触发预先设置的看门狗程序,利用看门狗程序检测服务器是否在预设启动时间内完成上电自检;Optionally, the recording unit is specifically used to determine whether the server completes the power-on self-test within the preset startup time when the server is started; if not, restart the server, and trigger the preset watchdog program, using the watchdog The program detects whether the server completes the power-on self-test within the preset startup time;
相应的,判断单元具体用于判断在预设时间段内看门狗程序被触发的次数是否大于或等于预设阈值。Correspondingly, the judging unit is specifically configured to judge whether the number of times the watchdog program is triggered within the preset time period is greater than or equal to the preset threshold.
可选地,还包括第二判断单元和关闭单元;Optionally, it also includes a second judgment unit and a closing unit;
第二判断单元,用于在开启上电自检的日志记录模式之后,判断在第二预设时间段内看门狗程序是否被触发;若否,则触发关闭单元;The second judgment unit is used to judge whether the watchdog program is triggered within the second preset time period after the log recording mode of the power-on self-check is turned on; if not, trigger the shutdown unit;
关闭单元,用于关闭上电自检的日志记录模式。Shut down the unit, which is used to turn off the logging mode for POST.
可选地,还包括第三判断单元和关闭单元;Optionally, also includes a third judging unit and a closing unit;
第三判断单元,用于在开启上电自检的日志记录模式之后,当服务器重启并完成上电自检时,判断当前重启时间与上一次服务器重启时间的时间间隔是否大于或等于预设的时间限值;若是,则触发关闭单元;The third judging unit is configured to judge whether the time interval between the current restart time and the last server restart time is greater than or equal to the preset time when the server restarts and completes the power-on self-check after the logging mode of the power-on self-check is turned on. time limit; if so, trigger the shutdown unit;
关闭单元,用于关闭上电自检的日志记录模式。Shut down the unit, which is used to turn off the logging mode for POST.
可选地,还包括关闭单元;Optionally, it also includes a closing unit;
关闭单元,用于在开启上电自检的日志记录模式之后,当服务器连续两次上电自检未出现异常时,则关闭上电自检的日志记录模式。The shutdown unit is used to disable the log recording mode of the power-on self-test when the server has no abnormality in two consecutive power-on self-tests after the log-recording mode of the power-on self-test is turned on.
可选地,开启单元具体用于将预先设置的上电自检日志记录程序的标志位调整为有效标志位,以便于服务器在上电自检时开启日志记录;Optionally, the opening unit is specifically configured to adjust the pre-set flag bit of the power-on self-check logging program to a valid flag bit, so that the server can open the log record during the power-on self-check;
关闭单元具体用于将预先设置的上电自检日志记录程序的标志位调整为无效标志位,以便于服务器在上电自检时日志记录模式处于关闭状态。The shutdown unit is specifically used to adjust the preset flag bit of the power-on self-test logging program to an invalid flag bit, so that the log record mode of the server is turned off during the power-on self-test.
图2所对应实施例中特征的说明可以参见图1所对应实施例的相关说明,这里不再一一赘述。For the description of the features in the embodiment corresponding to FIG. 2 , reference may be made to the relevant description of the embodiment corresponding to FIG. 1 , which will not be repeated here.
由上述技术方案可以看出,当服务器未在预设启动时间内完成上电自检时,则说明本次上电自检过程存在异常,此时可以重启服务器,并记录重启次数。每重启一次服务器,则重启次数加1,判断在预设时间段内服务器的重启次数是否大于或等于预设阈值。在预设时间段内服务器的重启次数大于或等于预设阈值时,则说明服务器连续多次重启依然存在上电自检异常,此时可以开启上电自检的日志记录模式,记录服务器重启后上电自检过程的串口日志。该技术方案中,上电自检正常运行时,上电自检的日志记录模式并未开启,服务器按照常规的上电自检过程执行即可,不会花费太长的时间。只有在判定出服务器的上电自检过程出现异常时,才开启上电自检的日志记录模式,以记录上电自检过程的串口日志,从而实现上电自检的故障检测。It can be seen from the above technical solutions that when the server does not complete the power-on self-test within the preset startup time, it means that the current power-on self-test process is abnormal, and the server can be restarted at this time, and the number of restarts can be recorded. Each time the server is restarted, the number of restarts is incremented by 1, and it is determined whether the number of restarts of the server within the preset time period is greater than or equal to the preset threshold. When the number of restarts of the server within the preset time period is greater than or equal to the preset threshold, it means that the server restarts several times in a row and the power-on self-test is still abnormal. Serial log of the POST process. In this technical solution, when the power-on self-test is running normally, the log recording mode of the power-on self-test is not enabled, and the server can execute the power-on self-test process according to the conventional power-on self-test process, which does not take too long. Only when it is determined that the power-on self-test process of the server is abnormal, the log record mode of power-on self-test is enabled to record the serial port log of the power-on self-test process, so as to realize the fault detection of power-on self-test.
图3为本发明实施例提供的一种串口日志的启动装置30的硬件结构示意图,包括:3 is a schematic diagram of the hardware structure of a serial port
存储器31,用于存储计算机程序;
处理器32,用于执行所述计算机程序以实现如上述任意实施例所述的串口日志的启动方法的步骤。The
本发明实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如上述任一实施例所述的串口日志的启动方法的步骤。Embodiments of the present invention further provide a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the serial port log described in any of the foregoing embodiments can be implemented. Steps to start the method.
以上对本发明实施例所提供的一种串口日志的启动方法、装置和计算机可读存储介质进行了详细介绍。说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以对本发明进行若干改进和修饰,这些改进和修饰也落入本发明权利要求的保护范围内。The method, the device, and the computer-readable storage medium for starting a serial port log provided by the embodiments of the present invention have been described in detail above. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the various embodiments can be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant part can be referred to the description of the method. It should be pointed out that for those skilled in the art, without departing from the principle of the present invention, several improvements and modifications can also be made to the present invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Professionals may further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two, in order to clearly illustrate the possibilities of hardware and software. Interchangeability, the above description has generally described the components and steps of each example in terms of functionality. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of the present invention.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of a method or algorithm described in conjunction with the embodiments disclosed herein may be directly implemented in hardware, a software module executed by a processor, or a combination of the two. A software module can be placed in random access memory (RAM), internal memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other in the technical field. in any other known form of storage medium.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010172440.0A CN111400153A (en) | 2020-03-12 | 2020-03-12 | A method, device and computer-readable storage medium for starting serial port log |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010172440.0A CN111400153A (en) | 2020-03-12 | 2020-03-12 | A method, device and computer-readable storage medium for starting serial port log |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111400153A true CN111400153A (en) | 2020-07-10 |
Family
ID=71432382
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010172440.0A Withdrawn CN111400153A (en) | 2020-03-12 | 2020-03-12 | A method, device and computer-readable storage medium for starting serial port log |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111400153A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111856248A (en) * | 2020-07-22 | 2020-10-30 | 中国第一汽车股份有限公司 | Electronic throttle valve driving circuit diagnosis method and system and readable storage medium |
WO2022111048A1 (en) * | 2020-11-30 | 2022-06-02 | 苏州浪潮智能科技有限公司 | Power supply control method and apparatus, and server and non-volatile storage medium |
-
2020
- 2020-03-12 CN CN202010172440.0A patent/CN111400153A/en not_active Withdrawn
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111856248A (en) * | 2020-07-22 | 2020-10-30 | 中国第一汽车股份有限公司 | Electronic throttle valve driving circuit diagnosis method and system and readable storage medium |
WO2022111048A1 (en) * | 2020-11-30 | 2022-06-02 | 苏州浪潮智能科技有限公司 | Power supply control method and apparatus, and server and non-volatile storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2022160756A1 (en) | Server fault positioning method, apparatus and system, and computer-readable storage medium | |
WO2022198972A1 (en) | Method, system and apparatus for fault positioning in starting process of server | |
US20100211824A1 (en) | Systems and methods for memory retention across resets | |
CN105718340A (en) | Crontab-based CPU stability test method | |
WO2022037014A1 (en) | Boot restoration method for arm server, and related apparatus | |
TWI779682B (en) | Computer system, computer server and method of starting the same | |
WO2024109236A1 (en) | Metadata check method and system, and computer device and non-volatile readable storage medium | |
CN111400153A (en) | A method, device and computer-readable storage medium for starting serial port log | |
CN113608603A (en) | Method, system, equipment and storage medium for repairing PCIe fault equipment | |
CN114816022B (en) | Method, system and storage medium for monitoring server power supply abnormality | |
CN114116330B (en) | Server performance testing method, system, terminal and storage medium | |
CN115098291A (en) | Method, system, storage medium and equipment for recording system restart reason | |
CN112463508B (en) | Server dormancy state testing method, system, terminal and storage medium | |
CN110187922A (en) | It is arranged and verifies the method, apparatus, equipment and storage medium of BIOS parameter | |
CN109960638A (en) | BMC startup reason recording method, system, device and readable storage medium | |
CN112486785B (en) | Method, system, terminal and storage medium for positioning downtime phase of server | |
WO2024260013A1 (en) | Memory failure processing method and apparatus, and computer device and storage medium | |
WO2024244436A1 (en) | Program starting method and apparatus, and server and non-volatile readable storage medium | |
JPH02294739A (en) | Fault detecting system | |
CN110362430A (en) | A kind of method being restarted automatically, system and the storage medium of server | |
CN117112273A (en) | Fault state management and control method, device, equipment and medium | |
CN117234771A (en) | Faulty memory location method, system, device, computer equipment and storage medium | |
CN100369009C (en) | Monitoring system and method using system management interrupt signal | |
CN116627702A (en) | Method and device for restarting virtual machine in downtime | |
CN114385405A (en) | A method, device and system for realizing server restart reason record |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20200710 |
|
WW01 | Invention patent application withdrawn after publication |