CN115913885A - Customizable alarm subscription forwarding method and device - Google Patents

Customizable alarm subscription forwarding method and device Download PDF

Info

Publication number
CN115913885A
CN115913885A CN202211651314.9A CN202211651314A CN115913885A CN 115913885 A CN115913885 A CN 115913885A CN 202211651314 A CN202211651314 A CN 202211651314A CN 115913885 A CN115913885 A CN 115913885A
Authority
CN
China
Prior art keywords
alarm
forwarding
subscription
rule
template
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211651314.9A
Other languages
Chinese (zh)
Inventor
闵莽锐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Unihub China Information Technology Co Ltd
Original Assignee
Unihub China Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Unihub China Information Technology Co Ltd filed Critical Unihub China Information Technology Co Ltd
Priority to CN202211651314.9A priority Critical patent/CN115913885A/en
Publication of CN115913885A publication Critical patent/CN115913885A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a customizable alarm subscription forwarding method and a customizable alarm subscription forwarding device, wherein the method comprises the following steps: constructing a uniform alarm subscription model by defining an alarm subscription rule, an alarm forwarding template and subscription parameters; and configuring an alarm subscription rule according to the alarm subscription model, and executing subscription operation through an alarm subscription module according to the alarm subscription rule to realize the whole processing logic of receiving and forwarding the alarm. The method and the device define a universal and flexible alarm subscription model and realize the functions of alarm receiving, rule matching, alarm forwarding, forwarding execution and the like around the model.

Description

Customizable alarm subscription forwarding method and device
Technical Field
The invention relates to the field of alarm forwarding, in particular to a customizable alarm subscription forwarding method and a customizable alarm subscription forwarding device.
Background
In network monitoring, the alarm received by the system is often required to be forwarded to an external system or an internal subsystem through various ways, but the range, the forwarding way and the forwarding format of the alarm are different. In the past, a forwarding program is realized according to respective requirements, and even if a small amount of difference exists, the forwarding program can be maintained independently. In the long term, tens or even tens of programs may need to be maintained, which causes a great maintenance workload, and especially when internal and external interfaces of the programs are changed, the programs need to go through the processes of code change, test, joint debugging, online and the like.
Disclosure of Invention
In order to quickly respond to different subscription requirements of external users in and out of the system on alarm real-time data, the invention provides a customizable alarm subscription forwarding method and device.
In order to achieve the purpose, the invention adopts the following technical scheme:
in an embodiment of the present invention, a customizable alarm subscription forwarding method is provided, including:
constructing a uniform alarm subscription model by defining an alarm subscription rule, an alarm forwarding template and subscription parameters;
and configuring an alarm subscription rule according to the alarm subscription model, and executing subscription operation through an alarm subscription module according to the alarm subscription rule to realize the whole processing logic of receiving and forwarding the alarm.
Further, the model of the alarm subscription rule is as follows:
taking alarm subscription rules as a main table, wherein each rule comprises a plurality of rule filters for determining the range of alarm subscription, and each rule filter comprises a plurality of matching condition information;
each rule comprises a plurality of subscription parameters and is used for determining parameter information to be configured for different subscription types, and the parameter information is stored in a dictionary table form;
each rule comprises an active alarm forwarding template, a clear alarm forwarding template and an updated alarm forwarding template, and is used for determining rule conversion template information when the three types of alarm messages are forwarded, wherein each template comprises detailed information of a plurality of rule conversion templates.
Further, the alarm subscription module comprises:
the alarm receiving submodule is used for receiving the standardized real-time alarm stream from the message middleware;
the rule matching submodule is used for analyzing the alarm attribute information, distributing the alarms meeting the subscription rules to the corresponding subscription rules and discarding the alarms not meeting the subscription rules;
the alarm forwarding sub-module is used for constructing alarm content according to the subscription template and forwarding the alarm content;
and the forwarding execution sub-module is used for executing different forwarding actions according to different subscription types.
Further, the processing logic of the alarm forwarding sub-module is as follows:
receiving alarms from the alarm distribution queue and judging according to the types of the alarms;
if the alarm type is active alarm, traversing the rule list satisfied by the alarm according to the subscription rule matching result, and judging whether the following conditions are satisfied:
initially, setting a forwarding flag =0;
if the rule filter to which the alarm belongs needs to delay forwarding, immediate forwarding is not performed, and the final forwarding time = alarm occurrence time + delay time is set, and if the final forwarding time < = current time, immediate forwarding is performed; starting a timer, waiting for the current time = forwarding end time, and the alarm state =1, distributing the alarm to an active alarm forwarding execution queue of each subscription rule, and setting a forwarding flag =1; if the alarm state =0 in the delay time window, not forwarding, and deleting the alarm from the cache;
if the rule filter to which the alarm belongs does not need to delay forwarding, the alarm is distributed to an active alarm forwarding execution queue of each subscription rule;
if the alarm type is an updated alarm, inquiring the cache according to the unique alarm identifier, and if the alarm type does not exist, discarding the cache; if yes, updating corresponding alarm attribute information in the cache; distributing the alarm to an updating forwarding execution queue of each subscription rule;
if the alarm type is alarm clearing, inquiring the cache according to the unique alarm identifier, and if the alarm type does not exist, discarding; if yes, and if the forwarding flag of the current alarm =0, deleting the alarm from the cache, and simultaneously clearing the alarm without forwarding; and if the forwarding mark of the current alarm =1, distributing the alarm to a clearing forwarding execution queue of each subscription rule, and deleting the corresponding alarm in the cache.
In an embodiment of the present invention, a customizable alarm subscription forwarding device is further provided, where the device includes:
the modeling submodule is used for constructing a uniform alarm subscription model by defining an alarm subscription rule, an alarm forwarding template and subscription parameters;
and the alarm processing module is used for configuring an alarm subscription rule according to the alarm subscription model, and executing subscription operation through the alarm subscription module according to the alarm subscription rule to realize the whole processing logic of receiving and forwarding the alarm.
Further, the model of the alarm subscription rule is as follows:
taking alarm subscription rules as a main table, wherein each rule comprises a plurality of rule filters for determining the range of alarm subscription, and each rule filter comprises a plurality of matching condition information;
each rule comprises a plurality of subscription parameters and is used for determining parameter information to be configured for different subscription types, and the parameter information is stored in a dictionary table form;
each rule comprises an active alarm forwarding template, a clear alarm forwarding template and an updated alarm forwarding template and is used for determining rule conversion template information when the three types of alarm messages are forwarded, wherein each template comprises detailed information of a plurality of rule conversion templates.
Further, the alarm subscription module comprises:
the alarm receiving submodule is used for receiving the standardized real-time alarm stream from the message middleware;
the rule matching submodule is used for analyzing the alarm attribute information, distributing the alarms meeting the subscription rules to the corresponding subscription rules and discarding the alarms not meeting the subscription rules;
the alarm forwarding sub-module is used for constructing alarm content according to the subscription template and forwarding the alarm content;
and the forwarding execution submodule is used for executing different forwarding actions according to different subscription types.
Further, the processing logic of the alarm forwarding sub-module is as follows:
receiving alarms from the alarm distribution queue and judging according to the types of the alarms;
if the alarm type is active alarm, traversing the rule list satisfied by the alarm according to the subscription rule matching result, and judging whether the following conditions are satisfied:
initially, a forwarding flag =0 is set;
if the alarm belongs to the rule filter and needs to be delayed for forwarding, the alarm is not forwarded immediately, and final forwarding time = alarm occurrence time + delay time is set, and if the final forwarding time < = current time, the alarm is forwarded immediately; starting a timer, waiting for the current time = forwarding end time, and the alarm state =1, distributing the alarm to an active alarm forwarding execution queue of each subscription rule, and setting a forwarding flag =1; if the alarm state =0 in the delay time window, not forwarding, and deleting the alarm from the cache;
if the rule filter to which the alarm belongs does not need to delay forwarding, the alarm is distributed to an active alarm forwarding execution queue of each subscription rule;
if the alarm type is an updated alarm, inquiring the cache according to the unique alarm identifier, and if the alarm type does not exist, discarding the cache; if yes, updating corresponding alarm attribute information in the cache; distributing the alarm to an updating forwarding execution queue of each subscription rule;
if the alarm type is clear alarm, inquiring the cache according to the unique alarm identifier, and if the alarm type does not exist, discarding the cache; if the alarm exists, and if the forwarding mark of the current alarm =0, deleting the alarm from the cache, and simultaneously clearing the alarm without forwarding; and if the forwarding mark of the current alarm =1, distributing the alarm to a clearing and forwarding execution queue of each subscription rule, and deleting the corresponding alarm in the cache.
In an embodiment of the present invention, a computer device is further provided, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and the processor implements the customizable alert subscription forwarding when executing the computer program.
In an embodiment of the present invention, a computer-readable storage medium is further provided, where a computer program for executing customizable alert subscription forwarding is stored in the computer-readable storage medium.
Has the advantages that:
1. flexible configuration of alert subscription rules: the invention can flexibly set the alarm range to be subscribed according to different rule combinations.
2. Diversity of alert subscription types: the invention supports the forwarding of subscribed alarms according to different subscription types, such as message middleware kafka/MQ, sending mails, sending short messages, sending enterprise WeChat, incoming ES and socket.
3. Flexible definition of forwarding content: the invention can flexibly define the alarm subscription template according to the requirements of subscribers, and automatically construct the finally required alarm content format for forwarding through various assignment conversion methods.
4. Quick response to user demand: the invention can quickly meet the personalized alarm subscription requirements of different users and different scenes through a configuration mode.
Drawings
FIG. 1 is a diagram of an alarm subscription rule model of the present invention;
FIG. 2 is a diagram of an alert subscription rules management page in accordance with an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an alarm subscription module according to the present invention;
FIG. 4 is a logical diagram of the alarm distribution processing of the present invention;
FIG. 5 is a schematic structural diagram of a customizable alarm subscription forwarding device according to the present invention;
FIG. 6 is a schematic diagram of the structure of the computer device of the present invention.
Detailed Description
The principles and spirit of the present invention will be described below with reference to several exemplary embodiments, which should be understood to be presented only to enable those skilled in the art to better understand and implement the present invention, and not to limit the scope of the present invention in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
As will be appreciated by one skilled in the art, embodiments of the present invention may be embodied as an apparatus, device, node, method, or computer program product. Accordingly, the present disclosure may be embodied in the form of: entirely hardware, entirely software (including firmware, resident software, micro-code, etc.), or a combination of hardware and software.
The embodiment of the invention provides a customizable alarm subscription forwarding method and a customizable alarm subscription forwarding device, and a unified alarm subscription model is constructed by defining an alarm subscription rule, a subscription parameter and an alarm forwarding template. The method aims to quickly meet the subscription requirement of external users in the system on real-time alarm by configuring the alarm subscription rule.
The principles and spirit of the present invention are explained in detail below with reference to several representative embodiments of the invention.
1. The invention provides a customizable alarm subscription forwarding method, which is characterized in that a unified alarm subscription model is built, and the method specifically comprises the following contents:
the alarm subscription rule defines: the method comprises the information of rule coding, rule name, rule description, rule state, active alarm forwarding template, clear alarm forwarding template, update alarm forwarding template, alarm filtering condition and the like.
And (3) defining an alarm forwarding template: the method comprises the information of template coding, template name, template description, template content customization and the like.
Subscription parameter definition: different parameters are dynamically configured and constructed according to subscription types, for example, the mail subscription contains information such as mail addresses, accounts and recipients.
And configuring an alarm subscription rule according to the alarm subscription model, and executing operation through an alarm subscription module according to the alarm subscription rule to realize the whole processing logic of receiving and forwarding the alarm.
2. The alarm subscription model comprises an alarm subscription rule model and an alarm subscription module, and the alarm subscription module executes subscription operation according to the alarm subscription rule.
(1) The alarm subscription rule model comprises the model shown in fig. 1 and the association relationship thereof:
taking alarm subscription rules as a main table, wherein each rule comprises a plurality of rule filters for determining the range of alarm subscription, and each rule filter comprises a plurality of matching condition information;
each rule comprises a plurality of subscription parameters and is used for determining parameter information to be configured for different subscription types, and the parameter information is stored in a dictionary form;
each rule comprises an active alarm forwarding template, a clear alarm forwarding template and an updated alarm forwarding template and is used for determining rule conversion template information when the three types of alarm messages are forwarded, wherein each template comprises detailed information of a plurality of rule conversion templates.
(2) The following is a detailed definition of each table in the alarm subscription rule model.
Alarm subscription rule main table: cm _ ala _ describe _ rule, which defines rule base information and body information, as shown in table 1 below:
TABLE 1
Name of field Field coding Field description
Rule encoding rule_id Unique identification
Rule name rile_name
Type of subscription rule_type kafka/CTG-MQ/email/wechat/ES/sms
Rule description rule_desc
Rule states rule_status 1-Enable 0-Disable
Creation time create_time
Modifying time modify_time
Active alarm template coding active_templ_id
Updating alarm template codes mod_templ_id
Clearing alarm template codes clear_templ_id
And (3) a rule filter: cm _ ala _ describe _ filter, which defines the matching condition information contained in the rule, as shown in table 2 below:
TABLE 2
Name of field Field coding Field description
Rule coding rule_id Unique identification
Name of filtering condition fillter_name Identification of a list of filter criteria
Filtration type filter_type 1-by alarm type 2-custom conditions
Conditional expressions filter_expr
Alarm type identification alarm_type
Whether or not to delay is_delay 1-is 0-is
Delay time delay_time Unit: second of
Rule filter matching condition information: cm _ ala _ describe _ condition, defines the matching condition information contained in the rule, as shown in table 3 below:
TABLE 3
Name of field Field coding Field description
Rule encoding rule_id Unique identification
Name of filtering condition fillter_name Identification of a list of filter criteria
Attribute coding attribute_code Corresponding alarm attribute field (ES field name)
Attribute name attribute_name Chinese field name
Matching mode match_type Enumeration, see dictionary Table definition
Matching expressions match_expr
Subscription parameter dictionary table: cm _ ala _ subscribe _ dit, which defines parameter information to be configured for different subscription types, as shown in table 4 below:
TABLE 4
Figure BDA0004010794340000091
/>
Figure BDA0004010794340000101
Rule subscription parameter table: cm _ ala _ subscribe _ para, subscription parameter value information defining rules, as shown in table 5 below:
TABLE 5
Name of field Field coding Field description
Rule encoding rule_id
Subscription parameter coding para_code
Subscription parameter values para_value
Rule conversion template: cm _ ala _ describe _ template, which defines transformation template information for the content sent when the rule performs an action, as shown in table 6 below:
TABLE 6
Figure BDA0004010794340000102
Rule transformation template details: cm _ ala _ describe _ template _ detail, defines the details of the rule transformation template, as shown in Table 7 below:
TABLE 7
Figure BDA0004010794340000103
Figure BDA0004010794340000111
(3) Alarm subscription rule management
An alert subscription rule is created as shown in fig. 2.
The rule information is divided into the following three parts (note mandatory field plus "+" label):
(a) Basic information of the rule:
and (3) rule coding: text box, manual filling, and filling.
Rule name: text box, manual filling, and filling.
Type of subscription: and (5) a radio box, wherein enumerated values are dictionary values and are required to be filled.
The rule describes: text box, manual filling and selecting filling.
Rule states: and (5) radio boxes, wherein enumerated values are dictionary values, filling is necessary, and the default is yes.
And (4) activating an alarm template: the radio frame can also click an adding button to add a template, and call a page to subscribe for template adding/editing after clicking, and the page brings the added template into the current selection value of the template after determining.
Clearing the alarm template: and the same active alarm template.
(b) Subscription parameter information: the following are shown in tabular form:
parameter coding: and is not editable.
Parameter name: it is not editable.
Whether it is necessary to fill: it is not editable.
Parameter values: and (4) manually inputting.
The operation is as follows: and (4) checking complete parameter information in a multi-line text box mode after the details are clicked, and supporting editing and backfilling. The wrapping is displayed correctly.
(c) Rule matching conditions are as follows: a number of different filter criteria may be defined, each filter being defined in both an alarm type and a custom criteria. Default to filling by alarm type.
According to the alarm type: the band may enter a filtered multiple selection drop-down list box. Clicking "newly added" can newly add an alarm type.
Self-defining conditions are as follows: clicking on the button "add filter" may add a number of combinations of filter criteria, the filter name being a text box, filled in manually and must be filled in. The plurality of condition combinations are in the relationship of or, and the condition combinations are in the relationship of and. When the user-defined condition is selected, at least one filter is included.
Delay forwarding: and (4) default selection is not performed, and if yes, a delay time window text box and a unit are displayed (the text box prompts a delay time window by default).
List of filtering conditions: the add list includes the following columns, each of which is editable. Each column is filled.
Alarm attribute and attribute coding: and (4) selecting the pull-down list box singly, linking the pull-down list box and the pull-down list box, displaying Chinese description and filling the Chinese description.
And (3) judging the mode: and (5) pulling down a list box, wherein enumerated values are dictionary values.
Matching an expression: text box, manual entry.
The user can click "delete," the system prompts "whether to confirm the delete? "delete from page after confirmation.
The user clicks "add" and the system adds a line at the end of the list page.
The conditional expression is as follows: the following two ways are distinguished:
according to the alarm type: the format is "k _ ALARMTYPEID = = type of alarm of page selection".
Self-defining conditions are as follows: and automatically generating and filling in a text box according to the set condition information, and setting the text box as read-only and non-editable.
Traversing the filtering condition combination, and splicing according to the 'I'.
And traversing the filtering condition list and splicing according to the row of & &'.
The condition lines are spliced according to the following format: attribute coding + judgment mode + matching expression.
(d) A save button: and after clicking, if the verification is passed, triggering the storage operation.
(4) Alarm subscription module
As shown in fig. 3, the alarm subscription module includes the following sub-modules:
an alarm receiving (SubscribeRecv) sub-module: the normalized real-time alert stream is received from message middleware (e.g., kafka).
Rule matching (SubscribeRuleMatch) submodule: analyzing the alarm attribute information; distributing the alarms meeting the subscription rules to the corresponding subscription rules, and discarding the alarms not meeting the subscription rules.
An alarm forwarding (subscribe transfer) sub-module: and constructing alarm content according to the subscription template for forwarding.
A forwarding execution (SubscribeExecutor) submodule: according to different subscription types, different forwarding actions are executed, including pushing kafka, pushing MQ, sending mails, sending short messages, sending enterprise Wechat, entering ES and socket.
(a) Alarm receiving and processing logic (SubscribeRecv sub-module)
The processing logic:
and connecting kafka, and receiving the data stream in real time according to the configured topic.
And taking out the message content as an alarm message, and generating an internal unified object.
If k _ MSTYPE = add (new alert): the queue number queueNo = mod (abs (crc 32 (k _ ClearFp))/number of work queues) is calculated and fed into the corresponding rule matching queue according to the queueNo, i.e. the alarm clearing fingerprint is taken and converted into an integer according to the crc32 algorithm and the absolute value is taken, and then modulo the number of work queues.
If k _ MSTYPE = delete (alarm clear): and sending the alarm into an alarm distribution queue.
If k _ MSTYPE = modify (alarm update): and sending the alarm into an alarm distribution queue.
Remarking: k _ MSTYPE is the message type field, and k _ ClearFp is the clear fingerprint field of the alarm.
(b) Rule matching processing logic (SubscribeMatch sub-module)
The processing logic:
an alert is received from the rule matching queue.
And traversing the global subscription rules, matching the rule filter lists (filterlists) one by one, and if the rule filter lists are not matched, continuing to obtain the next rule.
And if the alarm is matched with the preset subscription rule, recording the subscription rule ID met by the alarm. The same alarm may satisfy multiple rules, eventually generating a rule list ruleList.
And sending the alarm into an alarm distribution queue.
(c) Alarm distribution processing logic (SubscribeMatch sub-module)
As shown in fig. 4, processing logic:
an alert is received from an alert distribution queue. And judging according to the alarm type:
active alert (message type = 200):
according to the rule matching result, traversing the rulList which is satisfied by the alarm, and judging whether the following conditions are satisfied:
initially, a forwarding flag transfer _ flag =0 is set.
If the rule filter to which the alarm belongs needs to delay forwarding (whether to delay isDelay = 1), then do not immediately forward, and set the final forwarding time t _ transfer _ time = t _ start time + delayTime (seconds), where t _ start time is the alarm occurrence time and delayTime is the delay time, and if t _ transfer _ time < = current time, immediately forward. Starting a timer, waiting for the current time = forwarding end time & & l _ alarm status =1 (l _ alarm status is in an alarm state, 1 is an active alarm, and 0 is a clear alarm), distributing an alarm object to an active alarm forwarding execution queue of each subscription rule, and setting a forwarding flag transfer _ flag =1. If the alarm is cleared within the delay time window (alarm state l _ alarm status = 0), no forwarding is done and the alarm is deleted from the cache.
If the rule filter to which the alarm belongs does not need to delay forwarding (whether to delay isDelay = 0), the alarm object is distributed to the active alarm forwarding execution queue of each subscription rule.
Update alert (message type = 201):
and inquiring the cache according to the alarm unique identifier AlarmID, and if the cache does not exist, discarding the cache.
And if so, updating the corresponding alarm attribute information in the cache. And distributing the alarm object to the update forwarding execution queue of each rule.
Clear alarm (message type = 202):
and querying the cache according to the alarm unique identifier AlarmID, and if the alarm unique identifier AlarmID does not exist, discarding the cache.
If the alarm exists, and if the current alarm is not forwarded (forwarding _ flag = 0), deleting the alarm from the cache, and meanwhile clearing the message without forwarding; if the alarm is forwarded (forwarding _ flag = 1), the alarm object is distributed to a clear forwarding execution queue of each subscription rule, and the corresponding alarm in the cache is deleted.
(d) Forwarding execution processing logic (SubscribTransfer sub-module)
The processing logic:
and receiving an alarm from the rule matching queue, constructing a forwarding message according to the subscription type, and executing a forwarding action.
The forwarding message content is constructed according to the following template switching logic.
The template switching logic is assigned according to the following steps: (English field can refer to alarm subscription rule for its meaning, mapType is "(" Chinese in front, e.g. fixed value).
And traversing attribute assignment entries in the rule, and generating a forwarding mapping table in a key-value mode. Where key corresponds to dstField and value is generated from mapType. If the valueType = string, the value needs to be uniformly added with double quotation marks; if the valueType = number, judging whether the value is a numerical value, if so, directly referring, and if not, assigning the value to be '-1'. The following expr all represent alarm attribute values. Different conversion logic is executed per mapType.
Fixed value (mapType = fixed): the direct assignment is mapExpr.
Alarm attribute direct mapping (mapType = direct): and directly assigning the alarm attribute value represented by mapExpr. For example, mapExpr = k _ RESIP, the value is assigned to the value corresponding to the current alarm k _ RESIP.
Canonical (mapType = reg): in this case, the srcField is the alarm attribute, mapExpr is the regular expression, and the regular expression is applied to the srcField to intercept and obtain the required content for assignment.
Splicing (mapType = join): in this case, mapExpr is a splicing expression, and the word string content obtained by replacing the corresponding variable in the expression with the alarm attribute value is assigned. For example: "$ { k _ RESIP }: $ k _ RESNAME }:100". (k _ RESIP stands for resource IP, k _ RESNAME for resource name).
Conditional judgement (mapType = case): in this case, mapExpr is a conditional expression, with the format "expr =1; expr = 2; c ", indicates that expr =1 is assigned a, expr =2 is assigned b, and the rest cases are assigned c. Between a plurality of conditions "; "separate. a. b and c can be variable or constant.
Non-null decision (mapType = nvl): in this case, mapExpr is a conditional expression in the format "expr, a, b", that is, an expression which is not an empty value but an empty value. And if expr is not null, the value is assigned to a, and if the value is null, the value is assigned to b. a. b may be variable or constant.
Run number (mapType = serial): in this case, the assignment expression is the starting value, step size, comma separation of the running numbers. The format is "1,1", i.e. 1 is added each time, starting with 1. And acquiring the current value from the redis, and storing the current value into the redis after updating. key = serial: $ ruleId $ templd $ dstField, value = current value.
API call (mapType = API): and calling the appointed API, taking the input parameter as the appointed alarm attribute or variable, and assigning the return value of the calling interface. Wherein mapExpr is URL and is called by adopting get method. For example: http:// RESOURCE-JAVA-SERVICE/api/ala/getCIRCUItNoresid = $ { k _ RESID } & resClass = $ { var1}, "$ { }" is a variable reference, and RESOURCE-JAVA-SERVICE is a SERVICE name. The back reference format is as follows, where code =0000 is success, code =0001 is failure, and data is a return value. (k _ RESID represents RESOURCE ID, k _ RESNAME represents RESOURCE name, resClass is parameter name of interface, http:// RESOURCE-JAVA-SERVICE/api/ala/getCiruitNo is interface URL)
Figure BDA0004010794340000181
(5) Subscription parameters
The subscription parameters for different subscription types are listed in table 8 below and can be truncated as desired.
TABLE 8
Figure BDA0004010794340000182
/>
Figure BDA0004010794340000191
It should be noted that although the operations of the method of the present invention have been described in the above embodiments and the accompanying drawings in a particular order, this does not require or imply that these operations must be performed in this particular order, or that all of the operations shown must be performed, to achieve the desired results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
Based on the same inventive concept, the invention also provides a customizable alarm subscription forwarding device. The implementation of the device can refer to the implementation of the method, and repeated details are not repeated. The term "sub-module", as used hereinafter, may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 5 is a schematic structural diagram of a customizable alarm subscription forwarding device according to the present invention. As shown in fig. 5, the apparatus includes:
the modeling submodule 101 is used for constructing a uniform alarm subscription model by defining an alarm subscription rule, an alarm forwarding template and subscription parameters;
and the alarm processing module 102 is configured to configure an alarm subscription rule according to the alarm subscription model, and execute a subscription operation through the alarm subscription module according to the alarm subscription rule, so as to implement a whole processing logic for receiving and forwarding an alarm.
The model of the alert subscription rules is as follows:
taking alarm subscription rules as a main table, wherein each rule comprises a plurality of rule filters for determining the range of alarm subscription, and each rule filter comprises a plurality of matching condition information;
each rule comprises a plurality of subscription parameters and is used for determining parameter information to be configured for different subscription types, and the parameter information is stored in a dictionary form;
each rule comprises an active alarm forwarding template, a clear alarm forwarding template and an updated alarm forwarding template, and is used for determining rule conversion template information when the three types of alarm messages are forwarded, wherein each template comprises detailed information of a plurality of rule conversion templates.
The alarm subscription module comprises:
the alarm receiving submodule is used for receiving the standardized real-time alarm stream from the message middleware;
the rule matching submodule is used for analyzing the alarm attribute information, distributing the alarms meeting the subscription rules to the corresponding subscription rules and discarding the alarms not meeting the subscription rules;
the alarm forwarding submodule is used for constructing alarm content according to the subscription template and forwarding the alarm content;
the alarm forwarding processing logic is as follows:
receiving alarms from the alarm distribution queue and judging according to the alarm types;
if the alarm type is active alarm, traversing the rule list satisfied by the alarm according to the subscription rule matching result, and judging whether the following conditions are satisfied:
initially, a forwarding flag =0 is set;
if the alarm belongs to the rule filter and needs to be delayed for forwarding, the alarm is not forwarded immediately, and final forwarding time = alarm occurrence time + delay time is set, and if the final forwarding time < = current time, the alarm is forwarded immediately; starting a timer, waiting for the current time = forwarding end time, and the alarm state =1, distributing the alarm to an active alarm forwarding execution queue of each subscription rule, and setting a forwarding flag =1; if the alarm state =0 in the delay time window, not forwarding, and deleting the alarm from the cache;
if the rule filter to which the alarm belongs does not need to delay forwarding, the alarm is distributed to an active alarm forwarding execution queue of each subscription rule;
if the alarm type is an updated alarm, inquiring the cache according to the unique alarm identifier, and if the alarm type does not exist, discarding the cache; if yes, updating corresponding alarm attribute information in the cache; distributing the alarm to an updating forwarding execution queue of each subscription rule;
if the alarm type is alarm clearing, inquiring the cache according to the unique alarm identifier, and if the alarm type does not exist, discarding; if the alarm exists, and if the forwarding mark of the current alarm =0, deleting the alarm from the cache, and simultaneously clearing the alarm without forwarding; and if the forwarding mark of the current alarm =1, distributing the alarm to a clearing and forwarding execution queue of each subscription rule, and deleting the corresponding alarm in the cache.
And the forwarding execution submodule is used for executing different forwarding actions according to different subscription types.
It should be noted that although several sub-modules of the customizable alert subscription forwarding device are mentioned in the above detailed description, such partitioning is merely exemplary and not mandatory. Indeed, according to an embodiment of the invention, the features and functions of two or more sub-modules described above may be embodied in one sub-module. Conversely, the features and functions of one sub-module described above may be further divided into a plurality of sub-modules.
Based on the aforementioned inventive concept, as shown in fig. 6, the present invention further provides a computer device 200, which includes a memory 210, a processor 220, and a computer program 230 stored on the memory 210 and operable on the processor 220, wherein the processor 220 implements the aforementioned customizable alert subscription forwarding method when executing the computer program 230.
Based on the above inventive concept, the present invention further provides a computer readable storage medium storing a computer program for executing the customizable alert subscription forwarding.
The customizable alarm subscription forwarding method and device provided by the invention can meet the real-time subscription of the internal and external systems to the alarm data under different scene requirements by defining the alarm subscription model. The final goals achieved include:
(1) Flexible configuration of alert subscription rules: the alarm range needing to be subscribed can be flexibly set according to different rule combinations.
(2) Diversity of alert subscription types: support for forwarding subscribed alarms in different subscription types, such as message middleware kafka/MQ, mailing, texting, enterprise WeChat, incoming ES, and socket.
(3) Flexible definition of forwarding content: the alarm subscription template can be flexibly defined according to the requirements of subscribers, and finally required alarm content formats are automatically constructed for forwarding through various assignment conversion methods.
(4) Quick response to user demand: the personalized alarm subscription requirements of different users and different scenes can be quickly met by a configuration mode.
While the spirit and principles of the invention have been described with reference to several particular embodiments, it is to be understood that the invention is not limited to the disclosed embodiments, nor is the division of aspects, which is for convenience only as the features in such aspects may not be combined to benefit. The invention is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
The limitation of the protection scope of the present invention is understood by those skilled in the art, and various modifications or changes which can be made by those skilled in the art without inventive efforts based on the technical solution of the present invention are still within the protection scope of the present invention.

Claims (10)

1. A customizable alarm subscription forwarding method is characterized by comprising the following steps:
constructing a uniform alarm subscription model by defining an alarm subscription rule, an alarm forwarding template and subscription parameters;
and configuring an alarm subscription rule according to the alarm subscription model, and executing subscription operation through the alarm subscription module according to the alarm subscription rule to realize the whole processing logic of receiving and forwarding the alarm.
2. The customizable alarm subscription forwarding method of claim 1, wherein the model of the alarm subscription rule is as follows:
taking alarm subscription rules as a main table, wherein each rule comprises a plurality of rule filters for determining the range of alarm subscription, and each rule filter comprises a plurality of pieces of matching condition information;
each rule comprises a plurality of subscription parameters and is used for determining parameter information to be configured for different subscription types, and the parameter information is stored in a dictionary table form;
each rule comprises an active alarm forwarding template, a clear alarm forwarding template and an updated alarm forwarding template, and is used for determining rule conversion template information when the three types of alarm messages are forwarded, wherein each template comprises detailed information of a plurality of rule conversion templates.
3. The customizable alarm subscription forwarding method of claim 1, wherein the alarm subscription module comprises:
the alarm receiving submodule is used for receiving the standardized real-time alarm stream from the message middleware;
the rule matching submodule is used for analyzing the alarm attribute information, distributing the alarms meeting the subscription rules to the corresponding subscription rules and discarding the alarms not meeting the subscription rules;
the alarm forwarding submodule is used for constructing alarm content according to the subscription template and forwarding the alarm content;
and the forwarding execution submodule is used for executing different forwarding actions according to different subscription types.
4. The customizable alarm subscription forwarding method of claim 1, wherein the processing logic of the alarm forwarding sub-module is as follows:
receiving alarms from the alarm distribution queue and judging according to the types of the alarms;
if the alarm type is active alarm, traversing the rule list satisfied by the alarm according to the subscription rule matching result, and judging whether the following conditions are satisfied:
initially, setting a forwarding flag =0;
if the alarm belongs to the rule filter and needs to be delayed for forwarding, the alarm is not forwarded immediately, and final forwarding time = alarm occurrence time + delay time is set, and if the final forwarding time < = current time, the alarm is forwarded immediately; starting a timer, waiting for the current time = forwarding end time, and the alarm state =1, distributing the alarm to an active alarm forwarding execution queue of each subscription rule, and setting a forwarding flag =1; if the alarm state =0 in the delay time window, not forwarding, and deleting the alarm from the cache;
if the rule filter to which the alarm belongs does not need to delay forwarding, the alarm is distributed to an active alarm forwarding execution queue of each subscription rule;
if the alarm type is an updating alarm, inquiring the cache according to the unique alarm identifier, and if the alarm type does not exist, discarding the cache; if yes, updating corresponding alarm attribute information in the cache; distributing the alarm to an updating forwarding execution queue of each subscription rule;
if the alarm type is clear alarm, inquiring the cache according to the unique alarm identifier, and if the alarm type does not exist, discarding the cache; if the alarm exists, and if the forwarding mark of the current alarm =0, deleting the alarm from the cache, and simultaneously clearing the alarm without forwarding; and if the forwarding mark of the current alarm =1, distributing the alarm to a clearing forwarding execution queue of each subscription rule, and deleting the corresponding alarm in the cache.
5. A customizable alert subscription forwarding device, the device comprising:
the modeling submodule is used for constructing a uniform alarm subscription model by defining an alarm subscription rule, an alarm forwarding template and subscription parameters;
and the alarm processing module is used for configuring an alarm subscription rule according to the alarm subscription model, and executing subscription operation through the alarm subscription module according to the alarm subscription rule to realize the whole processing logic of receiving and forwarding the alarm.
6. The customizable alarm subscription forwarding device of claim 5, wherein the model of the alarm subscription rule is as follows:
taking alarm subscription rules as a main table, wherein each rule comprises a plurality of rule filters for determining the range of alarm subscription, and each rule filter comprises a plurality of pieces of matching condition information;
each rule comprises a plurality of subscription parameters and is used for determining parameter information to be configured for different subscription types, and the parameter information is stored in a dictionary table form;
each rule comprises an active alarm forwarding template, a clear alarm forwarding template and an updated alarm forwarding template and is used for determining rule conversion template information when the three types of alarm messages are forwarded, wherein each template comprises detailed information of a plurality of rule conversion templates.
7. The customizable alarm subscription forwarding device of claim 5, wherein the alarm subscription module comprises:
the alarm receiving submodule is used for receiving the standardized real-time alarm stream from the message middleware;
the rule matching submodule is used for analyzing the alarm attribute information, distributing the alarms meeting the subscription rules to the corresponding subscription rules and discarding the alarms not meeting the subscription rules;
the alarm forwarding submodule is used for constructing alarm content according to the subscription template and forwarding the alarm content;
and the forwarding execution submodule is used for executing different forwarding actions according to different subscription types.
8. The customizable alarm subscription forwarding device of claim 5, wherein the processing logic of the alarm forwarding sub-module is as follows:
receiving alarms from the alarm distribution queue and judging according to the alarm types;
if the alarm type is active alarm, traversing the rule list satisfied by the alarm according to the subscription rule matching result, and judging whether the following conditions are satisfied:
initially, a forwarding flag =0 is set;
if the rule filter to which the alarm belongs needs to delay forwarding, immediate forwarding is not performed, and the final forwarding time = alarm occurrence time + delay time is set, and if the final forwarding time < = current time, immediate forwarding is performed; starting a timer, waiting for the current time = forwarding end time, and the alarm state =1, distributing the alarm to an active alarm forwarding execution queue of each subscription rule, and setting a forwarding flag =1; if the alarm state =0 in the delay time window, not forwarding, and deleting the alarm from the cache;
if the rule filter to which the alarm belongs does not need to delay forwarding, the alarm is distributed to an active alarm forwarding execution queue of each subscription rule;
if the alarm type is an updated alarm, inquiring the cache according to the unique alarm identifier, and if the alarm type does not exist, discarding the cache; if yes, updating corresponding alarm attribute information in the cache; distributing the alarm to an updating forwarding execution queue of each subscription rule;
if the alarm type is clear alarm, inquiring the cache according to the unique alarm identifier, and if the alarm type does not exist, discarding the cache; if the alarm exists, and if the forwarding mark of the current alarm =0, deleting the alarm from the cache, and simultaneously clearing the alarm without forwarding; and if the forwarding mark of the current alarm =1, distributing the alarm to a clearing forwarding execution queue of each subscription rule, and deleting the corresponding alarm in the cache.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method of any of claims 1-4 when executing the computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program for executing the method of any one of claims 1-4.
CN202211651314.9A 2022-12-21 2022-12-21 Customizable alarm subscription forwarding method and device Pending CN115913885A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211651314.9A CN115913885A (en) 2022-12-21 2022-12-21 Customizable alarm subscription forwarding method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211651314.9A CN115913885A (en) 2022-12-21 2022-12-21 Customizable alarm subscription forwarding method and device

Publications (1)

Publication Number Publication Date
CN115913885A true CN115913885A (en) 2023-04-04

Family

ID=86488161

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211651314.9A Pending CN115913885A (en) 2022-12-21 2022-12-21 Customizable alarm subscription forwarding method and device

Country Status (1)

Country Link
CN (1) CN115913885A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116436772A (en) * 2023-06-08 2023-07-14 上海观安信息技术股份有限公司 Real-time alarm method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050144266A1 (en) * 2003-12-05 2005-06-30 Microsoft Corporation Hosted notifications templates
CN101291256A (en) * 2008-06-02 2008-10-22 杭州华三通信技术有限公司 Method and system for upgrading system log to alarm
CN113593196A (en) * 2021-07-19 2021-11-02 许昌许继软件技术有限公司 Power distribution room alarm information subscription method and system
CN113778614A (en) * 2021-08-03 2021-12-10 科大国创云网科技有限公司 Cluster abnormity monitoring and warning system and method facing enterprise service bus

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050144266A1 (en) * 2003-12-05 2005-06-30 Microsoft Corporation Hosted notifications templates
CN101291256A (en) * 2008-06-02 2008-10-22 杭州华三通信技术有限公司 Method and system for upgrading system log to alarm
CN113593196A (en) * 2021-07-19 2021-11-02 许昌许继软件技术有限公司 Power distribution room alarm information subscription method and system
CN113778614A (en) * 2021-08-03 2021-12-10 科大国创云网科技有限公司 Cluster abnormity monitoring and warning system and method facing enterprise service bus

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116436772A (en) * 2023-06-08 2023-07-14 上海观安信息技术股份有限公司 Real-time alarm method and device, electronic equipment and storage medium
CN116436772B (en) * 2023-06-08 2023-08-11 上海观安信息技术股份有限公司 Real-time alarm method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US10673683B2 (en) Data network notification bar processing system
US11327964B2 (en) Integration query builder framework
US20070124502A1 (en) Script language based network device configuration management system and method
CN109447485B (en) Rule-based real-time decision making system and method
US9942184B2 (en) Communication and management of electronic mail classification information
CN109582289B (en) Method, system, storage medium and processor for processing rule flow in rule engine
KR20110066087A (en) Consolidating duplicate messages for a single destination on a computer network
CN115913885A (en) Customizable alarm subscription forwarding method and device
US8132182B2 (en) Parallel processing of triggering rules in SIP event notification filters
CN110838970A (en) Message distribution method, device and system
CN112052134A (en) Service data monitoring method and device
CN113098854B (en) Task arranging method, system, storage medium and electronic equipment
CN111159207A (en) Information processing method and device
US20230077698A1 (en) Interspersed message batching in a database system
CN115329150A (en) Method and device for generating search condition tree, electronic equipment and storage medium
CN111949719A (en) Method and device for realizing configuration tool of power system and related components
US8688090B2 (en) Data session preferences
US9077612B2 (en) Method for managing configuration information of an outsourced part, and method and system for managing an alarm of an outsourced part
CN112104745A (en) Information configuration system, method, electronic device and storage medium
US20240089216A1 (en) Systems and methods for event processing
CN117240819B (en) Mail configuration method, device, equipment and computer readable storage medium
CN108063823A (en) Data processing method, device, equipment and storage medium
CN111625524B (en) Data processing method, device, equipment and storage medium
CN115809262A (en) Alarm processing method, device and equipment
EP1581869A2 (en) A method and system for dynamically creating parsers in a message broker

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination