Device status synchronization method, device and electronic device

By automatically synchronizing the heartbeat data status of the machine and the central control device status by the monitoring device, the problem of low manual synchronization efficiency is solved and efficient equipment status consistency management is achieved.

CN116436829BActive Publication Date: 2025-09-02BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210001273.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-04
Publication Date
2025-09-02
Estimated Expiration
2042-01-04

AI Technical Summary

Technical Problem

In the prior art, the efficiency of equipment status synchronization through manual methods is low, resulting in an increase in the workload of operation and maintenance personnel.

Method used

The monitoring device receives the heartbeat data of the machine and equipment, analyzes the device status, and compares and synchronizes with the status displayed in the central control device, and automatically adjusts the status of the machine and equipment to maintain consistency.

Benefits of technology

The synchronization of equipment status can be achieved without manual intervention, reducing the workload of operation and maintenance personnel, and improving synchronization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116436829B_ABST
    Figure CN116436829B_ABST
Patent Text Reader

Abstract

The embodiments of the present invention provide a method, apparatus, and electronic device for synchronizing device status, and relate to the field of computer technology. The specific implementation scheme is: when heartbeat data sent by a machine device is received, the device status is parsed from the heartbeat data as the first status; wherein the heartbeat data includes the device status of the machine device itself detected by the machine device; the device status of the machine device displayed in the central control device is obtained as the second status; if there is a difference between the first status and the second status, the device status of the machine device and the device status displayed in the central control device are synchronized. It can be seen that this scheme solves the problem of low synchronization efficiency caused by manual synchronization of device status in related technologies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method and apparatus for synchronizing device status, and an electronic device. Background Art

[0002] Comprehensive management of each device can be achieved through a combination of monitoring and central control devices. Monitoring devices typically monitor each device for abnormalities based on heartbeat data, including health information, reported by each device. They also generate alarms when an abnormality occurs. Central control devices, on the other hand, display the status of each device, allowing operations and maintenance personnel to monitor the status of each device.

[0003] Because the device status displayed on the central control device can be manually modified by maintenance personnel based on actual requirements, and because device anomalies may occur during operation, the device status displayed on the central control device may be inconsistent with the actual device status of the device. To avoid uncertainty risks, the actual device status of the device must be synchronized with the device status displayed on the central control device.

[0004] In the related art, the device status of the machine equipment displayed in the central control device is usually manually analyzed to see whether it is consistent with the actual device status of the machine equipment. If it is inconsistent, the machine equipment or the central control device is manually adjusted to keep the device status of the machine equipment and the device status displayed in the central control device synchronized.

[0005] However, since the device status is synchronized manually in the related art, the synchronization efficiency is low. Summary of the Invention

[0006] The purpose of the embodiments of the present invention is to provide a method, apparatus, and electronic device for synchronizing device status, so as to solve the problem of low synchronization efficiency caused by manual synchronization of device status in related technologies. The specific technical solution is as follows:

[0007] In a first aspect, an embodiment of the present invention provides a method for synchronizing device status, which is applied to a monitoring device. The method includes:

[0008] When receiving heartbeat data sent by a machine device, parsing the heartbeat data to obtain a device state as a first state; wherein the heartbeat data includes the device state detected by the machine device itself;

[0009] Acquire a device status of the machine device displayed on the central control device as a second status;

[0010] If there is a difference between the first state and the second state, the device state of the machine device and the device state displayed in the central control device are synchronized.

[0011] Optionally, the machine device has multiple types of device states, and each type has a different state;

[0012] If there is a difference between the first state and the second state, synchronizing the device state of the machine device with the device state displayed on the central control device includes:

[0013] If the first state and the second state are different types of states, feeding back a state adjustment request for the second state to the machine device, so that the machine device adjusts its state according to the second state;

[0014] If the first state and the second state are different states of the same type, determine a target state that is a stable state among the first state and the second state, and send a state adjustment request for the target state to the target device so that the target device adjusts its state according to the target state; wherein the target device is a device belonging to another state other than the target state.

[0015] Optionally, the heartbeat data also includes health information of the machine equipment;

[0016] Before obtaining the device status of the machine device displayed on the central control device as the second status, the method further includes:

[0017] Determining whether the machine device is abnormal based on the health information in the heartbeat data;

[0018] When the judgment result is no, the device status of the machine device displayed in the central control device is obtained as the second status.

[0019] Optionally, the method further includes:

[0020] When the machine device is determined to be abnormal based on the health information in the heartbeat data, the device state of the machine device displayed on the central control device is adjusted to a third state; and a state adjustment request for the third state is fed back to the machine device, so that the machine device adjusts the device state according to the third state;

[0021] The third state is a state in response to a device abnormality.

[0022] Optionally, obtaining the device status of the machine device displayed on the central control device as the second status includes:

[0023] Obtaining, from a target database, a device status of the machine device as a second status;

[0024] The target database is used to record: the device status of the machine device displayed in the central control device.

[0025] Optionally, the machine device adjusts its state according to the second state, including:

[0026] The machine device adjusts its own device state to the second state by executing the script file for adjusting the device state.

[0027] Optionally, adjusting the device state of the machine device displayed on the central control device to a third state includes:

[0028] A designated interface for modifying the device state of the central control device is called to adjust the device state of the machine device displayed in the central control device to a third state.

[0029] In a second aspect, an embodiment of the present invention provides a device status synchronization apparatus, which is applied to a monitoring device, and the apparatus includes:

[0030] a parsing module configured to, upon receiving heartbeat data sent by a machine device, parse the heartbeat data to obtain a device state as a first state; wherein the heartbeat data includes the device state detected by the machine device itself;

[0031] an acquisition module, configured to acquire, as a second state, a device state of the machine device displayed on the central control device;

[0032] A synchronization module is used to synchronize the device state of the machine device with the device state displayed in the central control device if there is a difference between the first state and the second state.

[0033] Optionally, the machine device has multiple types of device states, and each type has a different state;

[0034] The synchronization module includes:

[0035] a first synchronization unit, configured to feed back a state adjustment request for the second state to the machine device if the first state and the second state are different types of states, so that the machine device adjusts its state according to the second state;

[0036] The second synchronization unit is used to determine a target state that is a stable state between the first state and the second state if the first state and the second state are different states of the same type, and send a state adjustment request for the target state to the target device so that the target device adjusts its state according to the target state; wherein the target device is a device belonging to another state other than the target state.

[0037] Optionally, the heartbeat data also includes health information of the machine equipment; the apparatus further includes:

[0038] A judgment module is used to determine whether the machine device is abnormal based on the health information in the heartbeat data before the acquisition module executes the acquisition of the device status of the machine device displayed in the central control device as the second state; when the judgment result is no, execute the acquisition of the device status of the machine device displayed in the central control device as the second state.

[0039] Optionally, the device further comprises:

[0040] an adjustment module configured to, when determining that the machine device is abnormal based on the health information in the heartbeat data, adjust the device state of the machine device displayed on the central control device to a third state; and feedback a state adjustment request for the third state to the machine device, so that the machine device adjusts the device state according to the third state;

[0041] The third state is a state in response to a device abnormality.

[0042] Optionally, the acquisition module is specifically configured to:

[0043] Obtaining, from a target database, a device status of the machine device as a second status;

[0044] The target database is used to record: the device status of the machine device displayed in the central control device.

[0045] Optionally, the machine device adjusts its state according to the second state, including:

[0046] The machine device adjusts its own device state to the second state by executing the script file for adjusting the device state.

[0047] Optionally, adjusting the device state of the machine device displayed on the central control device to a third state includes:

[0048] A designated interface for modifying the device state of the central control device is called to adjust the device state of the machine device displayed in the central control device to a third state.

[0049] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0050] Memory for storing computer programs;

[0051] The processor is configured to implement any of the above-mentioned steps of the device status synchronization method when executing the program stored in the memory.

[0052] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above-mentioned device status synchronization methods are implemented.

[0053] Beneficial effects of the embodiments of the present invention:

[0054] An embodiment of the present invention provides a method for synchronizing device status. When a monitoring device receives heartbeat data sent by a machine device, it parses the heartbeat data to obtain the device status as a first status. The heartbeat data includes the device status detected by the machine device itself. Then, the device status of the machine device displayed on the central control device is obtained as a second status. If there is a difference between the first status and the second status, the device status of the machine device and the device status displayed on the central control device are synchronized. That is, when the machine device reports heartbeat data, the device status detected by the machine device itself is reported. Moreover, if there is a difference between the device status reported by the machine device and the device status displayed on the central control device, the device status of the machine device and the device status displayed on the central control device are synchronized. It can be seen that in this solution, since there is no need to synchronize the device status manually, the workload of the operation and maintenance personnel is greatly reduced and the synchronization efficiency is improved.

[0055] Of course, it is not necessary to achieve all of the advantages described above simultaneously in order to implement any product or method of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0057] Figure 1 A flowchart of a method for synchronizing device status provided by an embodiment of the present invention;

[0058] Figure 2 Another flow chart of a method for synchronizing device status provided by an embodiment of the present invention;

[0059] Figure 3 A flowchart of a machine device processing provided by an embodiment of the present invention;

[0060] Figure 4 A flowchart of a monitoring device process provided by an embodiment of the present invention;

[0061] Figure 5 Another flow chart of a method for synchronizing device status provided by an embodiment of the present invention;

[0062] Figure 6 A schematic structural diagram of a device status synchronization apparatus provided by an embodiment of the present invention;

[0063] Figure 7 The present invention provides a schematic structural diagram of an electronic device. DETAILED DESCRIPTION

[0064] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field based on this application are within the scope of protection of the present invention.

[0065] First, the professional terms involved in the present invention are explained as follows:

[0066] Central control equipment: displays basic information and equipment status of the machine equipment, and provides an operation page for the equipment status of the machine equipment. Through the operation page, operation and maintenance personnel can make adjustments based on the actual required status.

[0067] Agent: A program deployed on a machine device that can detect device status, start or pause the device, and report device status and health information; it is responsible for executing commands to start or pause the device conveyed by the monitoring end.

[0068] Monitoring device: It is a monitoring service center responsible for collecting device status and health information reported by the agent, analyzing the reported device status and health information, and notifying the machine equipment to perform corresponding operations to start and stop the device.

[0069] Device status: On, Opening, Paused, and Paused. On and Opening are states of the same type, while Paused and Paused are states of the same type. On and Paused are stable states, while Opening and Paused are temporary transition states, unstable states that must eventually return to a stable state. Of course, device status can be set to other types based on actual needs.

[0070] Health information: The agent program on the machine device reports heartbeat data to the monitoring end at regular intervals. The heartbeat data includes health information, which is used to indicate the health status of the machine device's port.

[0071] Redis: An open source data caching service.

[0072] Because the device status displayed on the central control device can be manually modified by maintenance personnel based on actual requirements, and because device anomalies may occur during operation, the device status displayed on the central control device may be inconsistent with the actual device status of the device. To avoid uncertainty risks, the actual device status of the device must be synchronized with the device status displayed on the central control device.

[0073] In the related art, the device status of the machine equipment is not effectively managed in the central control device. In order to synchronize the actual device status of the machine equipment with the device status of the machine equipment displayed in the central control device, it is usually necessary to manually analyze whether the device status of the machine equipment displayed in the central control device is consistent with the actual device status of the machine equipment. If it is inconsistent, the machine equipment or the central control device is manually adjusted to keep the device status of the machine equipment and the device status displayed in the central control device synchronized. For example: after pausing or starting the device, if the operation and maintenance personnel analyze that the device status of the machine equipment displayed in the central control device is inconsistent with the actual device status of the machine equipment, they need to operate the central control device again to adjust the status of the machine equipment in the central control device to the corresponding pause or start state. As a result, the workload of operation and maintenance is increased, and the efficiency of status synchronization is low.

[0074] Based on the above content, in order to solve the problem of low synchronization efficiency caused by synchronizing device status manually, embodiments of the present invention provide a method, apparatus, and electronic device for synchronizing device status.

[0075] Below, a device status synchronization method provided by an embodiment of the present invention is first introduced.

[0076] A device status synchronization method provided by an embodiment of the present invention is applied to a monitoring device, which communicates with a machine device. Exemplarily, the machine device can be different types of servers, such as a cache server, an LVS (Linux Virtual Server) load balancing server, and the like. In a specific application, a monitoring device can communicate with multiple machine devices, and the machine device sends heartbeat data including health information to the monitoring device at intervals of, for example, 15 seconds. The health information is used to indicate the health status of a port in the machine device, and the health status of the port can be represented by different identifiers. For example, 1 can be used to indicate that the port is normal, and -1 can be used to indicate that the port is abnormal.

[0077] The central control device displays basic information and status information for each device, and operations personnel can manually modify the device status displayed on the central control device. If the device status of any device displayed on the central control device is modified, the Redis database used to store the content displayed by the central control device can store the modified device status.

[0078] The embodiment of the present invention provides a method for synchronizing device status, which may include the following steps:

[0079] When receiving heartbeat data sent by a machine device, parsing the heartbeat data to obtain a device state as a first state; wherein the heartbeat data includes the device state detected by the machine device itself;

[0080] Acquire a device status of the machine device displayed on the central control device as a second status;

[0081] If there is a difference between the first state and the second state, the device state of the machine device and the device state displayed in the central control device are synchronized.

[0082] In the solution provided by the embodiments of the present invention, when a machine device reports heartbeat data, it also reports its own device status as detected by the machine device. Furthermore, if there is a discrepancy between the reported device status and the device status displayed on the central control device, the device status of the machine device and the device status displayed on the central control device are synchronized. This solution significantly reduces the workload of operations and maintenance personnel and improves synchronization efficiency, as manual device status synchronization is not required.

[0083] The following describes a method for synchronizing device status provided by an embodiment of the present invention in conjunction with the accompanying drawings.

[0084] like Figure 1As shown, a device status synchronization method provided by an embodiment of the present invention may include the following steps:

[0085] S101, upon receiving heartbeat data sent by a machine device, parsing the heartbeat data to obtain a device state as a first state; wherein the heartbeat data includes the device state detected by the machine device itself;

[0086] In this embodiment, when the machine device reports the heartbeat data, it also reports the device status, that is, the heartbeat data including the device status detected by the machine device itself is reported to the monitoring device. When the monitoring device receives the heartbeat data sent by the machine device, the device status can be parsed from the heartbeat data as the first state. For example, the machine device can send heartbeat data to the monitoring device every 15 seconds. The heartbeat data carries health information and can also include the device status detected by the machine device itself. The monitoring device can parse the heartbeat data reported by the machine device to obtain the device status included in the heartbeat data as the first state. It can be understood that the first state is the actual device state of the machine device. The first state can be an on-state, an on-state, a paused state, a paused state, and so on.

[0087] S102, obtaining a device status of the machine device displayed on the central control device as a second status;

[0088] Because the device status displayed on the central control device must be synchronized with the actual device status of the device, the monitoring device can also obtain the device status displayed on the central control device as the second status after receiving the first status reported by the device. This allows subsequent synchronization operations based on the first and second statuses.

[0089] Optionally, in one implementation, obtaining the device status of the machine device displayed on the central control device as the second status includes:

[0090] The device status of the machine device is obtained from the target database as the second status; wherein the target database is used to record: the device status of the machine device displayed in the central control device.

[0091] In this implementation, the monitoring device has the function of accessing the target database, and the target database records the device status of the machine equipment displayed in the central control device. Therefore, the device status of the machine equipment can be obtained from the target database. Exemplarily, the target database can be a redis database, which is used to store the device status of the machine equipment displayed in the central control device. When the device status of the machine equipment displayed in the central control device is modified, the device status of the machine equipment in the redis database is updated accordingly. In other words, the program that implements the functions provided by the central control device and the redis database are products with separated front-end and back-end, and the program that implements the functions provided by the central control device is a front-end platform for displaying and operating the device status.

[0092] For example, in another implementation, the access interface of the central control device may be called to access the device status of the machine device displayed in the central control device.

[0093] The above-mentioned specific implementation method of obtaining the device status of the machine device displayed in the central control device is only an example and should not constitute a limitation to the embodiments of the present invention.

[0094] S103: If there is a difference between the first state and the second state, synchronize the device state of the machine device with the device state displayed in the central control device.

[0095] That is, when the actual device status of the machine device is inconsistent with the device status displayed in the central control device, the device status of the machine device needs to be synchronized with the device status displayed in the central control device.

[0096] Optionally, in one implementation, the machine device has multiple types of device states, and each type has a different state;

[0097] Exemplarily, a machine device may have an on type and a pause type device state, wherein the on type includes an on state and an on state, and the pause type includes a pause state and a pause state.

[0098] If there is a difference between the first state and the second state, the device state of the machine device and the device state displayed in the central control device are synchronized, including steps A1-A2:

[0099] A1: If the first state and the second state are different types of states, feeding back a state adjustment request for the second state to the machine device, so that the machine device adjusts its state according to the second state;

[0100] Exemplarily, if the first state is an on or on-state, and the second state is a pause or a paused state, the first state and the second state are different types of states.

[0101] That is, if the first state and the second state are of different types, the device state of the machine device is adjusted based on the second state, so that the device state of the machine device itself is synchronized with the device state displayed in the central control device. It is understandable that since the central control device is used to display and operate the device state of the machine device, usually, the operation and maintenance personnel manage the machine device by modifying the device state of the machine device displayed in the central control device. Therefore, after modifying the device state of the machine device displayed in the central control device, the device state of the machine device displayed in the central control device will be different from the actual device state of the machine device, and the type of state will be different. At this time, the actual device state of the machine device needs to be synchronized with the device state of the machine device displayed in the central control device.

[0102] Optionally, in one implementation, the machine device adjusts its state according to the second state, including:

[0103] The machine device adjusts its own device state to the second state by executing the script file for adjusting the device state.

[0104] After the machine device receives the state adjustment request for the second state fed back by the monitoring device, it can compare the second state with the local state of the machine device, that is, compare the second state with the actual device state of the machine device. If they are inconsistent, the corresponding script file can be executed to adjust its own device state to the second state. For example, if the second state is the on state and the first state is the pause state, the machine device can execute the script file for turning on the device state and adjust its own device state to the on state; for example, if the second state is the pause state and the first state is the on state, the machine device can execute the script file for pausing the device state and adjust its own device state to the pause state. It should be noted that when the script file for turning on or pausing the device state is running, the machine device is in the on or pause state. After the operation is completed, the machine device is in the on or pause state. That is, the on and pause states are intermediate transition states and are unstable states.

[0105] A2. If the first state and the second state are different states of the same type, determine a target state that is a stable state between the first state and the second state, and send a state adjustment request for the target state to the target device so that the target device adjusts its state according to the target state; wherein the target device is a device belonging to another state other than the target state.

[0106] Exemplarily, if the first state is the on state, and the second state is the on state, the first state and the second state are different states of the same type.

[0107] It is understood that when a machine device is running a script file for enabling or pausing the device state, the machine device is in an unstable state of being enabled or paused. Once the script file is successfully executed, the machine device enters a stable state of being enabled or paused. Therefore, if the first state and the second state are different states of the same type, the state of the device in the unstable state will be adjusted based on the target state that is the stable state.

[0108] For example, if the first state is a pause state and the second state is a paused state, the first state is used as the target state, the central control device to which the second state belongs is adjusted, and the device state of the machine device displayed in the central control device is modified to a pause state.

[0109] It should be emphasized that the above-mentioned specific implementation method of synchronizing the device status of the machine device and the device status displayed in the central control device is only an example and should not constitute a limitation on the embodiments of the present invention.

[0110] In the solution provided by the embodiments of the present invention, when a machine device reports heartbeat data, it also reports its own device status as detected by the machine device. Furthermore, if there is a discrepancy between the reported device status and the device status displayed on the central control device, the device status of the machine device and the device status displayed on the central control device are synchronized. This solution significantly reduces the workload of operations and maintenance personnel and improves synchronization efficiency, as manual device status synchronization is not required.

[0111] Optionally, in another embodiment of the present invention, the heartbeat data further includes health information of the machine device; wherein the health information is information used to indicate the health status of a port of the machine device.

[0112] Before obtaining the device status of the machine device displayed by the central control device as the second status, the method further includes:

[0113] Determine whether the machine device is abnormal based on the health information in the heartbeat data;

[0114] When the judgment result is no, obtaining the device status of the machine device displayed by the central control device as the second status;

[0115] The heartbeat data is the heartbeat data currently received by the monitoring device.

[0116] There are various implementations for determining whether the machine device is abnormal based on the health information in the heartbeat data. For example, determining whether the machine device is abnormal based on the health information in the heartbeat data may be as follows: if the health information in the currently received heartbeat data is abnormal, and the time interval between the timestamp recorded when the abnormal health information is currently received and the timestamp recorded when the abnormal health information was last received reaches a preset threshold, then the machine device is abnormal.

[0117] Exemplarily, judging whether the machine device is abnormal based on the health information in the heartbeat data can also be: recording each time the health information in the heartbeat data is abnormal, and when the health information in the currently received heartbeat data is abnormal, judging whether the recorded number of times the health information is received abnormally reaches a preset threshold, and if so, determining that the machine device is abnormal.

[0118] It is understandable that the monitoring device can be used to monitor the health status of each port of the machine device. If the health information of the machine device is normal, the actual device status of the machine device is synchronized with the device status of the machine device displayed in the central control device. If the health information of the machine device is abnormal, the abnormal device needs to be processed. Therefore, the present invention can also analyze the health information in the heartbeat data before obtaining the device status of the machine device displayed by the central control device as the second state. If the heartbeat data is normal, the above steps S102-S103 are executed. If the heartbeat data is abnormal, the processing flow of the following steps S201-S202 can also be entered. Thus, while achieving device status synchronization, when the monitoring device finds an abnormal device, the abnormal device can be automatically processed, thereby further reducing the workload of the operation and maintenance personnel.

[0119] like Figure 2 As shown, when the machine device is determined to be abnormal based on the health information in the heartbeat data, steps S201-S202 are executed:

[0120] S201, adjusting the device state of the machine device displayed on the central control device to a third state;

[0121] When an abnormality of a machine device is identified, the monitoring device adjusts the device state of the machine device displayed in the central control device to the third state, so that the abnormal device can be processed through a subsequent state synchronization process.

[0122] Optionally, in one implementation, adjusting the device state of the machine device displayed on the central control device to a third state includes:

[0123] A designated interface for modifying the device state of the central control device is called to adjust the device state of the machine device displayed in the central control device to a third state.

[0124] That is, the monitoring device can modify the status of the machine device displayed in the central control device by calling the specified interface. It should be noted that after the device status displayed in the central control device is modified, the target database used to record the device status displayed in the central control device will also be updated.

[0125] Among them, the third state is a state in response to a device abnormality. If the machine device is found to be an abnormal device through analysis of the heartbeat data, the machine device can be suspended. Exemplarily, the third state can be a suspended state. At this time, the device state of the machine device displayed in the central control device can be first modified to a suspended state, and then a state adjustment instruction for the suspended state can be sent to the machine device, so that after receiving the state adjustment instruction, the machine device executes a script file for pausing the device state. When the script file is run, the machine device is in a suspended state, thereby achieving synchronization with the device state displayed in the central control device.

[0126] S202: Feedback a state adjustment request for the third state to the machine device, so that the machine device adjusts the device state according to the third state.

[0127] In this embodiment, after the device status of the abnormal machine device displayed in the central control device is adjusted to the third state through step S201, the third state is fed back to the machine device, so that the machine device adjusts the device status after receiving the status adjustment request for the third state, thereby realizing automated monitoring and status synchronization operations, reducing the workload of operation and maintenance personnel, and improving the efficiency of status synchronization.

[0128] It should be noted that when it is necessary to turn on or pause a machine device, the device status displayed in the central control device can be modified, and the device status of the machine device can be synchronized. In actual applications, the status in the central control device can first be modified to the on or paused state. When the machine device receives the on or paused status feedback from the monitoring device, the script file for turning on or pausing the device status is executed. During the execution of the script file, the machine device is in the on or paused state, thereby keeping synchronization with the device status displayed in the central control device. Then, after the script file runs successfully, the status of the machine device is changed to a stable state of on or pause; at this time, when the heartbeat data is reported next time, the monitoring device receives the on or paused status reported by the machine device, and adjusts the unstable state of on or pause displayed in the central control device to a stable state of on or pause. Therefore, when the machine device executes the script file for starting or pausing, the central control device displays the starting or pausing status. After the machine device completes executing the script file for starting or pausing, that is, when the device status is successfully started or paused, the central control device displays the stable state of starting or pausing, thereby realizing real-time synchronization between the actual device status of the machine device and the device status displayed in the central control device, and the status synchronization is more accurate.

[0129] For example, after identifying a machine device as an abnormal device, the monitoring device calls the designated interface for modifying the device status of the central control device, modifies the status of the machine device displayed on the central control device to paused. Then, a state adjustment request for the paused state is sent to the machine device, so that after receiving the state adjustment request, the machine device identifies whether its own state is paused. If not, the script file for pausing the device is executed, so that the state of the machine device is adjusted to paused. After the script file is executed, the state of the machine device changes to paused. Then, when the next heartbeat data is reported, after receiving the paused state reported by the machine device, the monitoring device compares it with the device status displayed on the central control device. If it finds that they are inconsistent and belong to the same type, it calls the designated interface for adjusting the device status of the central control device and adjusts the device status displayed on the central control device to paused. In this way, the device status of the machine device displayed on the central control device is synchronized with the actual device status of the machine device.

[0130] In addition, it is worth mentioning that, based on the above embodiment, the embodiment of the present invention may further include:

[0131] Detect whether the number of abnormal machines and equipment exceeds the preset threshold; if so, send an alarm message.

[0132] That is, when an abnormality in a machine or equipment is identified, the abnormal machine or equipment is counted. When the number of abnormal machine or equipment reaches a preset threshold, for example, half of the total number of machine or equipment, an alarm message can be sent to the operation and maintenance platform so that the operation and maintenance personnel can handle the abnormal machine or equipment in a timely manner after viewing the alarm message through the operation and maintenance platform.

[0133] As can be seen, this solution allows us to synchronize the device status when the equipment is operating normally, ensuring the effectiveness of synchronization. Furthermore, when the monitoring device detects an abnormality in the equipment, different processing methods are used, making the synchronization of the device status more comprehensive.

[0134] In order to better understand this solution, Figure 3 、 Figure 4 and Figure 5 The processing flow of the embodiment of the present invention is introduced.

[0135] In this solution, the agent reports device status and health information to the server every 15 seconds. If the machine device is deemed normal based on the agent's reported information, the server retrieves the device status displayed by the central control device and returns it to the agent. The agent then compares the local device status with the device status displayed by the central control device. If they are inconsistent, the machine device status and the device status displayed by the central control device are synchronized. The agent corresponds to the machine device in the above-mentioned embodiment, and the server corresponds to the monitoring device in the above-mentioned embodiment.

[0136] In addition, the agent's functions include:

[0137] (1) Process survival monitoring is specified: nginx port monitoring and squid port monitoring. Both nginx and squid are cache servers. When started, the corresponding nginx and squid ports are opened, respectively. Whether the ports are normal indicates whether the cache server is normal. It should be noted that the nginx and squid ports are examples of ports that can indicate whether a device is normal. Of course, other ports can also be monitored, and this is not limited in the present embodiment.

[0138] (2) Heartbeat maintenance with the server: execute the instructions issued by the server, send heartbeat data to the server, and synchronize the device status displayed in the central control device;

[0139] (3) Run the script to start or pause the device state;

[0140] (4) Report port monitoring results to the server;

[0141] The server-side functions are:

[0142] (1) Heartbeat maintenance with the agent: sending instructions to the agent and receiving heartbeat data sent by the agent;

[0143] (2) Modify the device status displayed in the central control device;

[0144] (3) Receive the port monitoring results reported by the agent;

[0145] (4) Provide API (Application Programming Interface) to query the survival status of all current agent terminals.

[0146] Figure 3 The processing flow on the agent side is shown, including the following steps:

[0147] (1) Detecting the ports of the machine device; wherein the detected ports may be one or more of the ports such as nginx port and squid port;

[0148] (2) Report the inspection results to the server;

[0149] (3) The device status returned by the response server; that is, the device status of the agent displayed in the central control device returned by the response server;

[0150] (4) Compare the returned device status with the local status of the agent;

[0151] (5) If the returned device status is inconsistent with the local status, and the returned device status is the on type status, then execute the active script to turn on the machine device; if the returned device status is the pause type status, then execute the deactive script to pause the machine device;

[0152] (6) If the local status is the same as the device status returned by the server, the process ends and the above steps are repeated every 15 seconds.

[0153] Figure 4 The server-side processing flow is shown, including the following steps:

[0154] (1) The server receives the heartbeat data reported by the agent;

[0155] (2) Update heartbeat data;

[0156] (3) Determine whether there is abnormal data in the heartbeat data;

[0157] (4) If there is abnormal data, combine the heartbeat data reported in the past to detect whether the number of abnormalities reaches the preset threshold; if there is no abnormal data, execute step (8);

[0158] (5) If the number of abnormalities reaches a preset threshold, modify the device status displayed in the central control device, that is, display the device status displayed in the central control device as a state in response to the device abnormality; if the number of abnormalities does not reach the preset threshold, execute step (8);

[0159] (6) Check whether the global equipment failure rate exceeds half;

[0160] (7) If the global device failure rate exceeds half, send an alarm; otherwise, execute step (8);

[0161] (8) Return the device status displayed in the central control device to the agent.

[0162] Figure 5 A flow chart for implementing an embodiment of the present invention is shown, including:

[0163] After receiving the heartbeat data reported by the agent, the server updates the reported data; then, it obtains the device status displayed in the central control device from the Redis database; and sends the status adjustment instruction for the obtained device status to the agent, so that the agent responds to the instruction.

[0164] The server traverses the database used to store heartbeat data, such as the list of heartbeat data belonging to each machine device stored in the Redis database, and checks the heartbeat data of each machine device; then, it determines whether the machine device is faulty; if so, the device is to be suspended; if not, the process ends;

[0165] If the machine device is a device to be suspended, it will enter the queue of devices to be suspended. When the consumer needs to suspend the device, the interface for suspending the device status of the machine device in the central control device is called to change the device status of the machine device displayed in the central control device to the suspended state.

[0166] It can be seen that this solution can better synchronize and monitor the device status of all machines and equipment. When a machine device is disconnected from the network, fails, or crashes, resulting in the machine device being unable to report heartbeat data, or when an abnormality occurs in a port of the machine device and the reported heartbeat data is abnormal data, the server side updates the device status displayed in the central control device by analyzing the received abnormal heartbeat data or the heartbeat data timeout. The agent side executes the start or pause operation of the corresponding script according to the device status displayed in the central control device, thereby realizing the function of automatic management of equipment, reducing the workload of operation and maintenance, and increasing the efficiency of operation and maintenance. In addition, when the suspended machine device exceeds a certain threshold, an alarm is processed and the operation and maintenance personnel are notified immediately to handle it, which increases the security of the production environment.

[0167] Corresponding to the above method embodiment, the embodiment of the present invention further provides a device state synchronization device, which is applied to monitoring equipment, such as Figure 6 As shown, the device includes:

[0168] The parsing module 610 is configured to, upon receiving heartbeat data sent by a machine device, parse the heartbeat data to obtain a device state as a first state; wherein the heartbeat data includes the device state detected by the machine device itself;

[0169] An acquisition module 620 is configured to acquire a device status of the machine device displayed on the central control device as a second status;

[0170] The synchronization module 630 is configured to synchronize the device state of the machine device with the device state displayed in the central control device if there is a difference between the first state and the second state.

[0171] Optionally, the machine device has multiple types of device states, and each type has a different state;

[0172] The synchronization module includes:

[0173] a first synchronization unit, configured to feed back a state adjustment request for the second state to the machine device if the first state and the second state are different types of states, so that the machine device adjusts its state according to the second state;

[0174] The second synchronization unit is used to determine a target state that is a stable state between the first state and the second state if the first state and the second state are different states of the same type, and send a state adjustment request for the target state to the target device so that the target device adjusts its state according to the target state; wherein the target device is a device belonging to another state other than the target state.

[0175] Optionally, the heartbeat data also includes health information of the machine equipment; the apparatus further includes:

[0176] A judgment module is used to determine whether the machine device is abnormal based on the health information in the heartbeat data before the acquisition module executes the acquisition of the device status of the machine device displayed in the central control device as the second state; when the judgment result is no, execute the acquisition of the device status of the machine device displayed in the central control device as the second state.

[0177] Optionally, the device further comprises:

[0178] an adjustment module configured to, when determining that the machine device is abnormal based on the health information in the heartbeat data, adjust the device state of the machine device displayed on the central control device to a third state; and feedback a state adjustment request for the third state to the machine device, so that the machine device adjusts the device state according to the third state;

[0179] The third state is a state in response to a device abnormality.

[0180] Optionally, the acquisition module is specifically configured to:

[0181] Obtaining, from a target database, a device status of the machine device as a second status;

[0182] The target database is used to record: the device status of the machine device displayed in the central control device.

[0183] Optionally, the machine device adjusts its state according to the second state, including:

[0184] The machine device adjusts its own device state to the second state by executing the script file for adjusting the device state.

[0185] Optionally, adjusting the device state of the machine device displayed on the central control device to a third state includes:

[0186] A designated interface for modifying the device state of the central control device is called to adjust the device state of the machine device displayed in the central control device to a third state.

[0187] The embodiment of the present invention further provides an electronic device, such as Figure 7 As shown, it includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704.

[0188] Memory 703, for storing computer programs;

[0189] The processor 701 is configured to implement the steps of any device status synchronization method provided above in the embodiment of the present invention when executing the program stored in the memory 703 .

[0190] The communication bus mentioned in the electronic device mentioned above may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.

[0191] The communication interface is used for communication between the above electronic device and other devices.

[0192] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.

[0193] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.

[0194] In another embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed by a processor, the steps of the above-mentioned method for synchronizing the status of any device are implemented.

[0195] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is executed on a computer, the computer executes any one of the device status synchronization methods in the above embodiments.

[0196] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).

[0197] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.

[0198] Each embodiment in this specification is described in a related manner. Similar parts between the embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences from other embodiments. In particular, the device embodiments are generally similar to the method embodiments, so the description is relatively simple. For related parts, refer to the description of the method embodiments.

[0199] The above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention are included in the scope of protection of the present invention.

Claims

1. A method for synchronizing device status, characterized in that: Applied to monitoring equipment, the method includes: When receiving heartbeat data sent by a machine device, parsing the heartbeat data to obtain a device state as a first state; wherein the heartbeat data includes the device state detected by the machine device itself; Obtaining a device status of the machine device displayed on the central control device as a second status; If there is a difference between the first state and the second state, synchronizing the device state of the machine device with the device state displayed on the central control device; The machine equipment has multiple types of equipment states, and each type has different states; If there is a difference between the first state and the second state, synchronizing the device state of the machine device with the device state displayed on the central control device includes: If the first state and the second state are different types of states, feeding back a state adjustment request for the second state to the machine device, so that the machine device adjusts its state according to the second state; If the first state and the second state are different states of the same type, determine a target state that is a stable state among the first state and the second state, and send a state adjustment request for the target state to the target device so that the target device adjusts its state according to the target state; wherein the target device is a device belonging to another state other than the target state.

2. The method according to claim 1, characterized in that The heartbeat data also includes health information of the machine equipment; Before obtaining the device status of the machine device displayed on the central control device as the second status, the method further includes: Determining whether the machine device is abnormal based on the health information in the heartbeat data; When the judgment result is no, the device status of the machine device displayed in the central control device is obtained as the second status.

3. The method according to claim 2, characterized in that The method further comprises: When the machine device is determined to be abnormal based on the health information in the heartbeat data, the device state of the machine device displayed on the central control device is adjusted to a third state; and a state adjustment request for the third state is fed back to the machine device, so that the machine device adjusts the device state according to the third state; The third state is a state in response to a device abnormality.

4. The method according to claim 1, wherein The acquiring, as the second state, the device state of the machine device displayed on the central control device includes: Obtaining, from a target database, a device status of the machine device as a second status; The target database is used to record: the device status of the machine device displayed in the central control device.

5. The method according to claim 1, characterized in that The machine device adjusts its state according to the second state, including: The machine device adjusts its own device state to the second state by executing the script file for adjusting the device state.

6. The method according to claim 3, characterized in that The adjusting the device state of the machine device displayed on the central control device to the third state includes: A designated interface for modifying the device state of the central control device is called to adjust the device state of the machine device displayed in the central control device to a third state.

7. A device state synchronization device, characterized in that: Applied to monitoring equipment, the device comprises: a parsing module configured to, upon receiving heartbeat data sent by a machine device, parse the heartbeat data to obtain a device state as a first state; wherein the heartbeat data includes the device state detected by the machine device itself; an acquisition module, configured to acquire, as a second state, a device state of the machine device displayed on the central control device; A synchronization module, configured to synchronize the device state of the machine device with the device state displayed in the central control device if there is a difference between the first state and the second state; The machine equipment has multiple types of equipment states, and each type has different states; The synchronization module includes: a first synchronization unit, configured to feed back a state adjustment request for the second state to the machine device if the first state and the second state are different types of states, so that the machine device adjusts its state according to the second state; The second synchronization unit is used to determine a target state that is a stable state between the first state and the second state if the first state and the second state are different states of the same type, and send a state adjustment request for the target state to the target device so that the target device adjusts its state according to the target state; wherein the target device is a device belonging to another state other than the target state.

8. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory for storing computer programs; A processor is configured to implement the steps of the device status synchronization method according to any one of claims 1 to 6 when executing a program stored in a memory.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the device status synchronization method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Equipment control method, device and system, electronic device and storage medium

    CN110062197A

  • Fault detection method and server

    CN112671603A