Device abnormal state detection method, system, terminal and storage medium

By receiving and detecting the heartbeat data of terminal devices, using hash buckets and preset time intervals, the problem of low accuracy in detecting abnormal device status is solved, and timely detection is achieved when there is a data channel problem or the device is not working.

CN115550222BActive Publication Date: 2024-09-06YUN ZHI SHENG (HANG ZHOU) ZHI NENG KE JI YOU XIAN GONG SI
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211250041.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-12
Publication Date
2024-09-06
Estimated Expiration
2042-10-12

AI Technical Summary

Technical Problem

Existing equipment abnormal status detection cannot report the abnormal status in time when there is a problem with the data channel or the equipment is not working, resulting in low detection accuracy.

Method used

By receiving the heartbeat data of the terminal device, determine its corresponding hash bucket, update and detect the heartbeat record, if the detection fails, it will be determined as an abnormal device, generate device abnormal status detection results, and use the hash bucket and preset time interval to improve detection accuracy.

Benefits of technology

It effectively improves the accuracy of equipment abnormal status detection, especially when there is a data channel problem or the equipment is not working, it can detect abnormal status in time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115550222B
    Figure CN115550222B
Patent Text Reader

Abstract

The present invention provides a device abnormal state detection method, system, terminal and storage medium, the method comprising: receiving heartbeat data sent by each terminal device, and determining the hash bucket corresponding to each heartbeat data; updating the device heartbeat record in the corresponding hash bucket according to each heartbeat data; performing information detection on the device heartbeat record in each hash bucket according to a preset time interval; if the information detection of any device heartbeat record is unqualified, determining the abnormal device in the terminal device according to the device heartbeat record; generating a device abnormal state detection result according to the device information of the abnormal device. The present invention performs information detection on the device heartbeat record in each hash bucket at a preset time interval, and when a problem occurs in the data channel or the terminal device is completely inoperable, the abnormal state of each terminal device can be effectively detected, thereby improving the accuracy of device abnormal state detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of equipment detection, and in particular to a method, system, terminal and storage medium for detecting abnormal state of equipment. Background Art

[0002] In the Internet of Things system, a large number of terminal devices will be connected to the Internet of Things (IOT) platform, and uplink and downlink interactive communication of messages will be carried out by establishing data channels. There are many terminal devices involved in the Internet of Things. In order to ensure the stability of the operation of the terminal devices, it is usually necessary to perform abnormal status detection on the operating status of the terminal devices so as to timely discover the abnormal operation of the terminal devices.

[0003] In the existing device abnormal status detection process, when the terminal device detects that its own status is abnormal, it will report the abnormal message to the IOT platform through the protocol interface. The administrator can view the abnormal status of the device in time and respond through the IOT platform management terminal. However, if there is a problem with the data channel or the device is completely non-operating (for example: network disconnection, device crash), the terminal device cannot report the abnormal status to the IOT platform in time, resulting in the administrator being unable to know the true status of the device, thereby reducing the accuracy of device abnormal status detection. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a method, system, terminal and storage medium for detecting abnormal state of a device, aiming to solve the problem of low accuracy of the existing abnormal state detection of a device.

[0005] The embodiment of the present invention is implemented as follows: a method for detecting abnormal state of a device, the method comprising:

[0006] Receive the heartbeat data sent by each terminal device, and determine the hash bucket corresponding to each heartbeat data;

[0007] Update the device heartbeat record in the corresponding hash bucket according to each heartbeat data;

[0008] Perform information detection on the device heartbeat records in each hash bucket according to the preset time interval;

[0009] If the information detection of any of the device heartbeat records fails, determining the abnormal device in the terminal device according to the device heartbeat record;

[0010] Generate a device abnormal state detection result according to the device information of the abnormal device.

[0011] Furthermore, the step of respectively determining the hash buckets corresponding to each heartbeat data includes:

[0012] Calculate the hash value of each heartbeat data to obtain the heartbeat hash value, and set the heartbeat hash value as the bucket number;

[0013] The bucket number is matched with a pre-stored bucket query table to obtain the hash bucket, wherein the bucket query table stores the corresponding relationship between different bucket numbers and corresponding hash buckets.

[0014] Furthermore, the updating of the device heartbeat record in the corresponding hash bucket according to each heartbeat data includes:

[0015] The device code and the heartbeat time in each heartbeat data are obtained respectively, and the device code and the heartbeat time in each heartbeat data are stored in the device heartbeat record in the corresponding hash bucket.

[0016] Furthermore, the information detection of the device heartbeat records in each hash bucket according to the preset time interval includes:

[0017] Query the number of the hash buckets to obtain the number of buckets, and start a device detection thread according to the number of buckets;

[0018] According to the preset time interval, each device detection thread is controlled to perform information detection on the device heartbeat records in each hash bucket.

[0019] Furthermore, the controlling each device detection thread to perform information detection on the device heartbeat record in each hash bucket includes:

[0020] According to each device detection thread, the heartbeat records of each device are traversed respectively, and the target heartbeat time of each device heartbeat record is determined according to the traversal results;

[0021] Calculate the time difference between the target heartbeat time and the current time of each device's heartbeat record;

[0022] If any of the time differences is less than or equal to the time threshold, it is determined that the information detection of the heartbeat record of the device is qualified;

[0023] If any of the time differences is greater than the time threshold, it is determined that the information detection of the device heartbeat record is unqualified.

[0024] Furthermore, after matching the bucket number with the pre-stored bucket query table, the method further includes:

[0025] If the bucket number does not match the bucket query table, the number of hash buckets is increased, and storage space is set for each of the increased hash buckets;

[0026] The newly added hash bucket and the bucket number are stored in the bucket query table correspondingly.

[0027] Furthermore, after storing the device code and the heartbeat time in each heartbeat data into the device heartbeat record in the corresponding hash bucket, it also includes:

[0028] Get the remaining storage space of each hash bucket respectively;

[0029] If the remaining storage space of any of the hash buckets is less than the storage threshold, the device heartbeat record in the hash bucket is set as a record to be optimized;

[0030] The target record information is determined according to the heartbeat time in the record to be optimized, and the target record information is deleted.

[0031] Another object of an embodiment of the present invention is to provide a device abnormal state detection system, the system comprising:

[0032] The data receiving module is used to receive the heartbeat data sent by each terminal device and determine the hash bucket corresponding to each heartbeat data;

[0033] An information updating module is used for updating the heartbeat records of devices in the corresponding hash bucket according to each heartbeat data;

[0034] An information detection module is used to perform information detection on the device heartbeat records in each hash bucket according to a preset time interval;

[0035] The result generating module is used to determine the abnormal device in the terminal device according to the device heartbeat record if the information detection of any of the device heartbeat records fails; and generate the device abnormal state detection result according to the device information of the abnormal device.

[0036] Another object of an embodiment of the present invention is to provide a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.

[0037] Another object of an embodiment of the present invention is to provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above method are implemented.

[0038] The embodiment of the present invention improves the accuracy of updating the device heartbeat record information in the hash bucket by respectively determining the hash bucket corresponding to each heartbeat data, updates the device heartbeat record in the corresponding hash bucket through each heartbeat data to achieve the effect of distributed storage of each heartbeat data, improves the accuracy of heartbeat data storage, and performs information detection on the device heartbeat record in each hash bucket at preset time intervals. When a problem occurs in the data channel or the terminal device is completely inoperable, the abnormal state of each terminal device can be effectively detected, thereby improving the accuracy of device abnormal state detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 is a flow chart of a method for detecting abnormal state of a device provided by a first embodiment of the present invention;

[0040] Figure 2 is a flow chart of a method for detecting abnormal state of a device provided by a second embodiment of the present invention;

[0041] Figure 3 is a structural diagram of a device abnormal state detection system provided by a third embodiment of the present invention;

[0042] Figure 4 is a schematic diagram of the structure of a device abnormal state detection system provided by a fourth embodiment of the present invention;

[0043] Figure 5 It is a schematic diagram of the structure of a terminal device provided in the fifth embodiment of the present invention. DETAILED DESCRIPTION

[0044] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0045] In order to illustrate the technical solution of the present invention, a specific embodiment is provided below for illustration.

[0046] Embodiment 1

[0047] See also Figure 1 , is a flow chart of a device abnormal state detection method provided by a first embodiment of the present invention. The device abnormal state detection method can be applied to any system. The device abnormal state detection method comprises the steps of:

[0048] Step S10, receiving the heartbeat data sent by each terminal device, and determining the hash bucket corresponding to each heartbeat data;

[0049] Among them, the device abnormal state detection method is applied to the IOT platform, and each terminal device is connected to the IOT platform through a heartbeat interface. The heartbeat interface can be set according to needs. For example, the heartbeat interface can adopt a rest-api interface. The heartbeat data includes the device code and heartbeat time of the corresponding terminal device. The heartbeat time is the data sending time of the heartbeat data.

[0050] Optionally, in this step, respectively determining the hash buckets corresponding to each heartbeat data includes:

[0051] Calculate the hash value of each heartbeat data to obtain the heartbeat hash value, and set the heartbeat hash value as the bucket number; wherein, the device code in the heartbeat data is used as the key, and the key is hashed to obtain the heartbeat hash value;

[0052] The bucket number is matched with a pre-stored bucket query table to obtain the hash bucket, wherein the bucket query table stores a correspondence between different bucket numbers and corresponding hash buckets.

[0053] Furthermore, in this step, after matching the bucket number with the pre-stored bucket query table, the step further includes:

[0054] If the bucket number does not match the bucket query table, the number of hash buckets is increased, and storage space is set for each of the increased hash buckets;

[0055] If the bucket number does not match the bucket query table, it is determined that no hash bucket is set for the terminal device corresponding to the bucket number, and the number of hash buckets is increased to achieve the setting of hash buckets for the terminal device corresponding to the bucket number. Preferably, in this step, the distributed cache system is divided into multiple hash buckets, each hash bucket corresponds to a terminal device, and when the number of hash buckets is increased in the distributed cache system, the accuracy of the storage space setting in each hash bucket is improved by setting the storage space of each increased hash bucket.

[0056] The newly added hash bucket and the bucket number are stored correspondingly in the bucket query table, wherein, by storing the newly added hash bucket and the bucket number correspondingly in the bucket query table, subsequent queries on the hash bucket corresponding to the current terminal device are facilitated, thereby improving the accuracy of subsequent heartbeat data storage.

[0057] Step S20, updating the device heartbeat record in the corresponding hash bucket according to each heartbeat data;

[0058] Among them, each heartbeat data is stored in the device heartbeat record in the corresponding hash bucket to achieve the effect of updating the information of the device heartbeat record;

[0059] Optionally, in this step, updating the device heartbeat record in the corresponding hash bucket according to each heartbeat data includes:

[0060] Respectively obtain the device code and heartbeat time in each heartbeat data, and store the device code and heartbeat time in each heartbeat data in the device heartbeat record in the corresponding hash bucket;

[0061] Among them, the heartbeat data is stored in the device heartbeat record in the form of key-value, where the key is the device code and the value is the heartbeat time. In this step, the number of hash buckets set in the distributed cache system is N. The heartbeat data is stored in each hash bucket in a distributed manner, and the data stored in each hash bucket is 1 / N, which greatly reduces the amount of data in a single bucket.

[0062] Furthermore, in this step, after storing the device code and heartbeat time in each heartbeat data into the device heartbeat record in the corresponding hash bucket, it also includes:

[0063] Get the remaining storage space of each hash bucket respectively;

[0064] If the remaining storage space of any of the hash buckets is less than the storage threshold, the device heartbeat record in the hash bucket is set as a record to be optimized;

[0065] The storage threshold can be set according to demand. If the remaining storage space of any hash bucket is less than the storage threshold, it is determined that the remaining storage space for data in the hash bucket is small. By setting the device heartbeat record in the hash bucket as the record to be optimized, the accuracy of subsequent record information deletion is improved.

[0066] Determine target record information according to the heartbeat time in the record to be optimized, and delete the target record information;

[0067] The heartbeat time of each record information in the record to be optimized is queried respectively, and the record information corresponding to the earliest heartbeat time is determined as the target record information. By deleting the target record information, the storage of subsequent heartbeat data in the record to be optimized is guaranteed.

[0068] Step S30, performing information detection on the device heartbeat records in each hash bucket according to a preset time interval;

[0069] Among them, the preset time interval can be set according to needs. For example, the preset time interval can be set to 4 minutes, 5 minutes or 6 minutes, etc. In this step, the device heartbeat records in each hash bucket are respectively detected at the preset time interval. When a problem occurs in the data channel or the terminal device is completely non-operating, the abnormal state of each terminal device can be effectively detected, thereby improving the accuracy of abnormal state detection of the device.

[0070] Step S40, if the information detection of any of the device heartbeat records fails, determining the abnormal device in the terminal device according to the device heartbeat record;

[0071] Among them, if the information detection of any device heartbeat record fails, the terminal device corresponding to the device code in the device heartbeat record is determined to be an abnormal device; in this embodiment, if the information detection of the device heartbeat record passes, the current status of the terminal device corresponding to the device heartbeat record is determined to be normal.

[0072] Step S50, generating a device abnormal state detection result according to the device information of the abnormal device;

[0073] The device information includes information such as device code and device abnormal communication address, and the device code and device abnormal communication address of each abnormal device are stored respectively to obtain the abnormal state detection result of the device;

[0074] Preferably, in this step, an abnormal prompt is generated according to the device code of each abnormal device, and the abnormal prompt is sent to the device abnormal communication address corresponding to the abnormal device, so as to achieve the device abnormality reminder effect.

[0075] In this embodiment, by respectively determining the hash bucket corresponding to each heartbeat data, the accuracy of updating the device heartbeat record information in the hash bucket is improved, and the device heartbeat record in the corresponding hash bucket is updated through each heartbeat data to achieve the effect of distributed storage of each heartbeat data, thereby improving the accuracy of heartbeat data storage. By presetting the time interval, the device heartbeat record in each hash bucket is respectively detected. When a problem occurs in the data channel or the terminal device is completely inoperable, the abnormal state of each terminal device can be effectively detected, thereby improving the accuracy of abnormal state detection of the device.

[0076] Embodiment 2

[0077] See also Figure 2 , is a flow chart of a method for detecting abnormal state of a device provided in a second embodiment of the present invention, and this embodiment is used to further refine step S30 in the first embodiment, including the steps of:

[0078] Step S31, querying the number of the hash buckets, obtaining the number of buckets, and starting a device detection thread according to the number of buckets;

[0079] Among them, by opening the device detection threads with the same number of hash buckets, it is ensured that one device detection thread is used to detect the information of the device heartbeat record in one hash bucket, so as to achieve the effect of distributed detection of the hash buckets and improve the data processing efficiency. Optionally, in this step, when the number of buckets changes, the number of device detection threads is corrected at the same time.

[0080] Step S32, controlling each device detection thread to perform information detection on the device heartbeat records in each hash bucket according to the preset time interval;

[0081] The device detection thread is continuously opened according to a preset time interval, and information detection is performed on the corresponding device heartbeat record according to the opened device detection thread;

[0082] Optionally, in this step, controlling each device detection thread to perform information detection on the device heartbeat record in each hash bucket includes:

[0083] According to each device detection thread, each device heartbeat record is traversed respectively, and the target heartbeat time of each device heartbeat record is determined respectively according to the traversal result, wherein the heartbeat time of the last recorded information in the heartbeat record of each device is determined as the target heartbeat time according to the traversal result;

[0084] Calculate the time difference between the target heartbeat time and the current time of each device's heartbeat record;

[0085] If any of the time differences is less than or equal to the time threshold, it is determined that the information detection of the device heartbeat record is qualified; wherein the time threshold can be set according to demand, for example, the time threshold can be set to 2 minutes, 3 minutes or 4 minutes, etc. If any of the time differences is less than or equal to the time threshold, it is determined that the information detection of the device heartbeat record is qualified, and the terminal device corresponding to the device code in the device heartbeat record is operating normally;

[0086] If any of the time differences is greater than the time threshold, it is determined that the information detection of the device heartbeat record is unqualified; if any of the time differences is greater than the time threshold, it is determined that the heartbeat data fed back by the terminal device is received for a long time, that is, the information detection of the device heartbeat record is unqualified, and the terminal device operating status corresponding to the device code in the device heartbeat record is abnormal.

[0087] In this embodiment, by opening device detection threads with the same number of hash buckets, it is ensured that one device detection thread is used to perform information detection on the device heartbeat record in one hash bucket, so as to achieve the effect of distributed detection of the hash bucket and improve data processing efficiency. By controlling each device detection thread to perform information detection on the device heartbeat record in each hash bucket, it is possible to detect whether there is any abnormality in the operating status of the terminal device corresponding to the device code in the device heartbeat record.

[0088] Embodiment 3

[0089] See also Figure 3 , is a schematic diagram of the structure of a device abnormal state detection system 100 provided in a third embodiment of the present invention, comprising: a data receiving module 10, an information updating module 11, an information detection module 12 and a result generating module 13, wherein:

[0090] The data receiving module 10 is used to receive the heartbeat data sent by each terminal device and respectively determine the hash bucket corresponding to each heartbeat data. The device abnormal state detection system can be applied to the IOT platform. Each terminal device is connected to the IOT platform through a heartbeat interface. The heartbeat interface can be set according to needs. For example, the heartbeat interface can adopt a rest-api interface. The heartbeat data includes the device code and heartbeat time of the corresponding terminal device. The heartbeat time is the data sending time of the heartbeat data.

[0091] Optionally, the data receiving module 10 is further used to: perform hash value calculation on each heartbeat data to obtain a heartbeat hash value, and set the heartbeat hash value as a bucket number;

[0092] The bucket number is matched with a pre-stored bucket query table to obtain the hash bucket, wherein the bucket query table stores the corresponding relationship between different bucket numbers and corresponding hash buckets.

[0093] Furthermore, the data receiving module 10 is also used to: if the bucket number does not match the bucket query table, increase the number of the hash buckets, and set storage space for each of the increased hash buckets;

[0094] The newly added hash bucket and the bucket number are stored in the bucket query table correspondingly.

[0095] The information updating module 11 is used for updating the device heartbeat record in the corresponding hash bucket according to each heartbeat data, wherein each heartbeat data is stored in the device heartbeat record in the corresponding hash bucket to achieve the effect of updating the information of the device heartbeat record.

[0096] Furthermore, the information updating module 11 is also used to respectively obtain the device code and the heartbeat time in each heartbeat data, and store the device code and the heartbeat time in each heartbeat data into the device heartbeat record in the corresponding hash bucket.

[0097] Optionally, the information updating module 11 is further used to: respectively obtain the remaining storage space of each hash bucket;

[0098] If the remaining storage space of any of the hash buckets is less than the storage threshold, the device heartbeat record in the hash bucket is set as a record to be optimized;

[0099] The target record information is determined according to the heartbeat time in the record to be optimized, and the target record information is deleted.

[0100] The information detection module 12 is used to perform information detection on the device heartbeat records in each hash bucket according to a preset time interval, wherein the preset time interval can be set according to demand, for example, the preset time interval can be set to 4 minutes, 5 minutes or 6 minutes, etc. In this step, the information detection is performed on the device heartbeat records in each hash bucket at the preset time interval. When a problem occurs in the data channel or the terminal device is completely inoperable, the abnormal state of each terminal device can be effectively detected, thereby improving the accuracy of the abnormal state detection of the device.

[0101] Furthermore, the information detection module 12 is also used to: query the number of the hash buckets, obtain the number of buckets, and start a device detection thread according to the number of buckets;

[0102] According to the preset time interval, each device detection thread is controlled to perform information detection on the device heartbeat records in each hash bucket.

[0103] Optionally, the information detection module 12 is further used to: traverse the heartbeat records of each device according to each device detection thread, and determine the target heartbeat time of the heartbeat record of each device according to the traversal result;

[0104] Calculate the time difference between the target heartbeat time and the current time of each device's heartbeat record;

[0105] If any of the time differences is less than or equal to the time threshold, it is determined that the information detection of the heartbeat record of the device is qualified;

[0106] If any of the time differences is greater than the time threshold, it is determined that the information detection of the device heartbeat record is unqualified.

[0107] The result generating module 13 is used for determining the abnormal device in the terminal device according to the device heartbeat record if the information detection of any of the device heartbeat records fails; generating the device abnormal state detection result according to the device information of the abnormal device, wherein, if the information detection of any of the device heartbeat records fails, it is determined that the terminal device corresponding to the device code in the device heartbeat record is an abnormal device; in this embodiment, if the information detection of the device heartbeat record passes, it is determined that the current state of the terminal device corresponding to the device heartbeat record is normal, and the device information includes information such as the device code and the device abnormal communication address, and the device code and the device abnormal communication address of each abnormal device are stored respectively to obtain the device abnormal state detection result.

[0108] In this embodiment, the accuracy of updating the device heartbeat record information in the hash bucket is improved by respectively determining the hash bucket corresponding to each heartbeat data. The device heartbeat record in the corresponding hash bucket is updated through each heartbeat data to achieve the effect of distributed storage of each heartbeat data, thereby improving the accuracy of heartbeat data storage. The device heartbeat record in each hash bucket is detected at preset time intervals. When a problem occurs in the data channel or the terminal device is completely inoperable, the abnormal state of each terminal device can be effectively detected, thereby improving the accuracy of abnormal state detection of the device.

[0109] Embodiment 4

[0110] See also Figure 4 , is a schematic diagram of the structure of the Internet platform provided by the fourth embodiment of the present invention, comprising: a heartbeat processing module 14, a distributed storage system 15 and a task scheduling module 16, wherein:

[0111] Each terminal device reports heartbeat data to the heartbeat processing module 14 at regular intervals (e.g., 1 minute) through the heartbeat interface of the IOT platform;

[0112] After receiving the heartbeat data, the heartbeat processing module 14 uses the device code in the heartbeat data as the key to perform a hash operation on it, and obtains the heartbeat record storage distributed cache service node corresponding to the heartbeat data and the hash bucket position in the corresponding node;

[0113] Call the application of the distributed storage system 15 to update the device code and heartbeat time in the heartbeat data to the corresponding hash bucket. In this step, the device code and heartbeat time in the heartbeat data are stored in the device heartbeat record in the hash bucket; for example, refer to Figure 4 , device code includes device

[0114] The task scheduling module 16 is started to start the scheduling task, and at every preset time interval (for example, 5 minutes), the processing thread is started to check the device heartbeat records stored in each hash bucket (each processing thread processes the device heartbeat records in one hash bucket);

[0115] The heartbeat processing service starts threads with the same number of hash buckets N to perform the device heartbeat check task; first, the data in the hash bucket is pulled into the local memory (each thread processes 1 / N device heartbeat data), and then the device heartbeat records are checked in a loop to find the device whose difference between the current system time and the device's last heartbeat time is greater than the duration threshold (for example, 3 minutes, 5 minutes, or 7 minutes, etc.), and the abnormal device is obtained and added to the abnormal device list;

[0116] Generate abnormal alarm messages based on the abnormal device list and notify the corresponding administrator via SMS or other means.

[0117] In this embodiment, in response to the increasing number of terminal devices, the value of the number of hash buckets N can be increased to further disperse the device heartbeat data into more hashes, and the corresponding number of task processing threads can be increased to improve the distributed computing capability of the device heartbeat data.

[0118] Specifically, the hash operation steps are:

[0119] 1) Divide the distributed storage system 15 into N hash buckets, where the data structure corresponding to each hash bucket is a hash table;

[0120] 2). The heartbeat data is stored in a hash bucket in the form of key-value, where the key is the device code and the value is the heartbeat time. When storing, the bucket position where each heartbeat data should fall is calculated first, and the key is calculated using the hash modulus algorithm to obtain the heartbeat hash value. The calculation formula is hash(key)=key%N, and the result is the bucket number where the data key should be stored. In this step, by dispersing the data into each hash bucket, the data stored in each hash bucket is 1 / N, which greatly reduces the amount of data in a single bucket.

[0121] In this embodiment, a distributed system 15 is introduced to save the latest heartbeat status record reported by the terminal device, and then the scheduling task is started to periodically detect the heartbeat that has not been reported for a long time, so that when the terminal device is disconnected from the network or crashes, the network platform can also detect the abnormal status of the device and notify the administrator to handle it in time; at the same time, due to the massive number of IoT devices, this embodiment adopts data hash bucket storage according to the device code to achieve the effect of dispersing massive device data. At the same time, when facing more device data, the hash bucket can also be dynamically expanded according to the situation, and more hash buckets can be used to disperse more data, so as to achieve the ability to detect abnormal status of massive devices.

[0122] Embodiment 5

[0123] Figure 5 1 is a block diagram of a terminal device 2 provided in the fifth embodiment of the present application. Figure 5 As shown, the terminal device 2 of this embodiment includes: a processor 20, a memory 21, and a computer program 22 stored in the memory 21 and executable on the processor 20, such as a program of a device abnormal state detection method. When the processor 20 executes the computer program 22, the steps in each embodiment of the above-mentioned device abnormal state detection method are implemented.

[0124] Exemplarily, the computer program 22 may be divided into one or more modules, which are stored in the memory 21 and executed by the processor 20 to complete the present application. The one or more modules may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program 22 in the terminal device 2. The terminal device may include, but is not limited to, a processor 20 and a memory 21.

[0125] The processor 20 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0126] The memory 21 may be an internal storage unit of the terminal device 2, such as a hard disk or memory of the terminal device 2. The memory 21 may also be an external storage device of the terminal device 2, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 2. Further, the memory 21 may also include both an internal storage unit and an external storage device of the terminal device 2. The memory 21 is used to store the computer program and other programs and data required by the terminal device. The memory 21 may also be used to temporarily store data that has been output or is to be output.

[0127] In addition, each functional module in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional unit.

[0128] If the integrated module is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Among them, the computer-readable storage medium can be non-volatile or volatile. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in computer-readable storage media can be appropriately increased or decreased according to the requirements of legislation and patent practices in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practices, computer-readable storage media do not include electrical carrier signals and telecommunication signals.

[0129] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A method for detecting abnormal state of equipment, characterized in that: The method comprises: Receive the heartbeat data sent by each terminal device, and determine the hash bucket corresponding to each heartbeat data; Update the device heartbeat record in the corresponding hash bucket according to each heartbeat data; Perform information detection on the device heartbeat records in each hash bucket according to the preset time interval; If the information detection of any of the device heartbeat records fails, determining the abnormal device in the terminal device according to the device heartbeat record; Generate a device abnormal state detection result according to the device information of the abnormal device; The step of respectively determining the hash buckets corresponding to each heartbeat data includes: Using the device code in each heartbeat data as the key, using the hash modulo algorithm to calculate the key to obtain a heartbeat hash value, and setting the heartbeat hash value as the bucket number; matching the bucket number with the pre-stored bucket query table to obtain the hash bucket; If the bucket number does not match the bucket query table, the number of hash buckets is increased, and storage space is set for each of the increased hash buckets; The newly added hash bucket and the bucket number are stored in the bucket query table correspondingly.

2. The device abnormal state detection method according to claim 1, characterized in that: The updating of the device heartbeat record in the corresponding hash bucket according to each heartbeat data includes: The device code and the heartbeat time in each heartbeat data are obtained respectively, and the device code and the heartbeat time in each heartbeat data are stored in the device heartbeat record in the corresponding hash bucket.

3. The device abnormal state detection method according to claim 1, characterized in that: The information detection of the device heartbeat records in each hash bucket according to the preset time interval includes: Query the number of the hash buckets to obtain the number of buckets, and start a device detection thread according to the number of buckets; According to the preset time interval, each device detection thread is controlled to perform information detection on the device heartbeat records in each hash bucket.

4. The device abnormal state detection method according to claim 3, characterized in that: The controlling each device detection thread to perform information detection on the device heartbeat records in each hash bucket includes: According to each device detection thread, the heartbeat records of each device are traversed respectively, and the target heartbeat time of each device heartbeat record is determined according to the traversal results; Calculate the time difference between the target heartbeat time and the current time of each device's heartbeat record; If any of the time differences is less than or equal to the time threshold, it is determined that the information detection of the heartbeat record of the device is qualified; If any of the time differences is greater than the time threshold, it is determined that the information detection of the device heartbeat record is unqualified.

5. The device abnormal state detection method according to claim 2, characterized in that: After storing the device code and the heartbeat time in each heartbeat data into the device heartbeat record in the corresponding hash bucket, the method further includes: Get the remaining storage space of each hash bucket respectively; If the remaining storage space of any of the hash buckets is less than the storage threshold, the device heartbeat record in the hash bucket is set as a record to be optimized; The target record information is determined according to the heartbeat time in the record to be optimized, and the target record information is deleted.

6. A device abnormal state detection system, characterized in that: The system comprises: The data receiving module is used to receive the heartbeat data sent by each terminal device and determine the hash bucket corresponding to each heartbeat data; An information updating module is used for updating the heartbeat records of devices in the corresponding hash bucket according to each heartbeat data; An information detection module is used to perform information detection on the device heartbeat records in each hash bucket according to a preset time interval; A result generating module, for determining an abnormal device in the terminal device according to the device heartbeat record if the information detection of any of the device heartbeat records is unqualified; and generating a device abnormal state detection result according to the device information of the abnormal device; The data receiving module is also used to: use the device code in each heartbeat data as the key, use the hash modulus algorithm to calculate the key, obtain the heartbeat hash value, set the heartbeat hash value as the bucket number; match the bucket number with the pre-stored bucket query table to obtain the hash bucket; If the bucket number does not match the bucket query table, the number of hash buckets is increased, and storage space is set for each of the increased hash buckets; The newly added hash bucket and the bucket number are stored in the bucket query table correspondingly.

7. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.