CN115550222A - Equipment abnormal state detection method, system, terminal and storage medium - Google Patents

Equipment abnormal state detection method, system, terminal and storage medium Download PDF

Info

Publication number
CN115550222A
CN115550222A CN202211250041.7A CN202211250041A CN115550222A CN 115550222 A CN115550222 A CN 115550222A CN 202211250041 A CN202211250041 A CN 202211250041A CN 115550222 A CN115550222 A CN 115550222A
Authority
CN
China
Prior art keywords
heartbeat
equipment
hash
record
bucket
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
CN202211250041.7A
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.)
Unisound Intelligent Technology Co Ltd
Original Assignee
Unisound 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 Unisound Intelligent Technology Co Ltd filed Critical Unisound Intelligent Technology Co Ltd
Priority to CN202211250041.7A priority Critical patent/CN115550222A/en
Publication of CN115550222A publication Critical patent/CN115550222A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0823Errors, e.g. transmission errors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3236Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials using cryptographic hash functions

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Environmental & Geological Engineering (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a method, a system, a terminal and a storage medium for detecting abnormal states of equipment, wherein the method comprises the following steps: receiving heartbeat data sent by each terminal device, and respectively determining a hash bucket corresponding to each heartbeat data; updating information of the equipment heartbeat records in the corresponding hash bucket according to the heartbeat data; respectively carrying out information detection on the equipment heartbeat records in the hash buckets according to a preset time interval; if the information detection of any one equipment heartbeat record is unqualified, determining abnormal equipment in the terminal equipment according to the equipment heartbeat record; and generating an equipment abnormal state detection result according to the equipment information of the abnormal equipment. The invention respectively carries out information detection on the heartbeat records of the equipment in each hash bucket through the preset time interval, and can effectively detect the abnormal state of each terminal equipment when the data channel is in trouble or the terminal equipment is completely inoperable, thereby improving the accuracy of the detection of the abnormal state of the equipment.

Description

Equipment abnormal state detection method, system, terminal and storage medium
Technical Field
The present invention relates to the field of device detection technologies, and in particular, to a method, a system, a terminal, and a storage medium for detecting an abnormal state of a device.
Background
In an Internet of Things system, a large number of terminal devices access an Internet of Things platform (Internet of Things, IOT), and uplink and downlink interactive communication of messages is performed by establishing a data channel, and in order to ensure stability of operation of the terminal devices, abnormal state detection is generally required to be performed on operation states of the terminal devices, so as to discover abnormal operation of the terminal devices in time.
In the existing abnormal state detection process of the equipment, when the terminal equipment detects that the state of the terminal equipment is abnormal, an abnormal message is reported to an IOT platform through a protocol interface, an administrator can check the abnormal state of the equipment in time and respond through a management end of the IOT platform, but if a data channel is in trouble or the equipment can not work at all (such as network disconnection and equipment halt), the terminal equipment can not report the abnormal state to the IOT platform in time, so that the administrator can not know the real state of the equipment, and the accuracy of abnormal state detection of the equipment is further reduced.
Disclosure of Invention
The embodiment of the invention aims to provide a method, a system, a terminal and a storage medium for detecting abnormal states of equipment, and aims to solve the problem that the existing equipment abnormal state detection is low in accuracy.
The embodiment of the invention is realized in such a way that a method for detecting the abnormal state of equipment comprises the following steps:
receiving heartbeat data sent by each terminal device, and respectively determining a hash bucket corresponding to each heartbeat data;
updating information of the equipment heartbeat records in the corresponding hash bucket according to the heartbeat data;
respectively carrying out information detection on the equipment heartbeat records in the hash buckets according to a preset time interval;
if the information detection of any one equipment heartbeat record is unqualified, determining abnormal equipment in the terminal equipment according to the equipment heartbeat record;
and generating an equipment abnormal state detection result according to the equipment information of the abnormal equipment.
Further, the determining the hash bucket corresponding to each piece of heartbeat data respectively includes:
respectively carrying out hash value calculation on each heartbeat data to obtain heartbeat hash values, and setting the heartbeat hash values as barrel numbers;
and matching the bucket numbers with a pre-stored bucket query table to obtain the hash buckets, wherein the bucket query table stores the corresponding relations between different bucket numbers and the corresponding hash buckets.
Further, the information updating of the device heartbeat record in the corresponding hash bucket according to each piece of heartbeat data includes:
and respectively acquiring the equipment code and the heartbeat time in each heartbeat data, and storing the equipment code and the heartbeat time in each heartbeat data into the corresponding equipment heartbeat record in the hash bucket.
Further, the performing information detection on the device heartbeat records in each hash bucket according to the preset time interval includes:
inquiring the number of the hash buckets to obtain the number of the buckets, and starting an equipment detection thread according to the number of the buckets;
and controlling each equipment detection thread to carry out information detection on the equipment heartbeat records in each hash bucket according to the preset time interval.
Further, the controlling each device detection thread to perform information detection on the device heartbeat record in each hash bucket includes:
traversing the heartbeat records of each device according to the detection thread of each device, and determining the target heartbeat time of the heartbeat records of each device according to the traversing result;
respectively calculating the time difference between the target heartbeat time recorded by each device heartbeat and the current time;
if any time difference is smaller than or equal to a time threshold, judging that the information detection of the heartbeat record of the equipment is qualified;
and if any time difference is larger than the time threshold, judging that the information detection of the heartbeat record of the equipment is unqualified.
Further, after matching the bucket number with a pre-stored bucket lookup table, the method further includes:
if the matching of the barrel number and the barrel query table is unqualified, increasing the number of the hash barrels, and setting the storage space of each increased hash barrel;
and correspondingly storing the newly added hash bucket and the bucket number into the bucket query table.
Further, after the device code and the heartbeat time in each heartbeat data are stored in the corresponding device heartbeat record in the hash bucket, the method further includes:
respectively obtaining the residual storage space of each hash bucket;
if the residual storage space of any hash bucket is smaller than a storage threshold value, setting the device heartbeat record in the hash bucket as a record to be optimized;
and determining target record information according to the heartbeat time in the record to be optimized, and deleting the target record information.
Another object of an embodiment of the present invention is to provide a system for detecting an abnormal state of a device, where the system includes:
the data receiving module is used for receiving heartbeat data sent by each terminal device and respectively determining a hash bucket corresponding to each heartbeat data;
the information updating module is used for updating information of the corresponding equipment heartbeat record in the hash bucket according to each heartbeat data;
the information detection module is used for respectively carrying out information detection on the equipment heartbeat records in the hash buckets according to a preset time interval;
the result generation module is used for determining abnormal equipment in the terminal equipment according to the heartbeat record of the equipment if the information detection of the heartbeat record of any equipment is unqualified; and generating an equipment abnormal state detection result according to the equipment information of the abnormal equipment.
It is another object of the embodiments of the present invention to provide a terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the method when executing the computer program.
It is a further object of embodiments of the present invention to provide a computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, carries out the above-mentioned method steps.
According to the embodiment of the invention, the accuracy of updating the heartbeat record information of the equipment in the hash bucket is improved by respectively determining the hash bucket corresponding to each heartbeat data, the heartbeat record of the equipment in the hash bucket corresponding to each heartbeat data is updated by each heartbeat data, so that the effect of distributed storage of each heartbeat data is achieved, the accuracy of storing the heartbeat data is improved, the heartbeat record of the equipment in each hash bucket is respectively detected by preset time intervals, when the data channel is in problem or the terminal equipment is completely inoperable, the abnormal state of the terminal equipment can be effectively detected, and the accuracy of detecting the abnormal state of the equipment is improved.
Drawings
Fig. 1 is a flowchart of an abnormal state detection method of a device according to a first embodiment of the present invention;
fig. 2 is a flowchart of an abnormal state detection method of a device according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an abnormal state detection system of a device according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an abnormal state detection system of a device according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a terminal device according to a fifth embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In order to explain the technical means of the present invention, the following description will be given by way of specific examples.
Example one
Referring to fig. 1, a flowchart of an abnormal device status detecting method according to a first embodiment of the present invention is shown, where the abnormal device status detecting method can be applied to any system, and the abnormal device status detecting method includes the steps of:
step S10, receiving heartbeat data sent by each terminal device, and respectively determining hash buckets corresponding to the heartbeat data;
the method for detecting the abnormal state of the equipment is applied to the IOT platform, each terminal equipment is in communication connection with the IOT platform through a heartbeat interface, the heartbeat interface can be set according to requirements, for example, the heartbeat interface can adopt a rest-api interface, the heartbeat data comprise equipment codes and heartbeat time of the corresponding terminal equipment, and the heartbeat time is data sending time of the heartbeat data.
Optionally, in this step, the determining the hash bucket corresponding to each piece of heartbeat data respectively includes:
respectively carrying out hash value calculation on each heartbeat data to obtain heartbeat hash values, and setting the heartbeat hash values as barrel numbers; the method comprises the steps that equipment codes in heartbeat data are used as keys, and hash operation is conducted on the keys to obtain heartbeat hash values;
and matching the bucket numbers with a pre-stored bucket query table to obtain the hash buckets, wherein the bucket query table stores the corresponding relations between different bucket numbers and the corresponding hash buckets.
Further, in this step, after the matching the bucket number with a pre-stored bucket lookup table, the method further includes:
if the matching of the barrel number and the barrel query table is unqualified, increasing the number of the hash barrels, and setting the storage space of each increased hash barrel;
if the barrel number is not matched with the barrel query table, judging that no hash barrel is arranged for the terminal equipment corresponding to the barrel number, and increasing the number of the hash barrels to set the hash barrel for the terminal equipment corresponding to the barrel number, preferably, in the step, dividing the distributed cache system into a plurality of hash barrels, wherein each hash barrel corresponds to one terminal equipment;
and correspondingly storing the newly added hash bucket and the bucket number into the bucket query table, wherein the newly added hash bucket and the bucket number are correspondingly stored into the bucket query table, so that the query of the hash bucket corresponding to the current terminal equipment is facilitated, and the accuracy of the subsequent heartbeat data storage is improved.
Step S20, updating information of the corresponding equipment heartbeat record in the hash bucket according to each heartbeat datum;
storing each heartbeat data into a device heartbeat record in a corresponding hash bucket so as to achieve the effect of updating the information of the device heartbeat record;
optionally, in this step, the updating information of the device heartbeat record in the corresponding hash bucket according to each piece of heartbeat data includes:
respectively acquiring the equipment codes and the heartbeat time in each heartbeat data, and storing the equipment codes and the heartbeat time in each heartbeat data into the corresponding equipment heartbeat records in the hash bucket;
the heartbeat data are stored in the heartbeat record of the equipment in a key-value mode, wherein the key is equipment codes, the value is heartbeat time, in the step, the number of the hash buckets arranged in the distributed cache system is N, the hash buckets are dispersedly stored in the hash buckets through the heartbeat data, the data stored in each hash bucket is 1/N, and the data volume of a single bucket is greatly reduced.
Further, in this step, after the 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:
respectively obtaining the residual storage space of each hash bucket;
if the residual storage space of any hash bucket is smaller than a storage threshold value, setting the device heartbeat record in the hash bucket as a record to be optimized;
the storage threshold value can be set according to requirements, if the residual storage space of any hash bucket is smaller than the storage threshold value, the fact that the residual storage space of data in the hash bucket is small is judged, and the accuracy of deleting subsequent recorded information is improved by setting the equipment heartbeat record in the hash bucket as a record to be optimized;
determining target record information according to the heartbeat time in the record to be optimized, and deleting the target record information;
the heartbeat time of each record information in the record to be optimized is inquired respectively, the record information corresponding to the earliest heartbeat time is determined as the target record information, and the target record information is deleted, so that the storage of subsequent heartbeat data in the record to be optimized is guaranteed.
Step S30, information detection is respectively carried out on the equipment heartbeat records in the hash buckets according to a preset time interval;
in the step, the information detection is performed on the heartbeat records of the devices in the hash buckets respectively through the preset time intervals, and when a data channel is in a problem or the terminal devices are completely inoperable, the abnormal state of the terminal devices can be effectively detected, so that the accuracy of the abnormal state detection of the devices is improved.
Step S40, if the information detection of any one equipment heartbeat record is unqualified, determining abnormal equipment in the terminal equipment according to the equipment heartbeat record;
if the information detection of any one device heartbeat record is not qualified, judging that the terminal device corresponding to the device code in the device heartbeat record is an abnormal device; in this embodiment, if the information of the device heartbeat record is detected to be qualified, it is determined that the current state of the terminal device corresponding to the device heartbeat record is normal.
Step S50, generating an equipment abnormal state detection result according to the equipment information of the abnormal equipment;
the equipment information comprises equipment codes, equipment abnormal communication addresses and other information, and the equipment codes and the equipment abnormal communication addresses of the abnormal equipment are respectively stored to obtain an equipment abnormal state detection result;
preferably, in this step, an exception prompt is generated according to the device code of each abnormal device, and the exception prompt is sent to the device exception communication address corresponding to the abnormal device, so as to achieve the device exception prompting effect.
In the embodiment, the hash buckets corresponding to the heartbeat data are respectively determined, so that the accuracy of updating the heartbeat record information of the equipment in the hash buckets is improved, the heartbeat records of the equipment in the corresponding hash buckets are updated through the heartbeat data, the effect of distributed storage of the heartbeat data is achieved, the accuracy of storing the heartbeat data is improved, the heartbeat records of the equipment in the hash buckets are respectively detected through the preset time interval, when a data channel is in trouble or the terminal equipment is completely inoperable, the abnormal state of the terminal equipment can be effectively detected, and the accuracy of detecting the abnormal state of the equipment is improved.
Example two
Referring to fig. 2, it is a flowchart of a method for detecting an abnormal state of a device according to a second embodiment of the present invention, which is used to further refine step S30 in the first embodiment, and includes the steps of:
step S31, inquiring the number of the hash buckets to obtain the bucket number, and starting an equipment detection thread according to the bucket number;
the device detection threads with the same number of the hash buckets are started, so that the device detection threads are used for performing information detection on the device heartbeat records in one hash bucket, the distributed detection effect on the hash buckets is achieved, and the data processing efficiency is improved. Optionally, in this step, when the number of buckets changes, the number of device detection threads is modified at the same time.
Step S32, controlling each equipment detection thread to carry out information detection on the equipment heartbeat records in each hash bucket according to the preset time interval;
starting the device detection thread continuously according to a preset time interval, and respectively carrying out information detection on corresponding device heartbeat records according to the started device detection thread;
optionally, in this step, the controlling each device detection thread to perform information detection on the device heartbeat record in each hash bucket includes:
respectively traversing each equipment heartbeat record according to each equipment detection thread, and respectively determining the target heartbeat time of each equipment heartbeat record according to the traversal result, wherein the heartbeat time of the last recorded information in each equipment heartbeat record is respectively determined as the target heartbeat time according to the traversal result; (ii) a
Respectively calculating the time difference between the target heartbeat time recorded by each device heartbeat and the current time;
if any time difference is smaller than or equal to a time threshold, judging that the information detection of the heartbeat record of the equipment is qualified; the duration threshold may be set according to a requirement, for example, the duration threshold may be set to 2 minutes, 3 minutes, or 4 minutes, and the like, if any duration difference is less than or equal to the duration 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 in a normal operating state;
if any time difference is larger than the time threshold, judging that the information detection of the heartbeat record of the equipment is unqualified; if any time difference is larger than the time threshold, the fact that the heartbeat data fed back by the terminal equipment is received for a long time is judged, namely the information detection of the heartbeat record of the equipment is unqualified, and the running state of the terminal equipment corresponding to the equipment code in the heartbeat record of the equipment is abnormal.
In this embodiment, by opening the device detection threads with the same number of hash buckets, it is ensured that one device detection thread is used for performing information detection on the device heartbeat records in one hash bucket, so as to achieve the effect of distributed detection on the hash buckets, and improve the data processing efficiency.
EXAMPLE III
Referring to fig. 3, a schematic structural diagram of an apparatus abnormal state detection system 100 according to a third embodiment of the present invention is shown, including: a data receiving module 10, an information updating module 11, an information detecting module 12 and a result generating module 13, wherein:
the data receiving module 10 is configured to receive heartbeat data sent by each terminal device, and determine hash buckets corresponding to the heartbeat data respectively, where the device abnormal state detection system may be applied to an IOT platform, each terminal device is in communication connection with the IOT platform through a heartbeat interface, and the heartbeat interface may be set according to a requirement, for example, the heartbeat interface may adopt a rest-api interface, the heartbeat data includes a device code and a heartbeat time corresponding to the terminal device, and the heartbeat time is a data sending time of the heartbeat data.
Optionally, the data receiving module 10 is further configured to: respectively carrying out hash value calculation on each heartbeat data to obtain heartbeat hash values, and setting the heartbeat hash values as barrel numbers;
and matching the barrel numbers with a pre-stored barrel query table to obtain the hash barrels, wherein the barrel query table stores corresponding relations between different barrel numbers and corresponding hash barrels.
Further, the data receiving module 10 is further configured to: if the matching of the barrel number and the barrel query table is unqualified, increasing the number of the hash barrels, and setting the storage space of each increased hash barrel;
and correspondingly storing the newly added hash bucket and the bucket number into the bucket query table.
And the information updating module 11 is configured to perform information updating on the corresponding device heartbeat record in the hash bucket according to each heartbeat data, where each heartbeat data is stored in the device heartbeat record in the corresponding hash bucket, so as to achieve an effect of updating the information of the device heartbeat record.
Further, the information updating module 11 is further configured to: and respectively acquiring the equipment code and the heartbeat time in each heartbeat data, and storing the equipment code and the heartbeat time in each heartbeat data into the corresponding equipment heartbeat record in the hash bucket.
Optionally, the information updating module 11 is further configured to: respectively obtaining the residual storage space of each hash bucket;
if the residual storage space of any hash bucket is smaller than a storage threshold value, setting the device heartbeat record in the hash bucket as a record to be optimized;
and determining target record information according to the heartbeat time in the record to be optimized, and deleting the target record information.
The information detection module 12 is configured to perform information detection on the device heartbeat records in each hash bucket according to a preset time interval, where the preset time interval may be set according to a requirement, for example, the preset time interval may be set to 4 minutes, 5 minutes, or 6 minutes, and in this step, the information detection is performed on the device heartbeat records in each hash bucket through the preset time interval, and when a data channel is faulty or a terminal device is completely inoperable, the abnormal state of each terminal device can be effectively detected, so that the accuracy of detecting the abnormal state of the device is improved.
Further, the information detection module 12 is further configured to: inquiring the number of the hash buckets to obtain the number of the buckets, and starting an equipment detection thread according to the number of the buckets;
and controlling each equipment detection thread to carry out information detection on the equipment heartbeat record in each hash bucket according to the preset time interval.
Optionally, the information detecting module 12 is further configured to: respectively traversing each equipment heartbeat record according to each equipment detection thread, and respectively determining the target heartbeat time of each equipment heartbeat record according to the traversal result;
respectively calculating the time difference between the target heartbeat time recorded by each device heartbeat and the current time;
if any one time length difference is smaller than or equal to a time length threshold value, judging that the information detection of the heartbeat record of the equipment is qualified;
and if any time difference is larger than the time threshold, judging that the information detection of the heartbeat record of the equipment is unqualified.
A result generating module 13, configured to determine, according to the device heartbeat record, an abnormal device in the terminal device if information of any one of the device heartbeat records is detected ineligibly; generating an equipment abnormal state detection result according to the equipment information of the abnormal equipment, wherein if the information of any equipment heartbeat record is unqualified, the terminal equipment corresponding to the equipment code in the equipment heartbeat record is judged to be the abnormal equipment; in this embodiment, if the information of the device heartbeat record is detected to be qualified, it is determined that the current state of the terminal device corresponding to the device heartbeat record is normal, where the device information includes information such as a device code and a device abnormal communication address, and the device code and the device abnormal communication address of each abnormal device are stored respectively, so as to obtain a device abnormal state detection result.
According to the embodiment, the hash buckets corresponding to the heartbeat data are respectively determined, so that the accuracy of updating the heartbeat record information of the equipment in the hash buckets is improved, the heartbeat records of the equipment in the corresponding hash buckets are updated through the heartbeat data, the effect of distributed storage of the heartbeat data is achieved, the accuracy of heartbeat data storage is improved, the heartbeat records of the equipment in the hash buckets are respectively detected through the preset time interval, when a data channel is in trouble or the terminal equipment is completely inoperable, the abnormal state of the terminal equipment can be effectively detected, and the accuracy of detecting the abnormal state of the equipment is improved.
Example four
Please refer to fig. 4, which is a schematic structural diagram of a networking platform according to a fourth embodiment of the present invention, including: a heartbeat processing module 14, a distributed storage system 15, and a task scheduling module 16, wherein:
each terminal device reports heartbeat data to the heartbeat processing module 14 at regular time intervals (for example, 1 minute) through a heartbeat interface of the IOT platform;
after receiving the heartbeat data, the heartbeat processing module 14 takes the device code in the heartbeat data as a key, and performs hash operation on the key to obtain a heartbeat record storage distributed cache service node of the device corresponding to the heartbeat data and a hash bucket position in the corresponding node;
calling the application of the distributed storage system 15, and updating the device codes and the heartbeat time in the heartbeat data into corresponding hash buckets (hash buckets), wherein in the step, the device codes and the heartbeat time in the heartbeat data are correspondingly stored into device heartbeat records in the hash buckets; for example, referring to FIG. 4, the device code includes device
Starting a task scheduling module 16 to start a scheduling task, and starting processing threads to check the device heartbeat records stored in each hash bucket at preset time intervals (for example, 5 minutes) (each processing thread processes the device heartbeat record in one hash bucket);
the heartbeat processing service starts threads with the number N consistent with that of the hash buckets to execute equipment heartbeat check tasks; firstly, pulling data in a hash bucket into a local memory (the heartbeat data of equipment processed by each thread is 1/N), then circularly traversing and checking the heartbeat records of the equipment, finding out equipment (for example, 3 minutes, 5 minutes or 7 minutes and the like) meeting the current system time and the last heartbeat time of the equipment and having a difference value larger than a time threshold value, obtaining abnormal equipment, and adding the abnormal equipment into an abnormal equipment list;
and generating an abnormal alarm message according to the abnormal equipment list, and informing a corresponding administrator in a short message or other modes.
In this embodiment, the value of the hash bucket number N can be increased in response to the increasing of the number of terminal devices, the device heartbeat data is further dispersed to more hashes, the task processing threads with corresponding numbers are added, and the distributed computing power of the device heartbeat data is improved.
Specifically, the hash operation step:
1) Divide the distributed storage system 15 into N hash buckets, wherein the data structure corresponding to each hash bucket is a hash table;
2) Heartbeat data is stored in the hash bucket in the form of a key-value, wherein the key is the device encoding and the value is the heartbeat time; when the heartbeat data is stored, the position of a barrel into which each heartbeat data is supposed to fall is calculated firstly, a hash modulo algorithm is adopted, the calculation formula is key% N, the result is the barrel number into which the data key is supposed to be stored, in the step, the data volume is stored into each hash barrel in a dispersed mode, the data stored in each hash barrel is 1/N, and the data volume of a single barrel is greatly reduced.
In this embodiment, a method of storing the latest heartbeat state record reported by the terminal device by the distributed system 15, starting a scheduling task, and detecting the heartbeat which is not reported for a long time at regular time is introduced, so that the network platform can detect an abnormal state of the device and inform an administrator of timely processing the abnormal state under the extreme conditions of network disconnection or crash of the terminal device; meanwhile, due to the characteristic that the number of the internet of things devices is large, the data hash bucket storage is carried out according to the device codes, so that the effect of dispersing the mass device data is achieved, meanwhile, when more device data are faced, the hash bucket can dynamically expand according to conditions, more data are dispersed by using more hash buckets, and the capacity of detecting the abnormal state of the mass device is achieved.
EXAMPLE five
Fig. 5 is a block diagram of a terminal device 2 according to a fifth embodiment of the present application. As shown in fig. 5, the terminal device 2 of this embodiment includes: a processor 20, a memory 21 and a computer program 22 stored in said memory 21 and executable on said processor 20, such as a program of a device abnormal state detection method. The processor 20, when executing the computer program 22, implements the steps in the various embodiments of the apparatus abnormal state detection method described above.
Illustratively, the computer program 22 may be partitioned into one or more modules that are stored in the memory 21 and executed by the processor 20 to accomplish the present application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 22 in the terminal device 2. The terminal device may include, but is not limited to, a processor 20, a memory 21.
The Processor 20 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 21 may be an internal storage unit of the terminal device 2, such as a hard disk or a 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 memory Card (Flash Card), and the like, which are provided 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 for storing 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.
In addition, functional modules in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated module, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in a computer readable storage medium. The computer readable storage medium may be non-volatile or volatile. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by a computer program, which can be stored in a computer readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable storage medium may include: any entity or device capable of carrying computer program code, recording medium, U.S. disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution media, and the like. It should be noted that the computer readable storage medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable storage media that does not include electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. An apparatus abnormal state detection method, characterized in that the method comprises:
receiving heartbeat data sent by each terminal device, and respectively determining a hash bucket corresponding to each heartbeat data;
updating information of the equipment heartbeat records in the corresponding hash bucket according to the heartbeat data;
respectively carrying out information detection on the equipment heartbeat records in the hash buckets according to a preset time interval;
if the information detection of any one equipment heartbeat record is unqualified, determining abnormal equipment in the terminal equipment according to the equipment heartbeat record;
and generating an equipment abnormal state detection result according to the equipment information of the abnormal equipment.
2. The method for detecting abnormal states of devices according to claim 1, wherein the determining hash buckets corresponding to the respective heartbeat data respectively includes:
respectively carrying out hash value calculation on each heartbeat data to obtain heartbeat hash values, and setting the heartbeat hash values as barrel numbers;
and matching the bucket numbers with a pre-stored bucket query table to obtain the hash buckets, wherein the bucket query table stores the corresponding relations between different bucket numbers and the corresponding hash buckets.
3. The method for detecting the abnormal state of the device according to claim 1, wherein the updating the information of the device heartbeat record in the corresponding hash bucket according to each heartbeat datum includes:
and respectively acquiring the equipment code and the heartbeat time in each heartbeat data, and storing the equipment code and the heartbeat time in each heartbeat data into the corresponding equipment heartbeat record in the hash bucket.
4. The method for detecting abnormal states of devices according to claim 1, wherein the detecting information of the device heartbeat records in each hash bucket according to the preset time interval comprises:
inquiring the number of the hash buckets to obtain the number of the buckets, and starting an equipment detection thread according to the number of the buckets;
and controlling each equipment detection thread to carry out information detection on the equipment heartbeat record in each hash bucket according to the preset time interval.
5. The method for detecting an abnormal state of a device according to claim 4, wherein the controlling each device detection thread to perform information detection on the device heartbeat record in each hash bucket includes:
respectively traversing each equipment heartbeat record according to each equipment detection thread, and respectively determining the target heartbeat time of each equipment heartbeat record according to the traversal result;
respectively calculating the time difference between the target heartbeat time recorded by each device heartbeat and the current time;
if any time difference is smaller than or equal to a time threshold, judging that the information detection of the heartbeat record of the equipment is qualified;
and if any time difference is larger than the time threshold, judging that the information detection of the heartbeat record of the equipment is unqualified.
6. The apparatus abnormal state detection method according to claim 2, wherein after matching the bucket number with a pre-stored bucket lookup table, further comprising:
if the matching between the bucket number and the bucket query table is unqualified, increasing the number of the hash buckets, and setting the storage space of each increased hash bucket;
and correspondingly storing the newly added hash bucket and the bucket number into the bucket query table.
7. The method for detecting abnormal device status according to claim 3, wherein after storing the device code and the heartbeat time in each heartbeat data into the corresponding device heartbeat record in the hash bucket, the method further comprises:
respectively obtaining the residual storage space of each hash bucket;
if the residual storage space of any hash bucket is smaller than a storage threshold value, setting the device heartbeat record in the hash bucket as a record to be optimized;
and determining target record information according to the heartbeat time in the record to be optimized, and deleting the target record information.
8. An abnormal state detection system for a device, the system comprising:
the data receiving module is used for receiving heartbeat data sent by each terminal device and respectively determining a hash bucket corresponding to each heartbeat data;
the information updating module is used for updating information of the corresponding equipment heartbeat record in the hash bucket according to each heartbeat data;
the information detection module is used for respectively carrying out information detection on the equipment heartbeat records in the hash buckets according to a preset time interval;
the result generation module is used for determining abnormal equipment in the terminal equipment according to the heartbeat record of the equipment if the information detection of the heartbeat record of any equipment is unqualified; and generating an equipment abnormal state detection result according to the equipment information of the abnormal equipment.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN202211250041.7A 2022-10-12 2022-10-12 Equipment abnormal state detection method, system, terminal and storage medium Pending CN115550222A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211250041.7A CN115550222A (en) 2022-10-12 2022-10-12 Equipment abnormal state detection method, system, terminal and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211250041.7A CN115550222A (en) 2022-10-12 2022-10-12 Equipment abnormal state detection method, system, terminal and storage medium

Publications (1)

Publication Number Publication Date
CN115550222A true CN115550222A (en) 2022-12-30

Family

ID=84732661

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211250041.7A Pending CN115550222A (en) 2022-10-12 2022-10-12 Equipment abnormal state detection method, system, terminal and storage medium

Country Status (1)

Country Link
CN (1) CN115550222A (en)

Similar Documents

Publication Publication Date Title
CN109302346B (en) Method and device for transmitting data flow
EP3386150B1 (en) Terminal failure processing method, device and system
CN107832100B (en) APK plug-in loading method and terminal thereof
CN108696589B (en) Block chain data transmission method, device, equipment and storage medium
CN110018996B (en) Snapshot rollback method and related device of distributed storage system
CN108512716B (en) Method, system, computer device and storage medium for reporting device information
CN108845916B (en) Platform monitoring and alarming method, device, equipment and computer readable storage medium
CN111541762B (en) Data processing method, management server, device and storage medium
US10205813B2 (en) Method and system for detecting abnormal contact information and server
US8719622B2 (en) Recording and preventing crash in an appliance
CN111342986B (en) Distributed node management method and device, distributed system and storage medium
CN112464238B (en) Vulnerability scanning method and electronic equipment
CN111190761B (en) Log output method and device, storage medium and electronic equipment
CN115550222A (en) Equipment abnormal state detection method, system, terminal and storage medium
CN112579591A (en) Data verification method and device, electronic equipment and computer readable storage medium
CN111352803A (en) Service data processing method, device, equipment and storage medium
US20210382872A1 (en) Blockchain-based Data Storage Method, Related Device and Storage Medium
CN111092956A (en) Resource synchronization method, device, storage medium and equipment
CN113905092B (en) Method, device, terminal and storage medium for determining reusable agent queue
CN105554134A (en) Information synchronization and device
CN105790975A (en) Service processing operation execution method and device
CN111224756B (en) Method and device for determining data transmission abnormity, storage medium and electronic equipment
CN113141376A (en) Malicious IP scanning detection method and device, electronic equipment and storage medium
CN114024819A (en) Event information reporting method and device
CN111935337A (en) MAC address keep-alive method, equipment and storage medium of aggregation link

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