Alarm aggregation reporting method, device, computer equipment and storage medium
By selecting and managing the master node in the preset database and aggregating the alarm information according to the alarm strategy for reporting, the problem of overflow of alarms is solved, and the effectiveness and efficiency of alarms is improved.
Patent Information
- Application Number
- CN202210492860.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-07
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2042-05-07
AI Technical Summary
The flood of alarms in the prior art has led to the flooding of serious alarms, reducing the overall effectiveness of alarms and increasing the cost of sending massive alarm information.
By checking regularly whether there is a master node in the preset database, if it does not exist, select the slave node as the master node and set the valid lease time; if the master node meets the renewal conditions, reset the lease period and receive it within the valid lease period. When alarm information is reported according to the alarm strategy.
The number of alarms is reduced, the overall effectiveness of alarms is improved, and the timely detection and handling of serious alarms is ensured.
Smart Images

Figure CN114827168B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of alarm technology, and in particular to an alarm aggregation reporting method, device, computer equipment and storage medium. Background Art
[0002] With the development of Internet technology, microservice architecture has gradually become the mainstream in Internet architecture. Correspondingly, the alarm service architecture that adapts to the microservice architecture is also constantly evolving. The main problem with the alarm service in the existing technology is alarm flooding. Alarm flooding refers to the generation of massive alarms in a short period of time. On the one hand, alarm flooding will cause serious alarms to be overwhelmed by general alarms, resulting in operation and maintenance personnel unable to find faults; on the other hand, it will increase the cost of sending massive alarm information, thereby reducing the overall effectiveness of the alarm. Summary of the invention
[0003] The embodiments of the present invention provide an alarm aggregation reporting method, an apparatus, a computer device and a storage medium, aiming to solve the problem of low overall effectiveness of existing alarms.
[0004] In a first aspect, an embodiment of the present invention provides an alarm aggregation reporting method, which includes:
[0005] Regularly query whether there is a master node in the preset database;
[0006] If the master node does not exist in the preset database, a slave node is selected from multiple slave nodes as the master node through the optimistic locking mechanism of the preset database, and the effective lease time of the master node is set to the preset lease time;
[0007] If the master node exists in the preset database, periodically query whether the master node meets the renewal condition;
[0008] If the master node meets the renewal condition, the current time is obtained, and the effective lease time is reset according to the current time and the preset lease time;
[0009] If the master node receives alarm information within the valid lease period, the master node aggregates the alarm information according to the alarm strategy within a preset alarm aggregation time to obtain aggregate information, and reports the aggregate information to relevant personnel.
[0010] In a second aspect, an embodiment of the present invention further provides an alarm aggregation reporting device, which includes:
[0011] A first query unit, used for periodically querying whether a master node exists in a preset database;
[0012] A selection unit, configured to select a slave node from multiple slave nodes as the master node through an optimistic locking mechanism of the preset database if the master node does not exist in the preset database, and set the effective lease time of the master node to a preset lease time;
[0013] A second query unit, configured to periodically query whether the master node satisfies a renewal condition if the master node exists in the preset database;
[0014] A setting unit, configured to obtain a current time if the master node meets the renewal condition, and reset the effective lease time according to the current time and the preset lease time;
[0015] The aggregation reporting unit is used to aggregate the alarm information according to the alarm strategy within the preset alarm aggregation time to obtain aggregate information if the master node receives the alarm information within the valid lease period, and report the aggregate information to relevant personnel.
[0016] In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.
[0017] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and the computer program can implement the above method when executed by a processor.
[0018] The embodiment of the present invention provides an alarm aggregation reporting method, device, computer equipment and storage medium. The method includes: regularly querying whether there is a master node in the preset database; if the master node does not exist in the preset database, selecting a slave node from multiple slave nodes as the master node through the optimistic locking mechanism of the preset database, and setting the effective lease time of the master node to the preset lease time; if the master node exists in the preset database, regularly querying whether the master node meets the renewal condition; if the master node meets the renewal condition, obtaining the current time, and resetting the effective lease time according to the current time and the preset lease time; if the master node receives alarm information within the effective lease time, the alarm information is aggregated according to the alarm strategy within the preset alarm aggregation time to obtain aggregate information, and the aggregate information is reported to relevant personnel. The technical solution of the embodiment of the present invention first selects a slave node from multiple nodes as the master node, and sets the effective lease time for the master node; then aggregates the received alarm information through the alarm strategy within the effective lease time of the master node, which can reduce the number of alarms and improve the overall effectiveness of the alarm. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0020] Figure 1 A flowchart of an alarm aggregation reporting method provided by an embodiment of the present invention;
[0021] Figure 2 A schematic block diagram of an alarm aggregation reporting device provided by an embodiment of the present invention; and
[0022] Figure 3 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0023] The following will be combined with the 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 described embodiments are 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 without creative work are within the scope of protection of the present invention.
[0024] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0025] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0026] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0027] As used in this specification and the appended claims, the term "if" may be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrases "if it is determined" or "if [described condition or event] is detected" may be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0028] See also Figure 1 , Figure 1 It is a flowchart of the alarm aggregation reporting method provided by an embodiment of the present invention. The alarm aggregation reporting method of the embodiment of the present invention can be applied to terminals, such as smart phones, laptops, desktop computers, notebook computers and other intelligent terminal devices, and the alarm aggregation reporting method is implemented by software installed on the server, thereby reducing the number of alarms and improving the overall effectiveness of alarms. The alarm aggregation reporting method is described in detail below. Figure 1 As shown, the method includes the following steps S100-S140.
[0029] S100, periodically query whether there is a master node in the preset database.
[0030] In an embodiment of the present invention, before aggregating the alarm information to obtain aggregate information and reporting the aggregate information, it is necessary to first periodically query whether there is a master node in the preset database, wherein the preset database is a TDSQL database. It should be noted that in an embodiment of the present invention, querying whether there is a master node in the TDSQL database means querying whether the number of the master nodes is 0 or whether the lease of the master node has expired.
[0031] S110: If the master node does not exist in the preset database, a slave node is selected from multiple slave nodes as the master node through the optimistic locking mechanism of the preset database, and the effective lease time of the master node is set to the preset lease time.
[0032] In an embodiment of the present invention, if the master node does not exist in the preset database, indicating that the number of master nodes is 0 or the lease of the master node has expired, a slave node is selected from multiple slave nodes as the master node through the optimistic locking mechanism of the TDSQL database. Specifically, if the master node does not exist in the TDSQL database, each slave node will send the IP address and port information to the TDSQL database to register in the TDSQL database, and the TDSQL database only allows one slave node to register successfully through the optimistic locking mechanism, and notifies the slave node whether the registration is successful through the return value. Understandably, in actual applications, if the return value received by the slave node is Master, indicating that the slave node is successfully registered, the slave node is used as the master node; if the return value received by the slave node is Slave, indicating that the slave node is registered and identified, the slave node continues to be used as the slave node. After selecting a slave node from multiple slave nodes as the master node, it is also necessary to set the effective lease time of the master node to the preset lease time, wherein the preset lease time is 60s.
[0033] It should be noted that, in an embodiment of the present invention, after the effective lease time is set for the master node, the multiple slave nodes will also periodically query whether the lease of the master node exceeds the preset lease time; if the lease of the master node exceeds the preset lease time, indicating that the master node does not exist in the preset database, then the process returns to execute the step of periodically querying whether the master node exists in the preset database to reselect a new master node.
[0034] S120: If the master node exists in the preset database, periodically query whether the master node meets the renewal condition.
[0035] In an embodiment of the present invention, if the master node exists in the preset database, indicating that the number of the master nodes is not 0 and the lease of the master node has not expired, the master node is periodically queried to see whether it meets the renewal condition, wherein the renewal condition is that the effective lease time of the master node is less than the preset renewal time threshold. It should be noted that in an embodiment of the present invention, the value of the preset renewal time threshold is related to the periodic query renewal time. For example, if the periodic query renewal time is 10s, the preset renewal time needs to be set to be greater than 10s, that is, it is necessary to ensure that the master node is renewed before the lease of the master node expires.
[0036] S130: If the master node meets the renewal condition, obtain the current time, and reset the effective lease time according to the current time and the preset lease time.
[0037] In an embodiment of the present invention, if the master node meets the renewal condition, the current time is obtained, and the preset lease time is added to the current time to obtain the effective lease time of the master node. Specifically, for example, if the current time is 12:12 on April 1, 2022, and the preset lease time is 60s, that is, 1 minute, then the preset lease time is 12:13 on April 1, 2022.
[0038] S140. If the master node receives alarm information within the valid lease period, the alarm information is aggregated according to the alarm strategy within a preset alarm aggregation time to obtain aggregate information, and the aggregate information is reported to relevant personnel.
[0039] In an embodiment of the present invention, if the master node receives alarm information within the valid lease period, the alarm strategy is identified according to a preset strategy identifier. It can be understood that the master node can receive the alarm information sent from the slave node, and can also directly receive the alarm information sent from the business service; if the alarm strategy is the first alarm strategy, the alarm information is aggregated according to the first alarm strategy within the preset alarm aggregation time to obtain aggregated information, wherein the preset alarm aggregation time is 60s, and the first alarm strategy is the default alarm strategy; if the alarm strategy is If the second alarm strategy is used, the alarm information is aggregated according to the second alarm strategy within the preset alarm aggregation time to obtain the aggregated information, wherein the second alarm strategy is a threshold alarm strategy, which is applicable to alarm scenarios where the urgency of the alarm is not high and it is necessary to continuously pay attention to the alarm information within a period of time; if the alarm strategy is a third alarm strategy, the alarm information is aggregated according to the third alarm strategy within the preset alarm aggregation time to obtain the aggregated information, wherein the third alarm strategy is a multiple alarm strategy, which is applicable to application scenarios where the urgency of the alarm is moderate. It should be noted that in the embodiment of the present invention, the aggregated information reports information such as the number of alarms, the time of the last alarm, and the cause of the alarm.
[0040] Furthermore, the first alarm strategy is specifically to determine whether the alarm information is received for the first time; if the alarm information is received for the first time, the time when the alarm information is received is used as the start alarm time, for example, 12:30 on April 1, 2022, and the alarm number is set to 1; if the alarm information is not received for the first time and is within the preset alarm aggregation time, the alarm number is updated and the alarm number is compared with the first alarm number threshold, wherein the first alarm number threshold N1 is 5; if the alarm number is not greater than the first alarm number threshold, the alarm number is received. The received alarm information is reported to the relevant personnel; on the contrary, if the number of alarms is greater than the first alarm number threshold, the received alarm information is saved, that is, the alarm information corresponding to the number of alarms greater than the first alarm number threshold during the time period from 12:30 on April 1, 2022 to 12:31 on April 1, 2022 is saved; after the preset alarm aggregation time of 60s is reached, the time after the preset alarm aggregation time from the start alarm time is used as the alarm end time, for example, 12:31 on April 1, 2022 The alarm aggregation time is calculated based on the alarm end time and the difference between the alarm end time and the last alarm information time within the preset alarm aggregation time to obtain the time difference. If the time difference is 10s and the preset time threshold is 20s, when the time difference 10s is less than the preset time threshold 20s, it indicates that the alarm is still continuing, and the preset alarm aggregation time is reassigned to 120s, and the alarm information received from the alarm end time and within the preset alarm aggregation time period is saved, that is, the alarm information from 12:31 on April 1, 2022 to April 2022 is saved. The alarm information received within the time period of 12:32 on January 1; the alarm end time is taken as the start alarm time, and after returning to execute the preset alarm aggregation time, the time after the preset alarm aggregation time from the start alarm time is taken as the alarm end time; the loop is executed until the time difference is not less than the preset time threshold, for example, the time difference is 25s and is greater than the preset time threshold 20s, then all the alarm information that has not been reported is aggregated to obtain aggregate information, and the aggregate information is reported to relevant personnel. It can be understood that the second alarm strategy needs to report N1 plus 1 alarm.
[0041] Furthermore, the second alarm strategy specifically counts the number of received alarm information within the preset alarm aggregation time to obtain the total number of alarms; if the total number of alarms is greater than the second alarm number threshold, the alarm information is aggregated to obtain the aggregate information, wherein the second alarm number threshold is 5, and the aggregate information is reported to relevant personnel. It is understandable that the second alarm strategy only needs to report an alarm once.
[0042] Furthermore, the third alarm strategy specifically counts the number of alarms from the time when the first alarm information is received within the preset alarm aggregation time; if the number of alarms is a multiple of the third alarm number threshold, wherein the third alarm number threshold is 10, specifically, when the number of alarms is 10, since 10 is a multiple of the third alarm number threshold 10, the alarm information between the 1st and 10th times is aggregated, and the aggregated information is reported to relevant personnel, and so on, when the number of alarms is 20, the alarm information between the 11th and 20th times is aggregated, and the aggregated information is reported to relevant personnel. Understandably, if it is assumed that the total number of alarms within the preset alarm aggregation time is 22 times, the alarm information of the 21st and 22nd times will not be uploaded, and the third alarm strategy only needs to report 2 alarms, that is, upload alarms of multiples of the third alarm threshold.
[0043] Figure 2 FIG. 2 is a schematic block diagram of an alarm aggregation reporting device 200 provided in an embodiment of the present invention. Figure 2 As shown, corresponding to the above alarm aggregation reporting method, the present invention also provides an alarm aggregation reporting device 200. The alarm aggregation reporting device 200 includes a unit for executing the above alarm aggregation reporting method, and the device can be configured in a server. Figure 2 The alarm aggregation reporting device 200 includes a first query unit 201, a selection unit 202, a second query unit 203, a setting unit 204 and an aggregation reporting unit 205.
[0044] Among them, the first query unit 201 is used to periodically query whether there is a master node in the preset database; the selection unit 202 is used to select a slave node from multiple slave nodes as the master node through the optimistic locking mechanism of the preset database if the master node does not exist in the preset database, and set the effective lease time of the master node to the preset lease time; the second query unit 203 is used to periodically query whether the master node meets the renewal condition if the master node exists in the preset database; the setting unit 204 is used to obtain the current time if the master node meets the renewal condition, and reset the effective lease time according to the current time and the preset lease time; the aggregation reporting unit 205 is used to aggregate the alarm information according to the alarm strategy within the preset alarm aggregation time to obtain aggregate information if the master node receives alarm information within the effective lease time, and report the aggregate information to relevant personnel.
[0045] In some embodiments, such as this embodiment, the aggregation reporting unit 205 includes an identification unit 2051 , a first aggregation unit 2052 , a second aggregation unit 2053 and a third aggregation unit 2054 .
[0046] Among them, the identification unit 2051 is used to identify the alarm strategy according to a preset policy identifier; the first aggregation unit 2052 is used to, if the alarm strategy is the first alarm strategy, aggregate the alarm information according to the first alarm strategy within the preset alarm aggregation time to obtain the aggregate information; the second aggregation unit 2053 is used to, if the alarm strategy is the second alarm strategy, aggregate the alarm information according to the second alarm strategy within the preset alarm aggregation time to obtain the aggregate information; the third aggregation unit 2054 is used to, if the alarm strategy is the third alarm strategy, aggregate the alarm information according to the third alarm strategy within the preset alarm aggregation time to obtain the aggregate information.
[0047] In certain embodiments, such as the present embodiment, the first aggregation unit 2052 includes a judgment unit 20521, a setting subunit 20522, an update unit 20523, a reporting unit 20524, a first saving unit 20525, a first calculation unit 20526, a second saving unit 20527, a return execution unit 20528 and a first aggregation subunit 20529.
[0048] Among them, the judgment unit 20521 is used to judge whether the alarm information is received for the first time; the setting subunit 20522 is used to, if the alarm information is received for the first time, use the time when the alarm information is received as the start alarm time, and set the alarm number to 1; the updating unit 20523 is used to, if the alarm information is not received for the first time and is within the preset alarm aggregation time, update the alarm number, and compare the alarm number with the first alarm number threshold; the reporting unit 20524 is used to report the received alarm information to the relevant personnel if the alarm number is not greater than the first alarm number threshold; the first saving unit 20525 is used to save the received alarm information if the alarm number is greater than the first alarm number threshold; the calculation unit 20526 is used to, after the preset alarm aggregation time is reached, calculate the number of alarms from the start alarm time through the first alarm number threshold The time after the preset alarm aggregation time is used as the alarm end time, and the difference between the alarm end time and the time of the last alarm information within the preset alarm aggregation time is calculated to obtain the time difference; the second saving unit 20527 is used to reassign the preset alarm aggregation time if the time difference is less than the preset time threshold, and save the alarm information received from the alarm end time and within the preset alarm aggregation time period; the return execution unit 20528 is used to use the alarm end time as the start alarm time, and return to execute the step of using the time from the start alarm time to the preset alarm aggregation time after the preset alarm aggregation time is reached as the alarm end time; the first aggregation subunit 20529 is used to aggregate all the alarm information that has not been reported to obtain aggregation information if the time difference is not less than the preset time threshold.
[0049] In some embodiments, such as the present embodiment, the second aggregation unit 2053 includes a second calculation unit 20531 and a second aggregation sub-unit 20532 .
[0050] Among them, the second calculation unit 20531 is used to count the number of times the alarm information is received within the preset alarm aggregation time to obtain the total number of alarms; the second aggregation subunit 20532 is used to aggregate the alarm information to obtain the aggregated information if the total number of alarms is greater than the second alarm number threshold.
[0051] In some embodiments, such as the present embodiment, the third aggregation unit 2054 includes a third calculation unit 20541 and a third aggregation sub-unit 20542 .
[0052] Among them, the third calculation unit 20541 is used to count the number of alarms within the preset alarm aggregation time starting from the time when the first alarm information is received; the third aggregation subunit 20542 is used to aggregate the alarm information to obtain the aggregate information if the number of alarms is a multiple of the third alarm number threshold.
[0053] In some embodiments, such as the present embodiment, the alarm aggregation reporting device 200 further includes a third query unit 206 and a return unit 207 .
[0054] Among them, the third query unit 206 is used to periodically query whether the lease of the master node exceeds the preset lease time; the return unit 207 is used to return to the step of periodically querying whether there is a master node in the preset database if the lease of the master node exceeds the preset lease time.
[0055] The specific implementation of the alarm aggregation reporting device 200 in the embodiment of the present invention corresponds to the above-mentioned alarm aggregation reporting method, which will not be repeated here.
[0056] The above alarm aggregation reporting device can be implemented in the form of a computer program. The computer program can be used in Figure 3 Runs on the computer device shown.
[0057] See also Figure 3 , Figure 3 300 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device 300 is a server. Specifically, the server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0058] See also Figure 3 The computer device 300 includes a processor 302 , a memory and a network interface 305 connected via a system bus 301 , wherein the memory may include a storage medium 303 and an internal memory 304 .
[0059] The storage medium 303 may store an operating system 3031 and a computer program 3032. When the computer program 3032 is executed, the processor 302 may execute an alarm aggregation reporting method.
[0060] The processor 302 is used to provide computing and control capabilities to support the operation of the entire computer device 300 .
[0061] The internal memory 304 provides an environment for the operation of the computer program 3032 in the storage medium 303. When the computer program 3032 is executed by the processor 302, the processor 302 can execute an alarm aggregation reporting method.
[0062] The network interface 305 is used to communicate with other devices over the network. Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 300 to which the solution of the present application is applied. The specific computer device 300 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0063] Among them, the processor 302 is used to run a computer program 3032 stored in the memory to implement the following steps: regularly query whether there is a master node in the preset database; if the master node does not exist in the preset database, select a slave node from multiple slave nodes as the master node through the optimistic locking mechanism of the preset database, and set the effective lease time of the master node to the preset lease time; if the master node exists in the preset database, regularly query whether the master node meets the renewal conditions; if the master node meets the renewal conditions, obtain the current time, and reset the effective lease time according to the current time and the preset lease time; if the master node receives alarm information within the effective lease time, aggregate the alarm information according to the alarm strategy within the preset alarm aggregation time to obtain aggregate information, and report the aggregate information to relevant personnel.
[0064] In certain embodiments, such as the present embodiment, when the processor 302 implements the step of aggregating the alarm information according to the alarm strategy within the preset alarm aggregation time to obtain the aggregated information, it specifically implements the following steps: identifying the alarm strategy according to a preset policy identifier; if the alarm strategy is the first alarm strategy, aggregating the alarm information according to the first alarm strategy within the preset alarm aggregation time to obtain the aggregated information; if the alarm strategy is the second alarm strategy, aggregating the alarm information according to the second alarm strategy within the preset alarm aggregation time to obtain the aggregated information; if the alarm strategy is the third alarm strategy, aggregating the alarm information according to the third alarm strategy within the preset alarm aggregation time to obtain the aggregated information.
[0065] In certain embodiments, such as the present embodiment, when the processor 302 implements the step of aggregating the alarm information according to the first alarm strategy within the preset alarm aggregation time to obtain aggregated information, it specifically implements the following steps: determining whether the alarm information is received for the first time; if the alarm information is received for the first time, taking the time when the alarm information is received as the start alarm time, and setting the alarm number to 1; if the alarm information is not received for the first time and is within the preset alarm aggregation time, updating the alarm number and comparing the alarm number with the first alarm number threshold; if the alarm number is not greater than the first alarm number threshold, reporting the received alarm information to the relevant personnel; if the alarm number is greater than the first alarm number threshold, saving the received alarm information; the preset alarm aggregation time is reached Afterwards, the time after the preset alarm aggregation time starting from the start alarm time is taken as the alarm end time, and the difference between the alarm end time and the time of the last alarm information within the preset alarm aggregation time is calculated to obtain the time difference; if the time difference is less than the preset time threshold, the preset alarm aggregation time is reassigned, and the alarm information received from the alarm end time and within the preset alarm aggregation time period is saved; the alarm end time is taken as the start alarm time, and the step of returning to execute after the preset alarm aggregation time arrives, taking the time after the start alarm time starting from the preset alarm aggregation time as the alarm end time; if the time difference is not less than the preset time threshold, all the alarm information that has not been reported is aggregated to obtain aggregated information.
[0066] In certain embodiments, such as the present embodiment, when the processor 302 implements the step of aggregating the alarm information according to the second alarm strategy within the preset alarm aggregation time to obtain the aggregated information, it specifically implements the following steps: counting the number of times the alarm information is received within the preset alarm aggregation time to obtain the total number of alarms; if the total number of alarms is greater than the second alarm number threshold, aggregating the alarm information to obtain the aggregated information.
[0067] In certain embodiments, such as the present embodiment, when the processor 302 implements the step of aggregating the alarm information according to the third alarm strategy within the preset alarm aggregation time to obtain the aggregated information, it specifically implements the following steps: counting the number of alarms from the time when the first alarm information is received within the preset alarm aggregation time; if the number of alarms is a multiple of the third alarm number threshold, aggregating the alarm information to obtain the aggregated information.
[0068] In certain embodiments, such as the present embodiment, after the processor 302 implements the step of selecting a slave node from multiple slave nodes as the master node through the optimistic locking mechanism of the preset database if the master node does not exist in the preset database, and setting the effective lease time of the master node to the preset lease time, the specific implementation also includes the following steps: periodically querying whether the lease of the master node exceeds the preset lease time; if the lease of the master node exceeds the preset lease time, returning to execute the step of periodically querying whether the master node exists in the preset database.
[0069] It should be understood that in the embodiment of the present application, the processor 302 may be a central processing unit (CPU), and the processor 302 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0070] It is understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a storage medium, which is a computer-readable storage medium. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.
[0071] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program. The computer program is executed by at least one processor in the computer system to implement the process steps of the embodiment of the above alarm aggregation reporting method.
[0072] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which are computer-readable storage media that can store program codes.
[0073] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0074] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0075] The steps in the method of the embodiment of the present invention can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0076] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.
[0077] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0078] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
[0079] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of various equivalent modifications or substitutions within the technical scope disclosed by the present invention, and these modifications or substitutions should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for reporting alarm aggregation, characterized in that: include: Regularly query whether there is a master node in the preset database; If the master node does not exist in the preset database, a slave node is selected from multiple slave nodes as the master node through the optimistic locking mechanism of the preset database, and the effective lease time of the master node is set to the preset lease time; If the master node exists in the preset database, periodically query whether the master node meets the renewal condition, wherein the renewal condition is that the effective lease time of the master node is less than the preset renewal time threshold; If the master node meets the renewal condition, the current time is obtained, and the effective lease time is reset according to the current time and the preset lease time; If the master node receives the alarm information within the valid lease period, the alarm information is aggregated according to the alarm strategy within the preset alarm aggregation time to obtain aggregated information, and the aggregated information is reported to relevant personnel; The step of aggregating the alarm information according to the alarm strategy within the preset alarm aggregation time to obtain aggregate information includes: Identify the alarm strategy according to the preset strategy identifier; If the alarm strategy is the first alarm strategy, aggregating the alarm information according to the first alarm strategy within a preset alarm aggregation time to obtain aggregate information; If the alarm strategy is the second alarm strategy, aggregating the alarm information according to the second alarm strategy within a preset alarm aggregation time to obtain the aggregated information; If the alarm strategy is the third alarm strategy, aggregating the alarm information according to the third alarm strategy within a preset alarm aggregation time to obtain the aggregated information; The aggregating the alarm information according to the first alarm strategy within the preset alarm aggregation time to obtain aggregated information includes: Determining whether the warning information is received for the first time; If the alarm information is received for the first time, the time when the alarm information is received is used as the start alarm time, and the number of alarms is set to 1; If the alarm information is not received for the first time and is within the preset alarm aggregation time, updating the alarm number and comparing the alarm number with the first alarm number threshold; If the alarm number is not greater than the first alarm number threshold, reporting the received alarm information to the relevant personnel; If the alarm number is greater than the first alarm number threshold, saving the received alarm information; After the preset alarm aggregation time arrives, the time after the preset alarm aggregation time from the start alarm time is taken as the alarm end time, and the difference between the alarm end time and the time of the last alarm information within the preset alarm aggregation time is calculated to obtain the time difference; If the time difference is less than the preset time threshold, the preset alarm aggregation time is reassigned, and the alarm information received from the alarm end time and within the preset alarm aggregation time is saved; The alarm end time is used as the alarm start time, and after the preset alarm aggregation time is reached, the step of returning to execute, and taking the time from the alarm start time to the preset alarm aggregation time as the alarm end time; If the time difference is not less than the preset time threshold, all the unreported alarm information is aggregated to obtain aggregate information.
2. The alarm aggregation reporting method according to claim 1, characterized in that: The aggregating the alarm information according to the second alarm strategy within the preset alarm aggregation time to obtain the aggregate information includes: Counting the number of received alarm messages within a preset alarm aggregation time to obtain a total number of alarms; If the total number of alarms is greater than a second alarm number threshold, the alarm information is aggregated to obtain the aggregate information.
3. The alarm aggregation reporting method according to claim 1, characterized in that: The aggregating the alarm information according to the third alarm strategy within the preset alarm aggregation time to obtain the aggregate information includes: Counting the number of alarms from the time the first alarm information is received within a preset alarm aggregation time; If the alarm number is a multiple of a third alarm number threshold, the alarm information is aggregated to obtain the aggregated information.
4. The alarm aggregation reporting method according to claim 1, characterized in that: After the step of selecting a slave node from multiple slave nodes as the master node through the optimistic locking mechanism of the preset database if the master node does not exist in the preset database, and setting the effective lease time of the master node to the preset lease time, the method further includes: Regularly query whether the lease period of the master node exceeds the preset lease period; If the lease of the master node exceeds the preset lease time, the process returns to the step of periodically querying whether there is a master node in the preset database.
5. An alarm aggregation reporting device, characterized in that: include: A first query unit, used for periodically querying whether a master node exists in a preset database; A selection unit, configured to select a slave node from multiple slave nodes as the master node through an optimistic locking mechanism of the preset database if the master node does not exist in the preset database, and set the effective lease time of the master node to a preset lease time; A second query unit is configured to periodically query whether the master node satisfies a renewal condition if the master node exists in the preset database, wherein the renewal condition is that the effective lease time of the master node is less than a preset renewal time threshold; A setting unit, configured to obtain a current time if the master node meets the renewal condition, and reset the effective lease time according to the current time and the preset lease time; An aggregation reporting unit, configured to aggregate the alarm information according to an alarm strategy within a preset alarm aggregation time to obtain aggregate information if the master node receives the alarm information within the valid lease period, and report the aggregate information to relevant personnel; Wherein, the aggregation reporting unit includes: An identification unit, used to identify the alarm strategy according to a preset strategy identifier; A first aggregation unit, configured to aggregate the alarm information according to the first alarm strategy within a preset alarm aggregation time to obtain aggregated information if the alarm strategy is a first alarm strategy; A second aggregation unit, configured to aggregate the alarm information according to the second alarm strategy within a preset alarm aggregation time to obtain the aggregated information if the alarm strategy is the second alarm strategy; A third aggregation unit, configured to aggregate the alarm information according to the third alarm strategy within a preset alarm aggregation time to obtain the aggregated information if the alarm strategy is a third alarm strategy; The first polymerization unit comprises: A judging unit, used to judge whether the warning information is received for the first time; A setting subunit is used for setting the time when the alarm information is received as the start alarm time and setting the alarm number to 1 if the alarm information is received for the first time; An updating unit, configured to update the alarm number if the alarm information is not received for the first time and is within a preset alarm aggregation time, and compare the alarm number with a first alarm number threshold; A reporting unit, configured to report the received alarm information to the relevant personnel if the alarm number is not greater than the first alarm number threshold; A first storage unit, configured to store the received alarm information if the alarm number is greater than the first alarm number threshold; A first calculation unit is used for, after the preset alarm aggregation time arrives, taking the time from the start alarm time after the preset alarm aggregation time as the alarm end time, and calculating the difference between the alarm end time and the last alarm information time within the preset alarm aggregation time to obtain a time difference; A second storage unit is used to reassign the preset alarm aggregation time if the time difference is less than a preset time threshold, and save the alarm information received from the alarm end time and within the preset alarm aggregation time; Return to the execution unit, used for taking the alarm end time as the alarm start time, and returning to execute the step of taking the time from the alarm start time to the preset alarm aggregation time as the alarm end time after the preset alarm aggregation time arrives; The first aggregation subunit is used to aggregate all the unreported alarm information to obtain aggregate information if the time difference is not less than the preset time threshold.
6. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the alarm aggregation reporting method according to any one of claims 1 to 4 when executing the computer program.
7. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the alarm aggregation reporting method according to any one of claims 1 to 4 can be implemented.
