Disclosure of Invention
The invention aims to provide an online detection method of storage equipment, which does not need to install management monitoring service software with high value, realizes the availability check of each storage node equipment by performing ping communication on the ip of each equipment to be detected in a storage environment, and can greatly reduce the operation and maintenance cost while effectively performing online detection on each equipment; another object of the present invention is to provide an online detection device, an apparatus and a readable storage medium for storage devices, which have the above-mentioned advantages.
In order to solve the above technical problem, the present invention provides an online detection method for a storage device, including:
receiving and recording the ip of the equipment to be detected, and generating the ip information of the equipment to be detected;
sending ping communication packets to each device ip to be detected in the ip information of the device ip to be detected;
receiving ping communication return information; the ping communication return information comprises the normal receiving times of each device to be detected;
and determining the online condition of each equipment to be detected according to the normal receiving times of each equipment to be detected.
Preferably, sending ping communication packets to each device to be detected ip in the device to be detected ip information includes:
and sending a plurality of ping communication packets to each equipment to be detected according to the ip information of the equipment to be detected.
Preferably, sending ping communication packets to each device to be detected ip in the device to be detected ip information includes:
and sending ping communication packets to the ip of each device to be detected in the ip information of the device to be detected at preset intervals.
Preferably, the online detection method for the storage device further comprises:
and outputting online prompt information of the storage equipment according to the online condition of each equipment to be detected.
Preferably, the online detection method for the storage device further comprises:
and outputting and setting the online prompt information according to the online condition of each device to be detected.
The invention discloses an online detection device for storage equipment, which comprises:
the ip receiving and recording unit is used for receiving and recording the ip of the equipment to be detected and generating the ip information of the equipment to be detected;
the ping communication packet sending unit is used for sending ping communication packets to the ip of each device to be detected in the ip information of the device to be detected;
a return information receiving unit for receiving ping communication return information; the ping communication return information comprises the normal receiving times of each device to be detected;
and the online condition determining unit is used for determining the online condition of each equipment to be detected according to the normal receiving times of each equipment to be detected.
Preferably, the ping communication packet sending unit is specifically configured to:
and sending a plurality of ping communication packets to each equipment to be detected according to the ip information of the equipment to be detected.
Preferably, the ping communication packet sending unit is specifically configured to:
and sending ping communication packets to the ip of each device to be detected in the ip information of the device to be detected at preset intervals.
The invention discloses a storage device on-line detection device, which comprises:
a memory for storing a program;
and the processor is used for realizing the steps of the storage device online detection method when executing the program.
The invention discloses a readable storage medium, wherein a program is stored on the readable storage medium, and the program realizes the steps of the storage device online detection method when being executed by a processor.
The storage device online detection method provided by the invention can obtain all the devices to be detected in the storage environment by recording the ip of the devices to be detected in the storage environment, and ping communication is carried out on the ip of the devices to be detected, so that end-to-end communication detection of each storage node device in the storage environment can be completed in one device, availability check of each storage node device is realized, and remote management of the device is completed.
The invention also provides an online detection device, equipment and a readable storage medium for the storage equipment, which have the beneficial effects and are not described again.
Detailed Description
The core of the invention is to provide an online detection method of storage equipment, which does not need to install valuable management monitoring service software, realizes the availability check of each storage node equipment by performing ping communication on the ip of each equipment to be detected in the storage environment, and can greatly reduce the operation and maintenance cost while effectively performing online detection on each equipment; the other core of the invention is to provide a storage device on-line detection device, a device and a readable storage medium.
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, 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 some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating an online detection method for a storage device according to an embodiment of the present invention; the method mainly comprises the following steps:
and step s110, recording the device ip to be detected, and generating the ip information of the device to be detected.
And recording all the to-be-detected devices ip in all the current storage environments in the to-be-detected device ip information to generate the to-be-detected device ip information, wherein the to-be-detected device ip information can be stored in a list or a document and the like, and is not limited herein. The ip information of the equipment to be detected can be updated and edited, when a new storage node is added into the current storage environment or a certain storage node in the current environment is removed, the ip of the equipment to be detected in the ip information of the equipment to be detected can be directly edited (the ip of the equipment is added or deleted), and the overall detection management of the storage environment is facilitated.
And step s120, sending ping communication packets to each device to be detected ip in the device to be detected ip information.
And step s130, receiving ping communication return information.
The ping communication utilizes the uniqueness of the ip address of a machine on a network to send a data packet to a target ip address, then requires the opposite side to return a data packet with the same size to determine whether two devices are connected and communicated, and carries out ping communication on the ip of a device to be detected, the end-to-end communication detection of each storage node device in a storage environment can be completed by one device, the ping communication packet sent to the ip of each device to be detected needs to ensure the normal operation of the current device sending the ping communication packet, if a certain ip communication fails, the returned ping communication packet shows that the communication packet cannot be read normally, and as a sending end is normal, the receiving end is not on line, the availability check of each storage node device can be realized by carrying out ping communication on the ip of each device to be detected, and the remote management of the devices can be completed.
The ping communication return information comprises normal receiving times, namely the times of normal received, and the online condition of the equipment can be determined according to the normal receiving times. If the ping communication packet is sent once and read once normally, the communication is normal; if the ping communication packet is sent once and the reading is normally carried out for zero times, the network signal is abnormal.
Because a certain influence may be generated on a detection result by single ping communication when a network signal is unstable, in order to avoid the influence of interference of other factors on ping communication return information and improve the accuracy of equipment availability detection, preferably, a plurality of ping communication packets can be sent to each equipment to be detected according to ip information of the equipment to be detected. The sending of a plurality of ping communication packets of one device can adopt continuous sending, namely a plurality of ping communication packets are continuously sent to one device and then a plurality of ping communication packets are continuously sent to another device; and the ping communication packets can be sent circularly, namely after one ping communication packet is sent to one device, the ping communication packet is continuously sent to the other device, after all the devices go through one cycle, the ping communication packets are sent to the devices to be detected in the ip information of the devices to be detected one by one again until the preset number of ping communication packets are sent to each device to be detected, and then the process is terminated.
When each storage device is subjected to ping communication for a plurality of times, the corresponding device online condition determining mode can also be subjected to adaptive adjustment, and the determining rule is not limited specifically. For example, when 5 ping connections are made to each storage device, it may be determined that the storage device is normal when the 5 ping connections are successful; if the failure occurs for 5 times, the storage device can be determined to be offline; if the normal times are between 0 and 5 times, the connection can be determined to be unstable; further, it is also possible to provide: when the connection is successful for 3 times or more, the storage device is normally online, and when the connection is successful for 3 times or less, the storage device is abnormal, and the like.
Various parameters can also be added for the ping communication to be used in a matched manner, so that the performance of each parameter of the receiving end can be tested, which can be referred to in the prior art specifically and is not described herein again.
And step s140, determining the online condition of each device to be detected according to the normal receiving times of each device to be detected.
The above description is about the process of performing single online detection on the storage device, and for performing real-time continuous detection on each operating state of each storage device, it is preferable that a ping communication packet is sent to each device to be detected ip in the information of the device to be detected ip at preset intervals, so as to continuously monitor each storage device in the storage environment, so as to timely process the abnormal storage device.
Based on the introduction, the storage device online detection method disclosed in the embodiment of the present invention can obtain all devices to be detected in a storage environment by recording ip of the devices to be detected in the storage environment, and perform ping communication on the ip of the devices to be detected, so that end-to-end communication detection of each storage node device in the storage environment can be completed in one device, availability check of each storage node device is realized, and remote management of the device is completed.
Based on the above embodiment, after the online status of each device in the storage environment is obtained, to output the prompt information for the detected online status of the current storage device, so that the user can timely know the current device status and perform corresponding processing, preferably, after the online status of each device to be detected is determined, the online prompt information of the storage device can be output according to the online status of each device to be detected.
Different detection results are generated according to different conditions of the storage device, including situations such as normal communication, no connection, and unstable signals. Different detection results correspond to different processing modes, for example, when the storage device cannot be connected, a worker needs to immediately overhaul the device so as to avoid processing a normal service request.
In order to facilitate a user to obtain key information when checking the prompt information, the online prompt information can be output and set according to the online condition of each device to be checked. For example, when the communication is normal, a normal white word is set; when the device cannot be connected, the setting is red characters, etc., and only the font color setting is described here, and other setting modes including setting font size, format, jitter, etc. are not described herein again.
In order to deepen understanding of the data storage method provided by the invention, the whole online detection process is described by taking the case of circularly sending 5 times of ping communication packets to each device when the device operates in the Shell environment, and other implementation modes of the storage device online detection method provided by the invention can refer to the description of the embodiment.
Shell is a program written in C language, which is a bridge for users to use Linux. Shell is both a command language and a programming language. Many user operations and instructions in the Linux system can be implemented in an auxiliary way through shell scripts. The Shell script is simple and easy to write, has strong maintainability and is suitable for being used in a plurality of user scenes. The shell can be used for remotely controlling and managing the equipment, log information can be acquired, monitoring and management of the information can be completed, and whether the equipment is on line in real time or not can be checked. Therefore, the embodiment provides a storage device online detection scheme based on shell to monitor whether the storage device is online in real time, perform offline state anomaly analysis and reminding, and meet the purpose of monitoring the state of the storage device by a user.
Txt, and the information of all devices is recorded, the information can be updated and edited, the management is facilitated, the execution of the shell script is not affected, and the format is one line per ip, as follows:
10.180.210.100
10.180.210.150
10.180.210.145
10.180.210.110
10.180.210.113
10.180.210.112
10.180.210.167
10.180.210.119
the monitoring script reads the code according to the line each time, and the reading code is as follows:
for line in`cat ip.txt`
do
checkInternet$line
done
wherein, the checkInternet is a monitoring function, and the details are as follows:
where ping-c 5$1| awk 'NR ═ 9{ print $4}' indicates the number of times that normal received in the ping message can be read.
The monitoring results obtained are as follows:
10.180.210.100network was good
10.180.210.150network was good
The matche with IP 10.180.210.145was NOT in the line,Please check!!!
The matche with IP 10.180.210.110was NOT in the line,Please check!!!
10.180.210.113network was good
The matche with IP 10.180.210.112was NOT in the line,Please check!!!
The matche with IP 10.180.210.167was NOT in the line,Please check!!!
The matche with IP 10.180.210.119was NOT in the line,Please check!!!
10.180.210.100network was good
if the times are consistent with the-c parameter 5, the communication is normal, and the network was good is output, and the color is white on black; if The number of times of reading is 0, it indicates that The device is NOT on-line and cannot be connected, and outputs "The match with ip $1was NOT in The line, plus check! | A | A ", the color is red on black; and if The number of times of reading is between 1 and 4, The communication is available, but The network link signal is unstable, and The "The match with ip $1network waters in base, place check" is also required to be checked and output, and The color is yellow on black.
And reading the ip.txt information by using the test.sh script to monitor whether the equipment is on line or not, monitoring in real time to ensure that the test.sh script needs to run continuously, and constructing a run.sh script to ensure that the test.sh script runs continuously and infinitely circularly so as to achieve the effect of monitoring in real time. Sh script is executed once, then sleep 5 seconds.
This embodiment executes the start script as follows:
[root@localhost test]#chmod 777run.sh
[root@localhost test]#ls
ip.txt run.sh test.sh
[root@localhost test]#sh run.sh
namely, the real-time monitoring shell script is started.
In the embodiment, the ip file record ip.txt of the device to be detected is established in the current storage environment, the instant situation of the storage device is monitored through shell programming, the ip of each device in the ip.txt is subjected to ping communication, whether the device is online is judged according to the result return situation, if a certain ip communication fault occurs, a warning message is sent out immediately to remind a user of checking in time. And the real-time monitoring continuously monitors the storage device by circularly reading the ip information in the ip.txt and continuously circulating even if the offline warning information is detected. The storage device can be monitored whether online or not in real time, and offline state abnormity analysis and reminding can be provided.
Referring to fig. 2, fig. 2 is a block diagram of a storage device online detection apparatus according to an embodiment of the present invention; the method can comprise the following steps: an ip listing unit 210, a ping communication packet transmitting unit 220, a return information receiving unit 230, and an online situation determining unit 240. The storage device online detection device provided by the embodiment can be compared with the storage device online detection method.
The ip receiving and recording unit 210 is mainly used for receiving and recording the ip of the device to be detected and generating the ip information of the device to be detected;
the ping communication packet sending unit 220 is mainly used for sending ping communication packets to each device to be detected ip in the information of the devices to be detected ip;
the return information receiving unit 230 is mainly used for receiving ping communication return information; wherein, the ping communication return information comprises the normal receiving times of each device to be detected;
the online condition determining unit 240 is mainly used for determining the online condition of each device to be detected according to the normal receiving times of each device to be detected.
Preferably, the ping communication packet sending unit may be specifically configured to:
and sending a plurality of ping communication packets to each equipment to be detected according to the ip information of the equipment to be detected.
Preferably, the ping communication packet sending unit may be specifically configured to:
and sending ping communication packets to the ip of each device to be detected in the ip information of the device to be detected at preset intervals.
Preferably, the storage device online detection apparatus may further include a prompting unit, the prompting unit is connected to the online condition determining unit, and the prompting unit is configured to output storage device online prompting information according to online conditions of the devices to be detected.
Preferably, the storage device online detection apparatus may further include an output setting unit, the output setting unit is connected to the prompting unit, and the output setting unit is configured to output and set online prompting information according to an online condition of each device to be detected.
The storage device online detection device provided by this embodiment performs ping communication on the ip of each device to be detected in the storage environment through the ping communication packet sending unit, so as to realize availability check of each storage node device, and greatly reduce operation and maintenance costs while performing effective online detection on each device.
Referring to fig. 3, fig. 3 is a block diagram of a structure of the storage device online detection device provided in this embodiment; the apparatus may include: a memory 300 and a processor 310. The storage device online detection device may refer to the introduction of the storage device online detection method.
The memory 300 is mainly used for storing programs;
the processor 310 is mainly used for implementing the steps of the storage device online detection method when executing the program.
Referring to fig. 4, a schematic structural diagram of the storage device online detection device provided in this embodiment is shown, where the data storage device may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 322 (e.g., one or more processors) and a memory 332, and one or more storage media 330 (e.g., one or more mass storage devices) storing an application 342 or data 344. Memory 332 and storage media 330 may be, among other things, transient storage or persistent storage. The program stored on the storage medium 330 may include one or more modules (not shown), each of which may include a series of instructions operating on a data processing device. Still further, the central processor 322 may be configured to communicate with the storage medium 330 to execute a series of instruction operations in the storage medium 330 on the online detection device 301.
The on-line detection device 301 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input-output interfaces 358, and/or one or more operating systems 341, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, and the like.
The steps in the storage device online detection method described in fig. 1 above may be implemented by the structure of the storage device online detection device.
The embodiment discloses a readable storage medium, where a program is stored on the readable storage medium, and the program, when executed by a processor, implements the steps of the storage device online detection method, where the storage device online detection method may refer to the embodiment corresponding to fig. 1, and is not described herein again.
The readable storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various other readable storage media capable of storing program codes.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
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 invention.
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.
The storage device online detection method, device, equipment and readable storage medium provided by the invention are described in detail above. The principles and embodiments of the present invention are explained herein using specific examples, which are presented only to assist in understanding the method and its core concepts. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.