A device online monitoring method and apparatus, electronic device and medium
By using a circular array to record the device's heartbeat information, updating and processing the device status every second, the problem of online device monitoring is solved, enabling real-time monitoring and trend analysis of device status, and improving system stability and user experience.
Patent Information
- Application Number
- CN202411754505.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-02
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2044-12-02
AI Technical Summary
Due to the large number of devices, they may go offline due to various malfunctions during operation, making them difficult to manage and impossible to dynamically monitor the online status of the devices, causing inconvenience and trouble for users.
A circular array is used to record the heartbeat information of the devices. The current element of the circular array is updated once per second. The data is processed according to the number of heartbeats and the element value to draw an online device trend chart.
It enables real-time monitoring of equipment status, improves the accuracy and reliability of monitoring, ensures that the system can respond promptly to changes in equipment status, and simplifies equipment management processes.
Smart Images

Figure CN119728501B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of online equipment monitoring technology, and in particular to an online equipment monitoring method, apparatus, electronic device, and medium. Background Technology
[0002] With the development of technology, the application scope of computer technology is expanding, and more and more devices are connecting to the Internet to interact with other devices or systems. However, due to the sheer number of devices, they may go offline due to various malfunctions during operation, making them difficult to manage and impossible to dynamically monitor their online status, causing inconvenience and trouble for users. Summary of the Invention
[0003] In view of the above problems, embodiments of the present invention are proposed to provide an online monitoring method, apparatus, electronic device and medium for overcoming or at least partially solving the above problems.
[0004] To address the above problems, this invention discloses an online device monitoring method, comprising:
[0005] Configure a circular array;
[0006] The current element of the circular array is updated once per second, and the current number of heartbeats received from the device in a single heartbeat message is determined.
[0007] If the current heartbeat count is greater than 0, obtain the original value of the current element and the original value of the previous element; use the sum of the current heartbeat count, the original value of the current element, and the original value of the previous element as the current value of the current element; set the value of the previous element to 0; and obtain the original value of the Nth element after the current element; use the difference between the original value of the Nth element after the current element and the current heartbeat count as the current value of the Nth element after the current element; where N is the heartbeat cycle.
[0008] If the current heartbeat count is 0, then the sum of the original value of the current element and the original value of the previous element is taken as the current value of the current element; and the value of the previous element is set to 0.
[0009] Optionally, the method further includes:
[0010] The number of currently online devices is determined based on the current value of the current element of the circular array;
[0011] Based on the current number of online devices, draw an online device trend chart.
[0012] Optionally, the size of the circular array is greater than the heartbeat cycle.
[0013] Optionally, the method further includes:
[0014] After configuring the circular array, initialize each element of the circular array to 0.
[0015] Accordingly, embodiments of the present invention also disclose an online equipment monitoring device, comprising:
[0016] The circular array configuration module is used to configure circular arrays;
[0017] The current heartbeat count update module is used to update the current element of the circular array once per second, and to determine the current heartbeat count of a single heartbeat message received from the device.
[0018] The first element update module is configured to: if the current heartbeat count is greater than 0, obtain the original value of the current element and the original value of the previous element; use the sum of the current heartbeat count, the original value of the current element, and the original value of the previous element as the current value of the current element; set the value of the previous element to 0; and obtain the original value of the Nth element after the current element; use the difference between the original value of the Nth element after the current element and the current heartbeat count as the current value of the Nth element after the current element; where N is the heartbeat cycle.
[0019] The second element update module is used to, if the current heartbeat count is 0, take the sum of the original value of the current element and the original value of the previous element of the current element as the current value of the current element; and set the value of the previous element to 0.
[0020] Optionally, the device further includes:
[0021] The quantity determination module is used to determine the number of currently online devices based on the current value of the current element of the circular array;
[0022] The trend chart drawing module is used to draw an online device trend chart based on the current number of online devices.
[0023] Optionally, the size of the circular array is greater than the heartbeat cycle.
[0024] Optionally, the device further includes:
[0025] An initialization module is used to initialize each element of the circular array to 0 after the circular array has been configured.
[0026] The embodiments of the present invention have the following advantages:
[0027] In this embodiment of the invention, a circular array is first configured to record heartbeat information sent by the device. Then, the current element of the circular array is updated every second, and the current number of heartbeats received from the device in a single instance is determined. Next, based on the current number of heartbeats, the elements of the circular array are updated and processed accordingly. In this way, this embodiment of the invention can comprehensively, quickly, and accurately record and process the device's heartbeat information, enhancing the intelligence of device management and ensuring that the system can respond promptly to changes in device status, thereby improving the system's stability and reliability. Attached Figure Description
[0028] Figure 1 This is a flowchart illustrating the steps of an online device monitoring method provided in an embodiment of the present invention;
[0029] Figure 2 This is a flowchart of another online device monitoring method provided in an embodiment of the present invention;
[0030] Figure 3 This is a flowchart illustrating the specific steps of an online device monitoring method provided in an embodiment of the present invention;
[0031] Figure 4 This is a structural block diagram of an online equipment monitoring device provided in an embodiment of the present invention. Detailed Implementation
[0032] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0033] With the development of technology, the application scope of computer technology is expanding, and more and more devices are connecting to the Internet to interact with other devices or systems. This trend of interconnectivity has greatly enhanced the intelligence and convenience of devices, enabling users to manage and use various devices more efficiently. However, as the number of devices connected to the Internet continues to increase, the management and maintenance of these devices are facing unprecedented challenges.
[0034] Due to the sheer number of devices, they may go offline due to various malfunctions during operation, making management difficult. These malfunctions may include hardware failures, software errors, network connectivity issues, etc., causing devices to malfunction or fail to interact effectively with other devices or systems. Furthermore, the diversity and complexity of the devices increase the difficulty of management and maintenance, often leaving users feeling helpless when faced with device failures. The inability to monitor the number of online devices in a timely and effective manner remains a current challenge.
[0035] In the prior art, there are two methods for counting online devices:
[0036] Algorithm A: This algorithm uses a heartbeat reporting method. Each device needs to maintain a record (device ID, online status, latest heartbeat time, heartbeat cycle). When a heartbeat arrives, the heartbeat time needs to be updated, and the online status needs to be set to "yes". Simultaneously, a scheduled task needs to iterate through all device information in the table every heartbeat cycle, calculating whether the current time minus the latest heartbeat time is greater than the heartbeat cycle. If it is, the online status is set to "no". Based on this data, the number of online devices is counted for trend chart generation.
[0037] Algorithm B: Instead of actively reporting, it sends an online status request to each device, determines whether a device is online based on the returned status or whether there is a return, and uses a variable as a counter to count the number of online devices for plotting trend charts.
[0038] Algorithm A is similar to the algorithm in this invention, both relying on heartbeat reporting. However, it requires persisting device information in a database, and the database needs to be traversed every heartbeat cycle. If the trend chart updates frequently, the I / O consumption will be very high. Algorithm B uses an active request method. Although it does not require a database, if the trend chart updates frequently, the system needs to send requests to each device frequently, which will cause significant performance issues.
[0039] One of the core concepts of this invention is that it only requires a circular array to count the number of devices online in real time and quickly plot a trend chart of the number of online devices, without being sensitive to the update frequency of the trend chart. Since the main purpose of real-time monitoring is to dynamically monitor the trend of the number of online devices through a trend chart, which has high real-time requirements, the method in this invention is more suitable for real-time statistical scenarios. In this invention, the design and use of the circular array greatly simplifies the monitoring process of device online status. By updating the current element of the circular array once per second and determining the current number of heartbeats received from the devices, the system can obtain the device status information in real time and make corresponding processing and decisions based on this information. This real-time update mechanism ensures that the system can reflect the online status of devices in a timely manner, thereby improving the accuracy and reliability of monitoring.
[0040] Reference Figure 1 The diagram illustrates a flowchart of an online device monitoring method according to an embodiment of the present invention. The method may specifically include the following steps:
[0041] Step 101, configure the circular array;
[0042] In this embodiment of the invention, a circular array is first configured to record the heartbeat information sent by the device. The design of the circular array enables the system to efficiently store and process the device's status information, thereby achieving real-time monitoring and management of the device's status.
[0043] A circular array is a special data structure that allows an array to continue storing new data from the beginning of the array after it has reached its maximum capacity, thus forming a cycle. This data structure is very useful in applications that require fixed-size buffers, such as heartbeat recording, data stream processing, and cache management.
[0044] The characteristics of a circular array are: its size is fixed and does not change once created. When the array reaches its maximum capacity, new data overwrites old data, thus forming a cycle. Circular arrays can efficiently store and access data because they do not require frequent memory allocation and deallocation. Circular arrays are suitable for scenarios that require real-time data monitoring and processing because they can continuously record the latest data.
[0045] In some examples, such as in smart home systems, various devices like smart light bulbs, smart sockets, and smart locks need to have their status monitored in real time. By configuring a circular array, the system can efficiently record the heartbeat information of these devices, ensuring that the status of each device is acquired and processed promptly. For example, when a smart light bulb sends a heartbeat message, the system can determine whether the bulb is working properly based on the heartbeat information and issue an alarm or perform automatic repair in a timely manner if the bulb malfunctions.
[0046] Step 102: Update the current element of the circular array once per second, and determine the current number of heartbeats received from the device in a single heartbeat message.
[0047] In this embodiment of the invention, the current element of the circular array can be updated once per second, and the current number of heartbeats received from the device in a single heartbeat event can be determined. This step ensures that the system can obtain the device's status information in a timely manner and perform corresponding processing and decisions based on this information.
[0048] In some examples, heartbeat information sent by the device can be obtained in various ways, such as through network communication and sensor data acquisition. These methods enable real-time monitoring of the device's status and allow for corresponding adjustments and optimizations based on changes in that status.
[0049] In some examples, other technologies, such as machine learning and artificial intelligence, can be combined to improve the efficiency and accuracy of heartbeat information processing. For instance, the system can use pre-trained models to analyze and predict heartbeat information, thereby identifying potential equipment malfunctions or anomalies in advance and taking corresponding preventative measures.
[0050] Step 103: If the current heartbeat count is greater than 0, obtain the original value of the current element and the original value of the previous element; use the sum of the current heartbeat count, the original value of the current element, and the original value of the previous element as the current value of the current element; set the value of the previous element to 0; and obtain the original value of the Nth element after the current element; use the difference between the original value of the Nth element after the current element and the current heartbeat count as the current value of the Nth element after the current element; where N is the heartbeat cycle.
[0051] In this embodiment of the invention, when the current heartbeat count is greater than 0, the system will perform the following operations:
[0052] To retrieve the original values of the current and previous elements: The system retrieves the original values of the current and previous elements from the circular array. These values are then used to calculate the new value of the current element.
[0053] Calculating the new value of the current element: The system adds the current heartbeat count, the original value of the current element, and the original value of the previous element to obtain the new value of the current element. This new value reflects a combination of information about the current and historical states of the device.
[0054] Setting the value of the previous element to 0: To ensure that the data in the circular array correctly reflects changes in the device's state, the system sets the value of the previous element to 0. This prevents old data from affecting new data.
[0055] To retrieve the raw value of the Nth element after the current element: The system retrieves the raw value of the Nth element after the current element from the circular array. N is the heartbeat period, representing the interval between heartbeat messages sent by the device.
[0056] Calculate the new value of the Nth element after the current element: The system uses the difference between the original value of the Nth element after the current element and the current heartbeat count as the new value of the Nth element after the current element. This new value reflects the device's state change during the heartbeat cycle.
[0057] Step 104: If the current heartbeat count is 0, then the sum of the original value of the current element and the original value of the previous element is taken as the current value of the current element; and the value of the previous element is set to 0.
[0058] In this embodiment of the invention, when the current heartbeat count is detected to be 0, a series of specific operations can be performed to update the element values in the circular array. This step is designed to ensure that continuous monitoring and recording of the device status can be maintained through accumulation and reset even when the device is not sending heartbeat information.
[0059] Specifically, when the current heartbeat count is 0, the original value of the current element is added to the original value of the previous element, and this sum is used as the current value of the current element. The purpose of this operation is to retain and accumulate previous state information even when the device is not sending heartbeat information, thereby avoiding information loss.
[0060] Additionally, the value of the previous element can be set to 0. This operation clears the value of the previous element so that heartbeat information recording can resume in the next time period. This ensures that the data for each time period is independent and complete, thereby improving the accuracy and reliability of data processing.
[0061] In some examples, other technical means, such as anomaly detection algorithms, can be combined to further optimize the processing effect of this step. For example, when the current heartbeat count is 0, an anomaly detection mechanism can be automatically triggered to perform a more in-depth analysis and judgment of the device's status, thereby identifying potential problems or faults in advance.
[0062] In this embodiment of the invention, the monitoring strategy can be dynamically adjusted according to the actual heartbeat cycle of the device and the design of the circular array, thereby better adapting to the needs of different devices and systems. By obtaining the number of heartbeats and the values of the circular array elements during the process of the device sending heartbeat information, real-time monitoring, precise positioning, and optimized data processing of the device status are achieved, thereby improving system efficiency and user experience, and helping users quickly solve the problem of device status monitoring.
[0063] Reference Figure 2 The diagram illustrates a flowchart of another online device monitoring method provided by an embodiment of the present invention. The method may specifically include the following steps:
[0064] Step 201, configure a loop array; the size of the loop array is greater than the heartbeat cycle;
[0065] The method of this invention can be applied to a system integrated with one or more devices. Configuring the circular array is a key step in the system initialization process. The circular array is designed to store and manage heartbeat information sent by the devices at different times, so that the system can monitor the status of the devices in real time and perform corresponding processing.
[0066] In some instances, the size of the circular array is set to be greater than the heartbeat period. The heartbeat period is the time interval between heartbeat messages sent by the device, usually measured in seconds. By setting the size of the circular array to be greater than the heartbeat period, the system can ensure that there is enough space to store and process this information while the device is sending heartbeat messages.
[0067] For example, if the maximum heartbeat cycle across all devices in the system is 10 seconds, the size of the loop array can be set to 15 seconds or more. This way, even if a device fails to send a heartbeat at some point, the system still has enough buffer space to store previous heartbeat information and continue monitoring the device's status.
[0068] In some instances, it is assumed that the heartbeat period of a device is CYCLE (in seconds), and the array is client[SIZE]. The array size SIZE must be greater than the maximum heartbeat period CYCLE of all devices.
[0069] In some examples, the size of the circular array can be dynamically adjusted according to actual needs. For instance, the system can automatically adjust the size of the circular array based on factors such as the number of devices, heart rate, and system processing power to ensure system performance and stability.
[0070] In some instances, the design of circular arrays can be combined with other techniques, such as data compression and data encryption, to further optimize the efficiency of data storage and processing. For example, the system can compress heartbeat information to reduce storage space usage; at the same time, it can encrypt heartbeat information to ensure data security and privacy.
[0071] Step 202: After configuring the circular array, initialize each element of the circular array to 0;
[0072] In this embodiment of the invention, after configuring the circular array, the system immediately initializes each element in the array. The purpose of this step is to ensure that all elements of the circular array are in a known initial state before recording heartbeat information, thereby avoiding data corruption or errors in subsequent processing.
[0073] In some instances, the system sets the value of each element in the circular array to 0. This operation clears all data from the array, ensuring that each element is initially empty. This way, the system can ensure that all elements are clean and free of any residual data when it begins recording heartbeat information.
[0074] In some examples, the initialization operation may also include resetting the indices of the circular array to ensure that the array indices start from 0. This allows the system to access and update the elements in the array one by one in a predetermined order during subsequent processing.
[0075] In some examples, if no terminal device is online at the current time, the array is initialized so that the value of each element in the array is 0, and the array size is taken as the starting index of the array modulo the current time. Let's assume the initial index is 0.
[0076] Furthermore, initialization operations can be combined with other technical means, such as data verification and data backup, to further improve the reliability and security of the system. For example, the system can verify the elements in the array during initialization to ensure that the value of each element is 0; at the same time, the initialized array can be backed up to prevent data loss or corruption.
[0077] Through these operations, the system can initialize each element in the array immediately after configuring the circular array, thus laying a solid foundation for subsequent heartbeat information recording and device status monitoring.
[0078] Step 203: Update the current element of the circular array once per second, and determine the current number of heartbeats received from the device in a single heartbeat message.
[0079] In this embodiment of the invention, the system can update the current element of the circular array once per second, and simultaneously determine the current number of heartbeats received from the device within that second. This step is designed to ensure that the system can monitor the device's status in real time and make corresponding processing and decisions based on this information.
[0080] In some examples, the system can update the current element of the circular array at fixed intervals every second. The update can either overwrite the current element's value or add new heartbeat information to the current element. In this way, the system can record the heartbeat information sent by the device every second, thus forming a continuous state record.
[0081] In some examples, the system can determine the current number of heartbeats received from the device at fixed points every second. The purpose of this operation is to count how many heartbeats the device has sent within the current second. In this way, the system can understand the device's activity status in real time and take appropriate action based on changes in the number of heartbeats.
[0082] In some examples, when updating the array every second, the array value at the current time is added to the array value at the previous second. That is, client[index] = client[index] + client[index-1]: the array value at the current time is added to the array value at the previous second. client[index-1] = 0: the array value at the previous second is cleared to zero.
[0083] In some examples, the system can also combine other techniques, such as data filtering and data compression, to optimize the processing efficiency of heartbeat information. For example, the system can filter received heartbeat information to remove duplicate or invalid information; at the same time, it can compress heartbeat information to reduce storage space usage.
[0084] In some examples, the system can also automatically adjust the size and update frequency of the circular array based on changes in the number of heartbeats to ensure system performance and stability. For instance, when the number of heartbeats suddenly increases, the system can automatically increase the size of the circular array to accommodate more heartbeat information; at the same time, it can increase the update frequency to ensure the accuracy of real-time monitoring.
[0085] Step 204: If the current heartbeat count is greater than 0, obtain the original value of the current element and the original value of the previous element; use the sum of the current heartbeat count, the original value of the current element, and the original value of the previous element as the current value of the current element; set the value of the previous element to 0; and obtain the original value of the Nth element after the current element; use the difference between the original value of the Nth element after the current element and the current heartbeat count as the current value of the Nth element after the current element; where N is the heartbeat cycle.
[0086] In this embodiment of the invention, when the current heartbeat count is detected to be greater than 0, the system performs a series of specific operations to update the element values in the circular array. This step is designed to ensure that the system can accurately record and process heartbeat information when the device sends it, and to maintain continuous monitoring of the device's status.
[0087] In some examples, when the current heartbeat count is greater than 0, the system first retrieves the original value of the current element and the original value of the previous element. Then, the system adds the current heartbeat count, the original value of the current element, and the original value of the previous element, and uses this sum as the current value of the current element. The purpose of this operation is to accurately record and accumulate heartbeat information as the device sends heartbeat messages, thereby reflecting the real-time status of the device.
[0088] Simultaneously, the system will set the value of the previous element to 0. This operation clears the value of the previous element so that heartbeat information recording can resume in the next time period. In this way, the system ensures that the data for each time period is independent and complete, thereby improving the accuracy and reliability of data processing.
[0089] In addition, the system also retrieves the original value of the Nth element following the current element, where N is the heartbeat cycle. Then, the system uses the difference between the original value of the Nth element following the current element and the current heartbeat count as the current value of the Nth element following the current element. The purpose of this operation is to smooth the heartbeat information within the heartbeat cycle, thereby reducing the impact of data fluctuations on the system.
[0090] In some examples, the system can also combine other technical means, such as anomaly detection algorithms and data smoothing algorithms, to further optimize the processing effect of this step. For example, if the current heartbeat count is greater than 0, the system can automatically trigger anomaly detection mechanism to perform a more in-depth analysis and judgment of the device's status, thereby identifying potential problems or faults in advance.
[0091] In some examples, whenever a heartbeat message from a device is received, the corresponding position in the array is updated: `client[index]++`: Increments the value of the element at index `index` in the `client` array by 1, indicating that a device is currently online. Simultaneously, `client[index+CYCLE]--`: Decrements the value of the element at index `index+CYCLE` in the `client` array by 1, indicating that the device may go offline in `CYCLE` seconds.
[0092] Reference Figure 3 The diagram shows a flowchart illustrating the specific steps of an online device monitoring method.
[0093] Assume all devices have a heartbeat cycle of CYCLE seconds. Assume the heartbeat cycle is 2 seconds, the array size is 8, and the current time is second 1 (index 0). The array indices will cycle between 0 and 7.
[0094] Specifically, the current time is the 1st second, and the index is 0; the 2nd second, the index is 1; the 3rd second, the index is 2, and so on.
[0095] When the index exceeds 7, it will return to 0 and continue the loop.
[0096] Assume the initial value is 0, meaning there are currently no devices online:
[0097] Second 1: Received a heartbeat, client[0]++, client[2]--.
[0098] The value of the array client is: 1, 0, -1, 0, 0, 0, 0, 0
[0099] Update the array: client[0] = client[0] + client[7], client[7] = 0.
[0100] Current number of online devices: client[0] = 1.
[0101] Second 2: Received heartbeat from another device, client[1]++, client[3]--.
[0102] Update the array: client[1] = client[1] + client[0], client[0] = 0.
[0103] Current number of online devices: client[1] = 2.
[0104] In some instances, when different devices have different heartbeat cycles, for example, suppose device 1's heartbeat cycle CYCLE1 is 2 seconds, device 2's heartbeat cycle CYCLE2 is 3 seconds, the array size SIZE is 8, and the current time is the 1st second (index is 0).
[0105] Second 1: Received heartbeat from device 1, client[0]++, client[2]--.
[0106] Update the array: client[0] = client[0] + client[7], client[7] = 0.
[0107] Current number of online devices: client[0] = 1.
[0108] Second 2: Received heartbeat from device 2, client[1]++, client[4]--.
[0109] Update the array: client[1] = client[1] + client[0], client[0] = 0.
[0110] Current number of online devices: client[1] = 2.
[0111] Step 205: If the current heartbeat count is 0, then the sum of the original value of the current element and the original value of the previous element is taken as the current value of the current element; the value of the previous element is set to 0.
[0112] In this embodiment of the invention, when the current heartbeat count is detected to be 0, the system performs a series of specific operations to update the element values in the circular array. This step is designed to ensure that even when the device is not sending heartbeat information, the system can maintain continuous monitoring and recording of the device status through accumulation and reset.
[0113] In some examples, when the current heartbeat count is 0, the system adds the original value of the current element to the original value of the previous element and uses this sum as the current value of the current element. This operation aims to retain and accumulate previous state information even when the device is not sending heartbeats, thus preventing information loss.
[0114] Simultaneously, the system will set the value of the previous element to 0. This operation clears the value of the previous element so that heartbeat information recording can resume in the next time period. In this way, the system ensures that the data for each time period is independent and complete, thereby improving the accuracy and reliability of data processing.
[0115] In some examples, the system can also combine other technical means, such as anomaly detection algorithms, to further optimize the processing effect of this step. For example, the system can automatically trigger anomaly detection mechanism when the current heartbeat count is 0, to perform a more in-depth analysis and judgment of the device's status, thereby identifying potential problems or faults in advance.
[0116] Reference Figure 3 The diagram shows a flowchart illustrating the specific steps of an online device monitoring method.
[0117] Assuming a heartbeat cycle of 2 seconds, an array size of 8, and the first array representing the first second (index 0), if no heartbeat signal is received at the third second (the third array), then the heartbeat count is 0. The specific calculation is as follows:
[0118] If no heartbeat is received, client[2] does not need to be incremented by 1.
[0119] Update array: client[2] = client[2] + client[1], client[1] = 0.
[0120] The current number of online devices is: client[2] = 1.
[0121] Step 206: Determine the number of currently online devices based on the current value of the current element of the circular array; draw an online device trend chart based on the number of currently online devices.
[0122] In this embodiment of the invention, the system determines the number of currently online devices based on the current value of the current element in the circular array. This step is designed to monitor the online status of devices in real time and generate a corresponding online device trend chart based on this information, so that users can intuitively understand the online status and trend changes of the devices.
[0123] In some examples, the system extracts the current value of the current element from a circular array and uses it as the basis for determining the number of currently online devices. This operation aims to accurately reflect the online status of devices at the current point in time. In this way, the system can update the number of online devices in real time, ensuring data accuracy and timeliness.
[0124] Simultaneously, the system will also generate an online device trend chart based on the current number of online devices. This operation aims to graphically display the changing trends in the number of online devices, thereby helping users more intuitively understand the online status and trend changes of the devices.
[0125] Online device trend charts can take various forms, such as line charts, bar charts, and pie charts. These graphs allow users to clearly see the changing trends in the number of online devices, including increases, decreases, and fluctuations. Furthermore, trend charts can display the number of online devices over different time periods, helping users analyze patterns and trends in device online activity.
[0126] In some examples, the system can also combine other technologies, such as data analysis and predictive algorithms, to further optimize the generation of trend charts. For instance, the system can use historical data to predict the number of online devices in the future and display the prediction results in the trend chart, thereby helping users to manage devices and allocate resources in advance.
[0127] In this embodiment of the invention, the monitoring strategy can be dynamically adjusted according to the actual heartbeat cycle of the device and the design of the circular array, thereby better adapting to the needs of different devices and systems. By obtaining the number of heartbeats and the values of the circular array elements during the process of the device sending heartbeat information, real-time monitoring, precise positioning, and optimized data processing of the device status are achieved, thereby improving system efficiency and user experience, and helping users quickly solve the problem of device status monitoring.
[0128] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0129] Reference Figure 4 The diagram shows a structural block diagram of an online equipment monitoring device provided by an embodiment of the present invention, which may specifically include the following modules:
[0130] The circular array configuration module 301 is used to configure circular arrays;
[0131] The current heartbeat count update module 302 is used to update the current element of the circular array once per second, and to determine the current heartbeat count of a single heartbeat message received from the device.
[0132] The first element update module 303 is configured to: if the current heartbeat count is greater than 0, obtain the original value of the current element and the original value of the previous element; use the sum of the current heartbeat count, the original value of the current element, and the original value of the previous element as the current value of the current element; set the value of the previous element to 0; and obtain the original value of the Nth element after the current element; use the difference between the original value of the Nth element after the current element and the current heartbeat count as the current value of the Nth element after the current element; where N is the heartbeat cycle.
[0133] The second element update module 304 is used to, if the current heartbeat count is 0, take the sum of the original value of the current element and the original value of the previous element of the current element as the current value of the current element; and set the value in the previous element to 0.
[0134] In this embodiment of the invention, the device further includes:
[0135] The quantity determination module is used to determine the number of currently online devices based on the current value of the current element of the circular array;
[0136] The trend chart drawing module is used to draw an online device trend chart based on the current number of online devices.
[0137] In this embodiment of the invention, the size of the circular array is greater than the heartbeat cycle.
[0138] In this embodiment of the invention, the device further includes:
[0139] An initialization module is used to initialize each element of the circular array to 0 after the circular array has been configured.
[0140] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0141] This invention also provides an electronic device, comprising:
[0142] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described online monitoring method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0143] This invention also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described online device monitoring method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here.
[0144] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0145] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0146] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0147] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0148] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0149] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.
[0150] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0151] The above provides a detailed description of the online monitoring method, apparatus, electronic device, and medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for online monitoring of equipment, characterized in that, include: Configure a circular array; The current element of the circular array is updated once per second, and the current number of heartbeats received from the device in a single heartbeat message is determined. If the current heartbeat count is greater than 0, obtain the original value of the current element and the original value of the previous element of the current element; The sum of the current heartbeat count, the original value of the current element, and the original value of the previous element is used as the current value of the current element; the value of the previous element is set to 0; and the original value of the Nth element after the current element is obtained. The difference between the original value of the Nth element after the current element and the current heartbeat count is taken as the current value of the Nth element after the current element; where N is the heartbeat cycle. If the current heartbeat count is 0, then the sum of the original value of the current element and the original value of the previous element is taken as the current value of the current element. Set the value of the previous element to 0.
2. The method according to claim 1, characterized in that, Also includes: The number of currently online devices is determined based on the current value of the current element of the circular array; Based on the current number of online devices, draw an online device trend chart.
3. The method according to claim 1, characterized in that, The size of the circular array is greater than the heartbeat cycle.
4. The method according to claim 1, characterized in that, Also includes: After configuring the circular array, initialize each element of the circular array to 0.
5. An online equipment monitoring device, characterized in that, The device includes: The circular array configuration module is used to configure circular arrays; The current heartbeat count update module is used to update the current element of the circular array once per second, and to determine the current heartbeat count of a single heartbeat message received from the device. The first element update module is configured to: if the current heartbeat count is greater than 0, obtain the original value of the current element and the original value of the previous element; use the sum of the current heartbeat count, the original value of the current element, and the original value of the previous element as the current value of the current element; set the value of the previous element to 0; and obtain the original value of the Nth element after the current element; use the difference between the original value of the Nth element after the current element and the current heartbeat count as the current value of the Nth element after the current element; where N is the heartbeat cycle. The second element update module is used to, if the current heartbeat count is 0, take the sum of the original value of the current element and the original value of the previous element of the current element as the current value of the current element; and set the value of the previous element to 0.
6. The apparatus according to claim 5, characterized in that, Also includes: The quantity determination module is used to determine the number of currently online devices based on the current value of the current element of the circular array; The trend chart drawing module is used to draw an online device trend chart based on the current number of online devices.
7. The apparatus according to claim 5, characterized in that, The size of the circular array is greater than the heartbeat cycle.
8. The apparatus according to claim 5, characterized in that, Also includes: An initialization module is used to initialize each element of the circular array to 0 after the circular array has been configured.
9. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the steps of the online monitoring method for a device as described in any one of claims 1-4.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of the online monitoring method for devices as described in any one of claims 1-4.
Citation Information
Patent Citations
Method and device for judging reliability of equipment signal
CN111245946A
Heartbeat task execution method and device of equipment, electronic equipment and storage medium
CN117785403A