CN115687000A - Method, device, equipment and medium for monitoring service life of hard disk - Google Patents

Method, device, equipment and medium for monitoring service life of hard disk Download PDF

Info

Publication number
CN115687000A
CN115687000A CN202211190640.4A CN202211190640A CN115687000A CN 115687000 A CN115687000 A CN 115687000A CN 202211190640 A CN202211190640 A CN 202211190640A CN 115687000 A CN115687000 A CN 115687000A
Authority
CN
China
Prior art keywords
hard disk
service life
place hard
place
disk
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.)
Pending
Application number
CN202211190640.4A
Other languages
Chinese (zh)
Inventor
王然
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202211190640.4A priority Critical patent/CN115687000A/en
Publication of CN115687000A publication Critical patent/CN115687000A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The application discloses a method, a device, equipment and a medium for monitoring the service life of a hard disk, which relate to the technical field of computers and comprise the following steps: determining an in-place hard disk on a server and an installation mode of the in-place hard disk; the mounting mode includes: the in-place hard disk is inserted in a server mainboard through a hard disk backboard and is hung under a disk array card to form a disk array, the in-place hard disk is inserted in the server mainboard through the hard disk backboard and is not hung under the disk array card to form the disk array, and the in-place hard disk is directly inserted in the server mainboard; determining a service life information acquisition mode of the in-place hard disk based on the installation mode, and acquiring the service life of the in-place hard disk according to the observation period and the service life information acquisition mode based on the in-place hard disk; and when the service life of the in-place hard disk meets the alarm mechanism, giving an alarm based on the alarm mechanism. Therefore, different service life information acquisition modes are adopted for the in-place hard disks in different installation modes, and timeliness of monitoring the service life of the hard disks is guaranteed.

Description

Method, device, equipment and medium for monitoring service life of hard disk
Technical Field
The invention relates to the technical field of computers, in particular to a method, a device, equipment and a medium for monitoring the service life of a hard disk.
Background
The hard disk is an important component for the operation of the server, and a large number of hard disks are configured in the storage type server to form a disk array. The mainstream hard disk in the market has limited read-write times, namely service life, due to the manufacturing process and the storage technology. When the lifetime approaches or reaches the end, the hard disk may fail and the user may lose important data. On the other hand, when a disk array failure occurs, the server often needs to be shut down or restarted, so as to complete the replacement of the hard disk or the reorganization of the disk array, thereby seriously affecting the normal operation of the user service.
Therefore, how to monitor the service life of each hard disk of the disk array, and read the service life of an onboard hard disk (the hard disk is directly inserted in a server mainboard) and a backplane hard disk (the hard disk is inserted in the server mainboard through a backplane and is not mounted under a disk array card) without a mature interface library, and ensure the timeliness of reading is an urgent problem to be solved in the field.
Disclosure of Invention
In view of this, an object of the present invention is to provide a method, an apparatus, a device, and a medium for monitoring the service life of a hard disk, which can monitor the service life of each hard disk of a disk array, read the service life of an onboard hard disk and a backplane hard disk that do not have a mature interface library, and ensure the timeliness of reading, and the specific scheme is as follows:
in a first aspect, the present application discloses a method for monitoring a service life of a hard disk, including:
determining all in-place hard disks on a server and installation modes of all in-place hard disks; wherein, the mounting means includes: the in-place hard disk is inserted in a server mainboard through a hard disk backboard and is hung under a disk array card to form a disk array, the in-place hard disk is inserted in the server mainboard through the hard disk backboard and is not hung under the disk array card to form the disk array, and the in-place hard disk is directly inserted in the server mainboard;
determining a service life information acquisition mode of the in-place hard disks based on the installation mode of the in-place hard disks, and acquiring the service life of each in-place hard disk according to an observation period and the service life information acquisition mode based on the in-place hard disks;
and when the service life of the in-place hard disk meets a preset alarm mechanism, alarming based on the preset alarm mechanism.
Optionally, the obtaining the service life of each in-place hard disk according to the observation period and based on the service life information of the in-place hard disk includes:
acquiring the service life of each in-place hard disk according to an original observation period and a service life information acquisition mode based on the in-place hard disks;
when the preset accumulated observation duration is met, calculating the life average consumption rate of the in-place hard disk, and determining a new observation period according to the life average consumption rate of the in-place hard disk and a preset period setting rule;
and acquiring the service life of each in-place hard disk according to the new observation period and the service life information acquisition mode based on the in-place hard disks.
Optionally, the determining, based on the installation manner of the in-place hard disks, a service life information obtaining manner of the in-place hard disks, and obtaining the service life of each in-place hard disk according to the observation period and the service life information obtaining manner based on the in-place hard disks includes:
when the in-place hard disk is installed in a mode that the in-place hard disk is inserted into a server mainboard through a hard disk backboard and is hung under a disk array card to form a disk array, the serial number of the disk array card where the in-place hard disk is located and the serial number of the in-place hard disk are obtained by reading the corresponding disk array card;
and sending an information reading command to the corresponding in-place hard disk according to the observation period and the serial number of the disk array card where the in-place hard disk is located and the serial number of the in-place hard disk so as to obtain the service life of the in-place hard disk.
Optionally, the determining, based on the installation manner of the in-place hard disks, a service life information obtaining manner of the in-place hard disks, and obtaining the service life of each in-place hard disk according to the observation period and the service life information obtaining manner based on the in-place hard disks includes:
when the in-place hard disk is installed in a mode that the in-place hard disk is inserted into a server mainboard through a hard disk backboard and is not mounted under the disk array card to form a disk array, scanning each slot on the hard disk backboard through an I2C link to obtain a slot serial number of the in-place hard disk and a serial number of the in-place hard disk;
and sending an information reading command to the corresponding in-place hard disk according to the observation period and the serial number of the slot where the in-place hard disk is located and the serial number of the in-place hard disk so as to obtain the service life of the in-place hard disk.
Optionally, the determining, based on the installation manner of the in-place hard disks, a service life information obtaining manner of the in-place hard disks, and obtaining the service life of each in-place hard disk according to the observation period and the service life information obtaining manner based on the in-place hard disks includes:
and when the in-place hard disk is installed in a manner that the in-place hard disk is directly inserted in the server mainboard, sending an information reading command to the in-place hard disk through an I2C link according to an observation period so as to obtain the service life of the in-place hard disk.
Optionally, before the alarming based on the preset alarm mechanism when the service life of the in-place hard disk meets the preset alarm mechanism, the method further includes:
determining different alarm levels based on different service life conditions of the in-place hard disk, and setting different alarm modes for the different alarm levels to obtain the alarm mechanism; wherein the alarm levels include low level alarms and high level alarms.
Optionally, when the service life of the in-place hard disk meets a preset alarm mechanism, the alarming based on the preset alarm mechanism includes:
and when the service life of the in-place hard disk meets the high-level alarm, sending an alarm log, displaying the alarm log on a management interface on the server, and then prompting through a fault indicator lamp of the server.
In a second aspect, the present application discloses a device for monitoring the service life of a hard disk, comprising:
the installation mode determining module is used for determining all in-place hard disks on the server and installation modes of all in-place hard disks; wherein, the mounting means includes: the in-place hard disk is inserted in a server mainboard through a hard disk backboard and is hung under a disk array card to form a disk array, the in-place hard disk is inserted in the server mainboard through the hard disk backboard and is not hung under the disk array card to form the disk array, and the in-place hard disk is directly inserted in the server mainboard;
the service life information acquisition mode module is used for determining the service life information acquisition mode of the in-place hard disks based on the installation mode of the in-place hard disks and acquiring the service life of each in-place hard disk according to an observation period and the service life information acquisition mode based on the in-place hard disks;
and the alarm module is used for giving an alarm based on a preset alarm mechanism when the service life of the in-place hard disk meets the preset alarm mechanism.
In a third aspect, the present application discloses an electronic device, comprising:
a memory for storing a computer program;
and the processor is used for executing the computer program to realize the monitoring method for the service life of the hard disk disclosed in the foregoing.
In a fourth aspect, the present application discloses a computer readable storage medium for storing a computer program; wherein, the computer program realizes the monitoring method of the service life of the hard disk when being executed by the processor.
Therefore, the application provides a method for monitoring the service life of a hard disk, which comprises the following steps: determining all in-place hard disks on a server and installation modes of all in-place hard disks; wherein, the mounting means includes: the in-place hard disk is inserted in a server mainboard through a hard disk backboard and is hung under a disk array card to form a disk array, the in-place hard disk is inserted in the server mainboard through the hard disk backboard and is not hung under the disk array card to form the disk array, and the in-place hard disk is directly inserted in the server mainboard; determining a service life information acquisition mode of the in-place hard disks based on the installation mode of the in-place hard disks, and acquiring the service life of each in-place hard disk according to an observation period and the service life information acquisition mode based on the in-place hard disks; and when the service life of the in-place hard disk meets a preset alarm mechanism, giving an alarm based on the preset alarm mechanism. Therefore, the method and the device can read the service life of the in-place hard disk in different installation modes and give corresponding alarm based on the service life condition. In addition, the processing means based on different installation modes and adopting different service life information acquisition modes ensures timeliness of monitoring the service life of the hard disk.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a flowchart of a method for monitoring the service life of a hard disk according to the present disclosure;
FIG. 2 is a flowchart of a specific hard disk service life monitoring method disclosed in the present application;
FIG. 3 is a schematic structural diagram of a device for monitoring the service life of a hard disk according to the present disclosure;
fig. 4 is a block diagram of an electronic device disclosed in the present application.
Detailed Description
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, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
When the service life approaches or reaches the end, the hard disk may fail and the user may lose important data. On the other hand, when a disk array failure occurs, the server often needs to be shut down or restarted, so as to complete the replacement of the hard disk or the reorganization of the disk array, thereby seriously affecting the normal operation of the user service.
Therefore, the embodiment of the application provides a monitoring scheme for the service life of the hard disk, which can monitor the service life of each hard disk of the disk array, read the service life of an onboard hard disk and a backplane hard disk which do not have a mature interface library, and ensure the reading timeliness.
The embodiment of the application discloses a method for monitoring the service life of a hard disk, which is shown in figure 1 and comprises the following steps:
step S11: determining all in-place hard disks on a server and installation modes of all in-place hard disks; wherein, the mounting means includes: the in-place hard disk is inserted in a server mainboard through a hard disk backboard and is hung under a disk array card to form a disk array, the in-place hard disk is inserted in the server mainboard through the hard disk backboard and is not hung under the disk array card to form the disk array, and the in-place hard disk is directly inserted in the server mainboard.
In this embodiment, all in-place hard disks on the server and the installation modes of all in-place hard disks are determined first.
Step S12: and determining the service life information acquisition mode of the in-place hard disks based on the installation mode of the in-place hard disks, and acquiring the service life of each in-place hard disk according to the observation period and the service life information acquisition mode based on the in-place hard disks.
In this embodiment, a plurality of threads are created, and different service life information acquisition modes are executed by different threads.
In a specific implementation manner, when the in-place hard disk is installed in a manner that the in-place hard disk is inserted into a server motherboard through a hard disk backplane and mounted under a disk array (raid) card to form a disk array, the serial number of the disk array card where the in-place hard disk is located and the serial number of the in-place hard disk are obtained by reading the corresponding disk array card; and according to the observation period, sending an information reading command to the corresponding in-place hard disk through a passhrrough interface provided by the disk array according to the serial number of the disk array card where the in-place hard disk is located and the serial number of the in-place hard disk, and analyzing the read result so as to obtain the service life of the in-place hard disk.
In a second specific implementation manner, when the in-place hard disk is installed in a manner that the in-place hard disk is inserted into a server motherboard through a hard disk backplane and is not mounted under the disk array card to form a disk array, scanning each slot (slot) on the hard disk backplane through an I2C link to obtain a slot serial number where the in-place hard disk is located and a serial number of the in-place hard disk; and according to the observation period, sending an information reading command to the corresponding in-place hard disk through an I2C link according to the serial number of the slot where the in-place hard disk is located and the serial number of the in-place hard disk, and analyzing the read result so as to obtain the service life of the in-place hard disk.
In a third specific embodiment, when the in-place hard disk is installed in a manner that the in-place hard disk is directly inserted into the server motherboard, an information reading command is sent to the in-place hard disk through an I2C link according to an observation period, and a read result is analyzed, so as to obtain the service life of the in-place hard disk.
Step S13: and when the service life of the in-place hard disk meets a preset alarm mechanism, giving an alarm based on the preset alarm mechanism.
In this embodiment, when the service life of the in-place hard disk meets a preset alarm mechanism, before an alarm is performed based on the preset alarm mechanism, different alarm levels need to be determined based on different service life conditions of the in-place hard disk, and different alarm modes are set for the different alarm levels to obtain the alarm mechanism; wherein the alarm levels include a low level alarm (warning) and a high level alarm (critical). In a specific implementation mode, when the service life of the in-place hard disk meets the high-level alarm, an alarm log is sent and displayed on a management interface on the server, simultaneously, a snmp trap information alarm is triggered, the alarm information is kept until the hard disk with the service life reaching the end is replaced, and in addition, the alarm is prompted through a fault indicator lamp of the server.
For different levels of alarms, the example provides an alarm mode which can be set by a user in a self-defined way, particularly, the example supports the situation that the user sets the mail notification alarm, and exemplarily, if the client sets the mail alarm, the system can automatically send a notification mail to the user when the alarm of the corresponding level is triggered. Therefore, a user can transfer, backup and replace the data in a planned way before the service life of the hard disk is finished, the data loss and the loss caused by system downtime due to the read-write fault of the hard disk used for a long time are avoided, the resource waste caused by the regular replacement of a large batch of hard disks still having a long service life is also avoided, the user cost can be greatly saved, and the fault occurrence rate is effectively reduced.
Therefore, the application provides a method for monitoring the service life of a hard disk, which comprises the following steps: determining all in-place hard disks on a server and installation modes of all in-place hard disks; wherein, the mounting means includes: the in-place hard disk is inserted in a server mainboard through a hard disk backboard and is hung under a disk array card to form a disk array, the in-place hard disk is inserted in the server mainboard through the hard disk backboard and is not hung under the disk array card to form the disk array, and the in-place hard disk is directly inserted in the server mainboard; determining a service life information acquisition mode of the in-place hard disks based on the installation mode of the in-place hard disks, and acquiring the service life of each in-place hard disk according to an observation period and the service life information acquisition mode based on the in-place hard disks; and when the service life of the in-place hard disk meets a preset alarm mechanism, giving an alarm based on the preset alarm mechanism. Therefore, the method and the device for acquiring the service life information of the in-place hard disk in the server firstly determine the installation mode of the in-place hard disk in the server, and adopt different service life information acquisition modes for the in-place hard disks in different installation modes, so that the service life of the in-place hard disks in different installation modes can be read, and corresponding alarm is given based on the service life condition. In addition, the processing means based on different installation modes and adopting different service life information acquisition modes ensures timeliness of monitoring the service life of the hard disk.
The embodiment of the application discloses a specific method for monitoring the service life of a hard disk, and compared with the previous embodiment, the embodiment further explains and optimizes the technical scheme. Referring to fig. 2, the method specifically includes:
step S21: determining all in-place hard disks on a server and installation modes of all in-place hard disks; wherein, the mounting means includes: the in-place hard disk is inserted in a server mainboard through a hard disk backboard and is hung under a disk array card to form a disk array, the in-place hard disk is inserted in the server mainboard through the hard disk backboard and is not hung under the disk array card to form the disk array, and the in-place hard disk is directly inserted in the server mainboard.
For a more specific working process of step S21, reference is made to the embodiments disclosed above, and details are not described herein.
Step S22: and determining a service life information acquisition mode of the in-place hard disk based on the installation mode of the in-place hard disk, and acquiring the service life of each in-place hard disk according to the original observation period and the service life information acquisition mode based on the in-place hard disk.
The embodiment guarantees timeliness of hard disk monitoring service life and considers response efficiency of hard disk data reading and writing. On one hand, different software architecture designs and IO (Input/Output) control read/write operations on a hard disk have different effects on the consumption of the hard disk life, in other words, the consumption of the hard disk life is different under different hardware configurations or different service application scenarios. According to the method and the device, timeliness of monitoring the service life of the hard disk under different consumption rates is guaranteed, the monitoring period is prolonged, the read-write load of a hard disk system is reduced, and a dynamic monitoring algorithm is adopted for service life consumption of the hard disk. Specifically, an original observation period base number is set to be a period of one day, and then the service life of each in-place hard disk is obtained according to the original observation period and the service life information obtaining mode based on the in-place hard disks.
Step S23: and when the preset accumulated observation duration is met, calculating the life average consumption rate of the in-place hard disk, and determining a new observation period according to the life average consumption rate of the in-place hard disk and a preset period setting rule.
In this embodiment, the total observation duration is calculated and stored in the flash, the average consumption rate of the hard disk life starts to be calculated after the total observation duration is sufficiently monitored, and a new observation period is determined according to the average consumption rate of the hard disk life and a preset period setting rule. It should be noted that, in a specific embodiment, the period setting rule is: taking the time of one percent unit change of the hard disk life as a base number, and taking a tenth value of the base number as an observation period; in order to ensure that the read-write efficiency of the hard disk is not influenced and the read-write IO load of the hard disk is not increased, the observation period cannot be less than 1 day.
Step S24: and acquiring the service life of each in-place hard disk according to the new observation period and the service life information acquisition mode based on the in-place hard disks.
In this embodiment, after a new observation period is determined, the service life of each in-place hard disk is obtained according to the new observation period and in a service life information obtaining manner based on the in-place hard disks.
In addition, the present embodiment can calculate the average rate change slope value of two consecutive observation periods, specifically, each time a percentage unit change of the hard disk life occurs, the occurrence timestamp is recorded, the average rate of the current observation period is obtained from the current change time and the last change time, and the slope of the hard disk life change rate can be obtained by subtracting the average rate of the last observation period from the average rate of the last observation period.
Step S25: and when the service life of the in-place hard disk meets a preset alarm mechanism, alarming based on the preset alarm mechanism.
For a more specific working process of step S25, reference is made to the embodiments disclosed above, and details are not described herein.
In conclusion, the method and the device can guarantee timeliness of monitoring the service life of the hard disk under different consumption rates, and increase the monitoring period so as to reduce the read-write load of the hard disk system.
Correspondingly, the embodiment of the present application further discloses a device for monitoring the service life of a hard disk, as shown in fig. 3, the device includes:
the installation mode determining module 11 is configured to determine all in-place hard disks on the server and installation modes of all in-place hard disks; wherein, the mounting means includes: the in-place hard disk is inserted in a server mainboard through a hard disk backboard and is hung under a disk array card to form a disk array, the in-place hard disk is inserted in the server mainboard through the hard disk backboard and is not hung under the disk array card to form the disk array, and the in-place hard disk is directly inserted in the server mainboard;
a service life information obtaining mode module 12, configured to determine a service life information obtaining mode of the in-place hard disk based on the installation mode of the in-place hard disk, and obtain the service life of each in-place hard disk according to an observation period and the service life information obtaining mode based on the in-place hard disk;
and the alarm module 13 is configured to alarm based on a preset alarm mechanism when the service life of the in-place hard disk meets the preset alarm mechanism.
For more specific working processes of the modules, reference may be made to corresponding contents disclosed in the foregoing embodiments, and details are not repeated here.
Therefore, the application provides a method for monitoring the service life of a hard disk, which comprises the following steps: determining all in-place hard disks on a server and installation modes of all in-place hard disks; wherein, the mounting means includes: the in-place hard disk is inserted in a server mainboard through a hard disk backboard and is hung under a disk array card to form a disk array, the in-place hard disk is inserted in the server mainboard through the hard disk backboard and is not hung under the disk array card to form the disk array, and the in-place hard disk is directly inserted in the server mainboard; determining a service life information acquisition mode of the in-place hard disks based on the installation mode of the in-place hard disks, and acquiring the service life of each in-place hard disk according to an observation period and the service life information acquisition mode based on the in-place hard disks; and when the service life of the in-place hard disk meets a preset alarm mechanism, alarming based on the preset alarm mechanism. Therefore, the method and the device for acquiring the service life information of the in-place hard disk in the server firstly determine the installation mode of the in-place hard disk in the server, and adopt different service life information acquisition modes for the in-place hard disks in different installation modes, so that the service life of the in-place hard disks in different installation modes can be read, and corresponding alarm is given based on the service life condition. In addition, the processing means based on different installation modes and adopting different service life information acquisition modes ensures timeliness of monitoring the service life of the hard disk.
In some specific embodiments, the service life information obtaining mode module 12 specifically includes:
the service life information acquisition unit is used for acquiring the service life of each in-place hard disk according to the original observation period and the service life information acquisition mode based on the in-place hard disks;
a new observation period determining unit, configured to calculate an average life consumption rate of the in-place hard disk when a preset accumulated observation duration is satisfied, and determine a new observation period according to the average life consumption rate of the in-place hard disk and a preset period setting rule;
and the service life information acquisition unit based on a new observation period is used for acquiring the service life of each in-place hard disk according to the new observation period and the service life information acquisition mode based on the in-place hard disks.
In some specific embodiments, the service life information obtaining means module 12 specifically includes:
the first serial number acquisition unit is used for acquiring the serial number of the disk array card where the in-place hard disk is located and the serial number of the in-place hard disk by reading the corresponding disk array card when the in-place hard disk is installed in a manner that the in-place hard disk is inserted into a server mainboard through a hard disk backboard and is hung under the disk array card to form a disk array;
and the first life information acquisition unit is used for sending an information reading command to the corresponding in-place hard disk according to the observation period, the serial number of the disk array card where the in-place hard disk is located and the serial number of the in-place hard disk so as to acquire the service life of the in-place hard disk.
In some specific embodiments, the service life information obtaining means module 12 specifically includes:
a second serial number obtaining unit, configured to scan each slot on the hard disk backplane through an I2C link to obtain a slot serial number where the in-place hard disk is located and a serial number of the in-place hard disk, when the in-place hard disk is installed in a manner that the in-place hard disk is inserted into a server motherboard through a hard disk backplane and is not mounted under the disk array card to form a disk array;
and the second service life information acquisition unit is used for sending an information reading command to the corresponding in-place hard disk according to the observation period and the serial number of the slot in which the in-place hard disk is positioned and the serial number of the in-place hard disk so as to acquire the service life of the in-place hard disk.
In some specific embodiments, the service life information obtaining means module 12 specifically includes:
and the third life information acquisition unit is used for sending an information reading command to the in-place hard disk through an I2C link according to an observation period when the in-place hard disk is installed in a manner that the in-place hard disk is directly inserted in the server mainboard, so as to acquire the service life of the in-place hard disk.
In some specific embodiments, before the alarm module 13, the method further includes:
the alarm mechanism determining unit is used for determining different alarm levels based on different service life conditions of the in-place hard disk and setting different alarm modes for the different alarm levels to obtain the alarm mechanism; wherein the alarm levels include low level alarms and high level alarms.
In some specific embodiments, the alarm module 13 specifically includes:
and the alarm unit is used for sending an alarm log when the service life of the in-place hard disk meets the high-level alarm, displaying the alarm log on a management interface on the server, and then prompting the alarm log through a fault indicator lamp of the server.
Further, the embodiment of the application also provides electronic equipment. FIG. 4 is a block diagram illustrating an electronic device 20 according to an exemplary embodiment, and the contents of the diagram should not be construed as limiting the scope of use of the present application in any way.
Fig. 4 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present disclosure. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a display 23, an input output interface 24, a communication interface 25, a power supply 26, and a communication bus 27. Wherein the memory 22 is adapted to store a computer program, which is loaded and executed by the processor 21, to implement the steps of:
determining all in-place hard disks on a server and installation modes of all in-place hard disks; wherein, the mounting means includes: the in-place hard disk is inserted in a server mainboard through a hard disk backboard and is hung under a disk array card to form a disk array, the in-place hard disk is inserted in the server mainboard through the hard disk backboard and is not hung under the disk array card to form the disk array, and the in-place hard disk is directly inserted in the server mainboard;
determining a service life information acquisition mode of the in-place hard disks based on the installation mode of the in-place hard disks, and acquiring the service life of each in-place hard disk according to an observation period and the service life information acquisition mode based on the in-place hard disks;
and when the service life of the in-place hard disk meets a preset alarm mechanism, giving an alarm based on the preset alarm mechanism.
In some embodiments, the processor may specifically implement the following steps by executing the computer program stored in the memory:
acquiring the service life of each in-place hard disk according to an original observation period and a service life information acquisition mode based on the in-place hard disks;
when the preset accumulated observation duration is met, calculating the life average consumption rate of the in-place hard disk, and determining a new observation period according to the life average consumption rate of the in-place hard disk and a preset period setting rule;
and acquiring the service life of each in-place hard disk according to the new observation period and the service life information acquisition mode based on the in-place hard disks.
In some embodiments, the processor, by executing the computer program stored in the memory, may specifically implement the following steps:
when the in-place hard disk is installed in a manner that the in-place hard disk is inserted into a server mainboard through a hard disk backboard and is hung under a disk array card to form a disk array, the serial number of the disk array card where the in-place hard disk is located and the serial number of the in-place hard disk are obtained by reading the corresponding disk array card;
and sending an information reading command to the corresponding in-place hard disk according to the observation period and the serial number of the disk array card where the in-place hard disk is located and the serial number of the in-place hard disk so as to obtain the service life of the in-place hard disk.
In some embodiments, the processor, by executing the computer program stored in the memory, may specifically implement the following steps:
when the in-place hard disk is installed in a mode that the in-place hard disk is inserted into a server mainboard through a hard disk backboard and is not mounted under the disk array card to form a disk array, scanning each slot on the hard disk backboard through an I2C link to obtain a slot serial number of the in-place hard disk and a serial number of the in-place hard disk;
and sending an information reading command to the corresponding in-place hard disk according to the observation period and the serial number of the slot where the in-place hard disk is located and the serial number of the in-place hard disk so as to obtain the service life of the in-place hard disk.
In some embodiments, the processor, by executing the computer program stored in the memory, may specifically implement the following steps:
and when the in-place hard disk is installed in a manner that the in-place hard disk is directly inserted in the server mainboard, sending an information reading command to the in-place hard disk through an I2C link according to an observation period so as to obtain the service life of the in-place hard disk.
In some embodiments, the processor, by executing the computer program stored in the memory, further implements the following steps:
determining different alarm levels based on different service life conditions of the in-place hard disk, and setting different alarm modes for the different alarm levels to obtain the alarm mechanism; wherein the alarm levels include low level alarms and high level alarms.
In some embodiments, the processor may specifically implement the following steps by executing the computer program stored in the memory:
and when the service life of the in-place hard disk meets the high-level alarm, sending an alarm log, displaying the alarm log on a management interface on the server, and then prompting through a fault indicator lamp of the server.
In this embodiment, the power supply 26 is configured to provide an operating voltage for each hardware device on the electronic device 20; the communication interface 25 can create a data transmission channel between the electronic device 20 and an external device, and a communication protocol followed by the communication interface is any communication protocol applicable to the technical solution of the present application, and is not specifically limited herein; the input/output interface 24 is configured to obtain external input data or output data to the outside, and a specific interface type thereof may be selected according to specific application requirements, which is not specifically limited herein.
In addition, the storage 22 is used as a carrier for storing resources, and may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the resources stored thereon may include the computer program 221, and the storage manner may be a transient storage manner or a permanent storage manner. The computer program 221 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the method for monitoring the service life of a hard disk executed by the electronic device 20 disclosed in any of the foregoing embodiments.
Further, the embodiment of the application also discloses a computer readable storage medium for storing a computer program; wherein, the computer program realizes the monitoring method of the service life of the hard disk when being executed by the processor.
For the specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, which are not described herein again.
The embodiments in the present application are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other, that is, for the apparatus disclosed in the embodiments, since the apparatus corresponds to the method disclosed in the embodiments, the description is simple, and for the relevant parts, the method is referred to the method part.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or apparatus that comprises the element.
The method, the device, the equipment and the storage medium for monitoring the service life of the hard disk provided by the application are introduced in detail, a specific example is applied in the description to explain the principle and the implementation mode of the application, and the description of the embodiment is only used for helping to understand the method and the core idea of the application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A method for monitoring the service life of a hard disk is characterized by comprising the following steps:
determining all in-place hard disks on a server and installation modes of all in-place hard disks; wherein, the mounting means includes: the in-place hard disk is inserted in a server mainboard through a hard disk backboard and is hung under a disk array card to form a disk array, the in-place hard disk is inserted in the server mainboard through the hard disk backboard and is not hung under the disk array card to form the disk array, and the in-place hard disk is directly inserted in the server mainboard;
determining a service life information acquisition mode of the in-place hard disks based on the installation mode of the in-place hard disks, and acquiring the service life of each in-place hard disk according to an observation period and the service life information acquisition mode based on the in-place hard disks;
and when the service life of the in-place hard disk meets a preset alarm mechanism, giving an alarm based on the preset alarm mechanism.
2. The method for monitoring the service life of the hard disk according to claim 1, wherein the obtaining the service life of each in-place hard disk according to the observation period and based on the service life information of the in-place hard disk comprises:
acquiring the service life of each in-place hard disk according to an original observation period and a service life information acquisition mode based on the in-place hard disks;
when the preset accumulated observation duration is met, calculating the life average consumption rate of the in-place hard disk, and determining a new observation period according to the life average consumption rate of the in-place hard disk and a preset period setting rule;
and acquiring the service life of each in-place hard disk according to the new observation period and the service life information acquisition mode based on the in-place hard disks.
3. The method for monitoring the service life of the hard disk according to claim 1, wherein the determining the service life information obtaining mode of the in-place hard disk based on the installation mode of the in-place hard disk, and obtaining the service life of each in-place hard disk according to the observation period and the service life information obtaining mode based on the in-place hard disk comprises:
when the in-place hard disk is installed in a mode that the in-place hard disk is inserted into a server mainboard through a hard disk backboard and is hung under a disk array card to form a disk array, the serial number of the disk array card where the in-place hard disk is located and the serial number of the in-place hard disk are obtained by reading the corresponding disk array card;
and sending an information reading command to the corresponding in-place hard disk according to the observation period and the serial number of the disk array card where the in-place hard disk is located and the serial number of the in-place hard disk so as to obtain the service life of the in-place hard disk.
4. The method for monitoring the service life of the hard disk according to claim 1, wherein the determining the service life information obtaining mode of the in-place hard disk based on the installation mode of the in-place hard disk, and obtaining the service life of each in-place hard disk according to the observation period and the service life information obtaining mode based on the in-place hard disk comprises:
when the in-place hard disk is installed in a mode that the in-place hard disk is inserted into a server mainboard through a hard disk backboard and is not mounted under the disk array card to form a disk array, scanning each slot on the hard disk backboard through an I2C link to obtain a slot serial number of the in-place hard disk and a serial number of the in-place hard disk;
and sending an information reading command to the corresponding in-place hard disk according to the observation period and the serial number of the slot where the in-place hard disk is located and the serial number of the in-place hard disk so as to obtain the service life of the in-place hard disk.
5. The method for monitoring the service life of the hard disk according to claim 1, wherein the determining the service life information obtaining mode of the in-place hard disk based on the installation mode of the in-place hard disk, and obtaining the service life of each in-place hard disk according to the observation period and the service life information obtaining mode based on the in-place hard disk comprises:
and when the in-place hard disk is installed in a manner that the in-place hard disk is directly inserted in the server mainboard, sending an information reading command to the in-place hard disk through an I2C link according to an observation period so as to obtain the service life of the in-place hard disk.
6. The method for monitoring the service life of a hard disk according to claim 1, wherein before the step of giving an alarm based on a preset alarm mechanism when the service life of the in-place hard disk meets the preset alarm mechanism, the method further comprises:
determining different alarm levels based on different service life conditions of the in-place hard disk, and setting different alarm modes for the different alarm levels to obtain the alarm mechanism; wherein the alarm levels include low level alarms and high level alarms.
7. The method for monitoring the service life of a hard disk according to claim 6, wherein when the service life of the in-place hard disk meets a preset alarm mechanism, an alarm is given based on the preset alarm mechanism, and the method comprises:
and when the service life of the in-place hard disk meets the high-level alarm, sending an alarm log, displaying the alarm log on a management interface on the server, and then prompting through a fault indicator lamp of the server.
8. A monitoring device for service life of a hard disk is characterized by comprising:
the installation mode determining module is used for determining all in-place hard disks on the server and installation modes of all in-place hard disks; wherein, the mounting means includes: the in-place hard disk is inserted in a server mainboard through a hard disk backboard and is hung under a disk array card to form a disk array, the in-place hard disk is inserted in the server mainboard through the hard disk backboard and is not hung under the disk array card to form the disk array, and the in-place hard disk is directly inserted in the server mainboard;
the service life information acquisition mode module is used for determining the service life information acquisition mode of the in-place hard disks based on the installation mode of the in-place hard disks and acquiring the service life of each in-place hard disk according to an observation period and the service life information acquisition mode based on the in-place hard disks;
and the alarm module is used for giving an alarm based on a preset alarm mechanism when the service life of the in-place hard disk meets the preset alarm mechanism.
9. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program to implement the method for monitoring the service life of a hard disk according to any one of claims 1 to 7.
10. A computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements a method of monitoring the service life of a hard disk according to any one of claims 1 to 7.
CN202211190640.4A 2022-09-28 2022-09-28 Method, device, equipment and medium for monitoring service life of hard disk Pending CN115687000A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211190640.4A CN115687000A (en) 2022-09-28 2022-09-28 Method, device, equipment and medium for monitoring service life of hard disk

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211190640.4A CN115687000A (en) 2022-09-28 2022-09-28 Method, device, equipment and medium for monitoring service life of hard disk

Publications (1)

Publication Number Publication Date
CN115687000A true CN115687000A (en) 2023-02-03

Family

ID=85064216

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211190640.4A Pending CN115687000A (en) 2022-09-28 2022-09-28 Method, device, equipment and medium for monitoring service life of hard disk

Country Status (1)

Country Link
CN (1) CN115687000A (en)

Similar Documents

Publication Publication Date Title
US20050091369A1 (en) Method and apparatus for monitoring data storage devices
CN111104342B (en) Method, electronic device and computer program product for storage
US10936386B2 (en) Method, device and computer program product for monitoring access request
US20060031487A1 (en) Apparatuses for generation and collection of information, and computer-readable recording medium
CN111796959B (en) Self-healing method, device and system for host container
CN111104283B (en) Fault detection method, device, equipment and medium of distributed storage system
CN114328102A (en) Equipment state monitoring method, device, equipment and computer readable storage medium
CN116204385A (en) Computer log monitoring method and system
CN110109741B (en) Method and device for managing circular tasks, electronic equipment and storage medium
CN104679623A (en) Server hard disk maintaining method, system and server monitoring equipment
CN112860504A (en) Monitoring method and device, computer storage medium and electronic equipment
CN113590405A (en) Hard disk error detection method and device, storage medium and electronic device
CN110855484B (en) Method, system, electronic device and storage medium for automatically detecting traffic change
CN110347546B (en) Dynamic adjustment method, device, medium and electronic equipment for monitoring task
CN111930719A (en) Database access method, device and system
CN115687000A (en) Method, device, equipment and medium for monitoring service life of hard disk
CN114896128A (en) Application program performance testing method and device based on block chain
JP2012247937A (en) Information processing unit, log storage control program, and log storage control method
CN115687026A (en) Multi-node server fault early warning method, device, equipment and medium
JP2019079120A (en) Information processing device, information processing method and program
US10917203B2 (en) Estimate bit error rates of network cables
CN113835916A (en) Ambari big data platform-based alarm method, system and equipment
CN107783852B (en) Dump file generation method and terminal
CN114327288B (en) Method and device for predicting use time of SSD (solid State disk) residual user, computer equipment and storage medium
CN115129508B (en) Out-of-band processing method, device, equipment and medium for memory correctable errors

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