CN111510349A - Method, device, equipment and storage medium for service abnormity detection and alarm - Google Patents

Method, device, equipment and storage medium for service abnormity detection and alarm Download PDF

Info

Publication number
CN111510349A
CN111510349A CN202010272655.XA CN202010272655A CN111510349A CN 111510349 A CN111510349 A CN 111510349A CN 202010272655 A CN202010272655 A CN 202010272655A CN 111510349 A CN111510349 A CN 111510349A
Authority
CN
China
Prior art keywords
preset
processed
message
service
retry number
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
CN202010272655.XA
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.)
Dongpu Software Co Ltd
Original Assignee
Dongpu Software 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 Dongpu Software Co Ltd filed Critical Dongpu Software Co Ltd
Priority to CN202010272655.XA priority Critical patent/CN111510349A/en
Publication of CN111510349A publication Critical patent/CN111510349A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • H04L43/0817Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0631Management of faults, events, alarms or notifications using root cause analysis; using analysis of correlation between notifications, alarms or events based on decision criteria, e.g. hierarchy, tree or time analysis
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/16Threshold monitoring

Abstract

The invention relates to the technical field of business safety, and discloses a method, a device, equipment and a storage medium for business anomaly detection and alarm, which are used for improving the processing efficiency of business anomalies. The service abnormity detection and alarm method comprises the following steps: when detecting that the business program is abnormal in the execution process, acquiring corresponding abnormal business data through a preset abnormal processing mechanism; when the corresponding abnormal service data is not a null value, pushing a service program into a message queue to obtain a message to be processed, setting a time to be processed for the message to be processed according to a preset delay time, and setting the current retry number; retrying the message to be processed according to the preset retrying times and the moment to be processed to obtain the final processing result; when the final processing result is that the processing is successful, updating the current retry number to be 0; and when the final processing result is processing failure and the current retry number is equal to the preset retry number, generating and sending alarm information.

Description

Method, device, equipment and storage medium for service abnormity detection and alarm
Technical Field
The present invention relates to the field of service security technologies, and in particular, to a method, an apparatus, a device, and a storage medium for detecting and warning a service anomaly.
Background
The network connection timeout is a situation that the response of the server is not obtained within the default waiting duration of the service program, which results in the network connection timeout, including network disconnection, network instability, network equipment failure and large consumption of system resources.
The existing application software interactive system generally adopts an interface form to perform service interaction, when the version of a butted service system is updated iteratively or a network environment is abnormal, the condition of overtime network connection or access failure occurs, so that service access failure is caused, and unnecessary loss is caused to enterprises or users.
Disclosure of Invention
The invention mainly aims to solve the technical problems of poor operation stability of a service program and low efficiency of processing service exception caused by lack of corresponding service exception processing operation when service operation fails.
The first aspect of the present invention provides a method for detecting and alarming service abnormality, which includes: when detecting that the business program is abnormal in the execution process, acquiring corresponding abnormal business data through a preset abnormal processing mechanism; when the corresponding abnormal service data is not a null value, pushing the service program to a message queue to obtain a message to be processed, setting a time to be processed for the message to be processed according to a preset delay time, and setting the current retry number; retrying the message to be processed according to preset retrying times and the moment to be processed to obtain the final processing result; when the final processing result is that the processing is successful, updating the current retry number to be 0; and when the final processing result is processing failure and the current retry number is equal to the preset retry number, generating alarm information and sending the alarm information to a target terminal.
Optionally, in a first implementation manner of the first aspect of the present invention, when it is detected that an exception occurs in an execution process of a service program, acquiring corresponding exception service data through a preset exception handling mechanism includes: acquiring an interface address corresponding to a service program; sending an access request based on the interface address corresponding to the service program to obtain response data; and when detecting that the business program is abnormal in the execution process, calling a preset abnormal processing mechanism to analyze the response data to obtain corresponding abnormal business data.
Optionally, in a second implementation manner of the first aspect of the present invention, when the corresponding abnormal service data is not a null value, pushing the service program into a message queue to obtain a to-be-processed message, setting a to-be-processed time for the to-be-processed message according to a preset delay time, and setting a current retry number, where the method includes: when the corresponding abnormal service data is not null, acquiring service information corresponding to the service program from a preset information configuration table; converting the service information corresponding to the service program into a message to be processed, pushing the message to be processed into a message queue, and setting a time to be processed for the message to be processed according to a preset delay time; and acquiring the current retry number, and adding 1 to the current retry number, wherein the initial value of the current retry number is 0.
Optionally, in a third implementation manner of the first aspect of the present invention, the retrying the message to be processed according to a preset number of retries and the time to be processed to obtain the final processing result includes: acquiring the current moment; performing difference operation on the time to be processed and the current time to obtain an operation result; and when the operation result is less than or equal to 0, retrying the message to be processed according to a preset retrying number to obtain the final processing result.
Optionally, in a fourth implementation manner of the first aspect of the present invention, when the operation result is less than or equal to 0, performing retry processing on the to-be-processed message according to a preset number of retries to obtain the final processing result, where the retry processing method includes: when the operation result is less than or equal to 0, performing service processing on the message to be processed to obtain an initial processing result; judging whether the initial processing result is a target value or not; if the initial processing result is the target value, determining that the initial processing result is successful, and determining the initial processing result as a final processing result; if the initial processing result is not the target value, determining that the initial processing result is processing failure, repeatedly processing the message to be processed, and updating the current retry number until the repeated processing is successful or the current retry number is equal to the preset retry number, so as to obtain the final processing result.
Optionally, in a fifth implementation manner of the first aspect of the present invention, when the final processing result is processing failure and the current retry number is equal to the preset retry number, generating alarm information and sending the alarm information to a target terminal, includes: when the final processing result is processing failure and the current retry number is equal to the preset retry number, recording the message to be processed into a preset data table, and setting the current retry number to be 0; and setting alarm information for the message to be processed, and sending the alarm information to a target terminal according to a preset mode so that the target terminal displays and reminds the alarm information, wherein the preset mode comprises a mail mode and a message pushing mode.
Optionally, in a sixth implementation manner of the first aspect of the present invention, after generating alarm information and sending the alarm information to a target terminal when the final processing result is processing failure and the current retry number is equal to the preset retry number, the method for detecting and alarming a service anomaly further includes: and recording and analyzing the corresponding abnormal business data to obtain an abnormal analysis report.
A second aspect of the present invention provides a service anomaly detection and alarm device, including: the acquisition module is used for acquiring corresponding abnormal service data through a preset abnormal processing mechanism when detecting that the service program is abnormal in the execution process; the pushing module is used for pushing the service program to a message queue to obtain a message to be processed when the corresponding abnormal service data is not a null value, setting a time to be processed for the message to be processed according to a preset delay time and setting the current retry number; the processing module is used for retrying the message to be processed according to the preset retrying times and the moment to be processed to obtain the final processing result; an updating module, configured to update the current retry number to 0 when the final processing result is that the processing is successful; and the alarm module is used for generating alarm information and sending the alarm information to a target terminal when the final processing result is processing failure and the current retry number is equal to the preset retry number.
Optionally, in a first implementation manner of the second aspect of the present invention, the obtaining module is specifically configured to: acquiring an interface address corresponding to a service program; sending an access request based on the interface address corresponding to the service program to obtain response data; and when detecting that the business program is abnormal in the execution process, calling a preset abnormal processing mechanism to analyze the response data to obtain corresponding abnormal business data.
Optionally, in a second implementation manner of the second aspect of the present invention, the pushing module is specifically configured to: when the corresponding abnormal service data is not null, acquiring service information corresponding to the service program from a preset information configuration table; converting the service information corresponding to the service program into a message to be processed, pushing the message to be processed into a message queue, and setting a time to be processed for the message to be processed according to a preset delay time; and acquiring the current retry number, and adding 1 to the current retry number, wherein the initial value of the current retry number is 0.
Optionally, in a third implementation manner of the second aspect of the present invention, the processing module includes: an acquisition unit configured to acquire a current time; the operation unit is used for performing difference operation on the time to be processed and the current time to obtain an operation result; and the processing unit is used for retrying the message to be processed according to preset retrying times to obtain the final processing result when the operation result is less than or equal to 0.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the processing unit is specifically configured to: when the operation result is less than or equal to 0, performing service processing on the message to be processed to obtain an initial processing result; judging whether the initial processing result is a target value or not; if the initial processing result is the target value, determining that the initial processing result is successful, and determining the initial processing result as a final processing result; if the initial processing result is not the target value, determining that the initial processing result is processing failure, repeatedly processing the message to be processed, and updating the current retry number until the repeated processing is successful or the current retry number is equal to the preset retry number, so as to obtain the final processing result.
Optionally, in a fifth implementation manner of the second aspect of the present invention, the alarm module is specifically configured to: when the final processing result is processing failure and the current retry number is equal to the preset retry number, recording the message to be processed into a preset data table, and setting the current retry number to be 0; and setting alarm information for the message to be processed, and sending the alarm information to a target terminal according to a preset mode so that the target terminal displays and reminds the alarm information, wherein the preset mode comprises a mail mode and a message pushing mode.
Optionally, in a sixth implementation manner of the second aspect of the present invention, the service abnormality detecting and warning device further includes: and the analysis module is used for recording and analyzing the corresponding abnormal business data to obtain an abnormal analysis report.
A third aspect of the present invention provides a device for detecting and warning a service anomaly, including: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line; the at least one processor invokes the instructions in the memory to cause the traffic anomaly detection and warning device to perform the traffic anomaly detection and warning method described above.
A fourth aspect of the present invention provides a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to execute the above-mentioned traffic anomaly detection and alarm method.
In the technical scheme provided by the invention, when detecting that a service program is abnormal in the execution process, acquiring corresponding abnormal service data by a preset abnormal processing mechanism; when the corresponding abnormal service data is not a null value, pushing the service program to a message queue to obtain a message to be processed, setting a time to be processed for the message to be processed according to a preset delay time, and setting the current retry number; retrying the message to be processed according to preset retrying times and the moment to be processed to obtain the final processing result; when the final processing result is that the processing is successful, updating the current retry number to be 0; and when the final processing result is processing failure and the current retry number is equal to the preset retry number, generating alarm information and sending the alarm information to a target terminal. In the embodiment of the invention, the abnormal service program is acquired by adopting an abnormal acquisition mechanism, and the abnormal service program is retried according to the message queue and the preset retry times, so that the running stability and reliability of the service program are improved, the alarm information is sent aiming at the service program which fails to retry, the related personnel can conveniently position and eliminate network faults in time, and the processing efficiency of the abnormal service is improved.
Drawings
Fig. 1 is a schematic diagram of an embodiment of a service anomaly detection and alarm method in an embodiment of the present invention;
fig. 2 is a schematic diagram of another embodiment of a service anomaly detection and alarm method in the embodiment of the present invention;
FIG. 3 is a schematic diagram of an embodiment of a traffic anomaly detection and warning device in an embodiment of the present invention;
fig. 4 is a schematic diagram of another embodiment of a service abnormality detection and alarm device in the embodiment of the present invention;
fig. 5 is a schematic diagram of an embodiment of a service anomaly detection and alarm device in the embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a method, a device, equipment and a storage medium for detecting and alarming service exception, which acquire a service program with execution exception by adopting an exception capture mechanism and retry the service program with execution exception according to a message queue and preset retry times, thereby improving the stability and reliability of service program operation.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of understanding, a specific flow of the embodiment of the present invention is described below, and referring to fig. 1, an embodiment of the method for detecting and warning a service anomaly according to the embodiment of the present invention includes:
101. when detecting that the business program is abnormal in the execution process, acquiring corresponding abnormal business data through a preset abnormal processing mechanism.
The service program comprises a service interaction interface or service logic, and the exception comprises an error which causes operation termination when the service logic operates and the problems of overtime access and access failure when the service interaction interface is in butt joint. The preset exception handling mechanism comprises a try { } catch { } statement block, the try statement block is used for handling program segments which may throw exceptions, and the catch statement block captures exceptions. Further, the server detects the running state of the service program according to a preset exception handling mechanism to obtain a detection result, wherein the detection result comprises a state code, and for example, the state code is 200; when the status code is the target value, the server determines that the service program operates normally, for example, when the target value is 200 and the status code is 200, the server determines that the service program A operates normally; when the status code is not the target value, the server determines that the business program is abnormal in the execution process, and acquires corresponding abnormal business data from the detection result through a preset abnormal processing mechanism, for example, when the status code is 500, the server determines that the business program is abnormal in the execution process and is inconsistent with the target code 200.
It should be noted that, the server needs to add a preset exception handling mechanism for intercepting exceptions at an entrance of the service program in advance, and when the service program runs abnormally, the server captures the exceptions by using the preset exception handling mechanism, so as to ensure that the service program runs normally.
It is to be understood that the execution subject of the present invention may be a service anomaly detection and alarm device, and may also be a terminal or a server, which is not limited herein. The embodiment of the present invention is described by taking a server as an execution subject.
102. And when the corresponding abnormal service data is not a null value, pushing the service program into a message queue to obtain a message to be processed, setting a time to be processed for the message to be processed according to a preset delay time, and setting the current retry number.
The message queue has a preset message delay processing function, that is, the message queue may be a delay queue. Further, when the corresponding abnormal service data is not a null value, the server determines that the execution of the service program is abnormal, so that the server pushes a message of failed execution of the service program in a message queue by using a distributed message middleware rabbitmq or a rocktmq to obtain a message to be processed; the server sets a time to be processed for the message to be processed according to a preset delay time, for example, the preset delay time may be 5 minutes or 3 minutes, and is not limited herein; the server sets the current retry number, for example, when the server performs the first retry process on the service program, the server sets the current retry number to 1.
103. And carrying out retry processing on the message to be processed according to the preset retry times and the time to be processed to obtain a final processing result.
That is, when the calling of the service program fails to perform the service processing, the server writes the service program into the message queue to perform the service exception retry processing. Specifically, the server monitors and processes the message to be processed in the message queue by using a rabbitmq monitoring processing class, for example, the server pushes the service program into the message queue by using the rabbitmq, and executes a first retry processing after 3 minutes; if the execution is successful, the server executes step 104; if the execution fails, the server executes the pending message again after 6 minutes, and so on until the execution succeeds, the server executes step 104, or the server executes step 105 when the current retry number is equal to the preset retry number.
It can be understood that the messages to be processed are arranged in the message queue according to the preset delay time length sequence and are processed according to the same interval time length, the retry operation can automatically process some service exceptions, the normal operation of the service can be recovered without human intervention, and the processing efficiency of the service exceptions is improved.
Optionally, after performing retry operation on the to-be-processed message in the message queue, the server modifies the message state of the to-be-processed message, where the message state includes unprocessed, in-process, successful in-process, and failed in-process, and meanwhile, the current retry number of the to-be-processed message is also incremented by 1. Further, the server will periodically clean up the processed messages.
104. When the final processing result is that the processing is successful, the current retry number is updated to 0.
Further, when the final processing result is that the processing is successful, the server determines that the retry processing of the abnormal service program is successful, and the server sets the current retry number corresponding to the service program to 0. For example, after a user a scans a code to pay a express order, corresponding payment information needs to be received, when short-time network jitter exists, the user a cannot receive the corresponding payment information in time, a server needs to retry the payment service program, when the current retry number is 3 and the final processing result is that the processing is successful, the server performs the operation successfully, the user a can receive the corresponding payment information, and the server updates the current retry number 3 to 0.
105. And when the final processing result is processing failure and the current retry number is equal to the preset retry number, generating alarm information and sending the alarm information to the target terminal.
That is, when the final processing result is processing failure, the server determines whether the current retry number is equal to a preset retry number, and if the current retry number is equal to the preset retry number, the server records service information corresponding to the service program, generates alarm information for the service program, and sends the alarm information to the target terminal, where the sending mode of the alarm information includes mail alarm and message push notification. For example, the preset retry number is 5, and when the current retry number reaches 5, the server sends the warning message in a mail manner, that is, when the service program is abnormal and cannot automatically recover the corresponding function, the server can timely notify relevant personnel to perform processing, so as to ensure the reliability of the execution of the service program.
In the embodiment of the invention, the abnormal service program is acquired by adopting an abnormal acquisition mechanism, and the abnormal service program is retried according to the message queue and the preset retry times, so that the running stability and reliability of the service program are improved, the alarm information is sent aiming at the service program which fails to retry, the related personnel can conveniently position and eliminate network faults in time, and the processing efficiency of the abnormal service is improved.
Referring to fig. 2, another embodiment of the method for detecting and warning service anomaly according to the embodiment of the present invention includes:
201. when detecting that the business program is abnormal in the execution process, acquiring corresponding abnormal business data through a preset abnormal processing mechanism.
Specifically, the server acquires an interface address corresponding to the service program; the server sends an access request based on an interface address corresponding to the service program to obtain response data; when detecting that the business program is abnormal in the execution process, the server calls a preset abnormal processing mechanism to analyze the response data to obtain corresponding abnormal business data. For example, the server sets a preset exception handling mechanism for a code block in a preset system interface, where an exception point may occur, so as to facilitate exception capture by the preset exception handling mechanism, where the preset exception handling mechanism includes try { } catch { } statements and throw { } statements.
202. And when the corresponding abnormal service data is not a null value, pushing the service program into a message queue to obtain a message to be processed, setting a time to be processed for the message to be processed according to a preset delay time, and setting the current retry number.
Specifically, when the corresponding abnormal service data is not a null value, the server acquires service information corresponding to the service program from a preset information configuration table; the server converts the service information into a message to be processed, pushes the message to be processed into a message queue, and sets a time to be processed for the message to be processed according to a preset delay time; the server acquires the current retry number, and adds 1 to the current retry number, wherein the initial value of the current retry number is 0.
Optionally, the message queue sets a to-be-processed time for the to-be-processed message by using the current retry number and a preset delay duration, and further, the server performs a multiplication operation by using the current retry number and the preset delay duration to obtain a retry duration interval, for example, the current retry number is 1, 2, 3, 4, and 5, the preset delay duration is 5 minutes, then the server calculates the retry duration interval obtained by the server according to the current retry number 1, 2, 3, 4, and 5 and the preset delay duration in sequence to be 5min, 10min, 15min, 20min, and 25min, and the server obtains the to-be-processed time corresponding to the to-be-processed message based on the retry duration interval.
203. And acquiring the current moment.
Further, the server obtains the current time according to a preset function, for example, the server obtains the current time by using new Date (). getTime (), and the current time may be in the form of a timestamp. For example, 1585540375 seconds is used to indicate the current time 2020-03-3011: 52: 55.
204. And performing difference operation on the time to be processed and the current time to obtain an operation result.
For example, the time to be processed is 1585540735 seconds, namely 2020-03-3011: 58:55, the current time is 1585540375 seconds, the server subtracts 1585540375 from 1585540735 to obtain an operation result of 360, namely 5 minutes; when the current time is 1585540495, the server subtracts 1585540495 from 1585540735 to obtain an operation result of 240, and until the current time is 1585540735, the server obtains an operation result of 0, and the server performs step 205.
205. And when the operation result is less than or equal to 0, performing retry processing on the message to be processed according to the preset retry number to obtain a final processing result.
Specifically, when the operation result is less than or equal to 0, the server performs service processing on the message to be processed to obtain an initial processing result; the server judges whether the initial processing result is a target value, for example, the target value is 1 to indicate that the processing is successful, and the target value is 0 to indicate that the processing is failed; if the initial processing result is the target value, the server determines that the initial processing result is a successful processing result and determines the initial processing result as a final processing result, and further, the server performs step 206; if the initial processing result is not the target value, the server determines that the initial processing result is processing failure, repeats processing on the message to be processed, and updates the current retry number until the repeated processing is successful or the current retry number is equal to the preset retry number, so as to obtain a final processing result, and further, the server performs step 207.
206. When the final processing result is that the processing is successful, the current retry number is updated to 0.
Step 206 can refer to step 104, and will not be described herein.
207. And when the final processing result is processing failure and the current retry number is equal to the preset retry number, generating alarm information and sending the alarm information to the target terminal.
Specifically, when the final processing result is processing failure and the current retry number is equal to the preset retry number, recording the message to be processed in a preset data table, and setting the current retry number to 0; and setting alarm information for the message to be processed, and sending the alarm information to the target terminal according to a preset mode so that the target terminal displays and reminds the alarm information, wherein the preset mode comprises a mail mode and a message pushing mode. Optionally, the server sets a service configuration item for the service program, and controls the service program to run and stop according to the service configuration item, so as to avoid generating unnecessary error information during the upgrade process of the docking system.
For example, in the actual business processing process, after the post express warehousing operation is executed to realize sign-in, a short message for home pickup needs to be sent to the user, but the short message is sent as an uncontrollable factor. For example, during the upgrade of the related service system, the network environment jitter of the related system, the problem of the user's mobile phone, the temporary problem of the operator channel, the temporary problem of the short message platform system, or the problem of the service system itself may cause the user to fail to receive the pickup short message in time, wherein the user's mobile phone problems include shutdown, power-off, out of service area, and poor signal. Therefore, the preset short message sending interface is subjected to abnormity detection, when the preset short message sending interface is used for realizing the short message sending, the sending failure exists, or the state code is not a target value, a retry processing mechanism is required to be adopted to execute the preset short message sending interface, and a user can be ensured to normally receive the pickup short message; if the pickup short message can not be received finally, warning information needs to be generated for a preset short message sending interface and sent to the target terminal in time, so that the target terminal displays and prompts the warning information, and further, preset intervention measures are adopted for processing, for example, voice dialing measures are adopted to inform a user of pickup.
Optionally, the server may further record abnormal service data corresponding to the service program, and may generate an abnormal analysis report according to the month, where the abnormal analysis report includes the name of the service program, the frequency of occurrence of the abnormality, and the corresponding abnormal service data, and the server sends the abnormal record report to the target terminal, so that the target terminal reminds the target person of testing and adjusting the corresponding service program, thereby reducing the frequency of occurrence of the abnormality of the service program, and improving the stability and reliability of operation of the service program.
In the embodiment of the invention, the abnormal service program is acquired by adopting an abnormal acquisition mechanism, and the abnormal service program is retried according to the message queue and the preset retry times, so that the running stability and reliability of the service program are improved, the alarm information is sent aiming at the service program which fails to retry, the related personnel can conveniently position and eliminate network faults in time, and the processing efficiency of the abnormal service is improved.
The above description of the method for detecting and warning a service anomaly according to the embodiment of the present invention is provided, and the following description of the device for detecting and warning a service anomaly according to the embodiment of the present invention is provided with reference to fig. 3, where an embodiment of the device for detecting and warning a service anomaly according to the embodiment of the present invention includes:
an obtaining module 301, configured to obtain corresponding abnormal service data through a preset exception handling mechanism when detecting that an exception occurs in an execution process of a service program;
the pushing module 302 is configured to, when the corresponding abnormal service data is not a null value, push a service program into a message queue to obtain a to-be-processed message, set a to-be-processed time for the to-be-processed message according to a preset delay time, and set a current retry number;
the processing module 303 is configured to perform retry processing on the to-be-processed message according to the preset retry number and the to-be-processed time to obtain a final processing result;
an updating module 304, configured to update the current retry number to 0 when the final processing result is that the processing is successful;
and an alarm module 305, configured to generate alarm information and send the alarm information to the target terminal when the final processing result is processing failure and the current retry number is equal to the preset retry number.
In the embodiment of the invention, the abnormal service program is acquired by adopting an abnormal acquisition mechanism, and the abnormal service program is retried according to the message queue and the preset retry times, so that the running stability and reliability of the service program are improved, the alarm information is sent aiming at the service program which fails to retry, the related personnel can conveniently position and eliminate network faults in time, and the processing efficiency of the abnormal service is improved.
Referring to fig. 4, another embodiment of the apparatus for detecting and warning service anomaly according to the embodiment of the present invention includes:
an obtaining module 301, configured to obtain corresponding abnormal service data through a preset exception handling mechanism when detecting that an exception occurs in an execution process of a service program;
the pushing module 302 is configured to, when the corresponding abnormal service data is not a null value, push a service program into a message queue to obtain a to-be-processed message, set a to-be-processed time for the to-be-processed message according to a preset delay time, and set a current retry number;
the processing module 303 is configured to perform retry processing on the to-be-processed message according to the preset retry number and the to-be-processed time to obtain a final processing result;
an updating module 304, configured to update the current retry number to 0 when the final processing result is that the processing is successful;
and an alarm module 305, configured to generate alarm information and send the alarm information to the target terminal when the final processing result is processing failure and the current retry number is equal to the preset retry number.
Optionally, the obtaining module 301 may be further specifically configured to:
acquiring an interface address corresponding to a service program;
sending an access request based on an interface address corresponding to the service program to obtain response data;
and when detecting that the business program is abnormal in the execution process, calling a preset abnormal processing mechanism to analyze the response data to obtain corresponding abnormal business data.
Optionally, the pushing module 302 may be further specifically configured to:
when the corresponding abnormal service data is not null, acquiring service information corresponding to the service program from a preset information configuration table;
converting service information corresponding to a service program into a message to be processed, pushing the message to be processed into a message queue, and setting a time to be processed for the message to be processed according to a preset delay time;
and acquiring the current retry number, and adding 1 to the current retry number, wherein the initial value of the current retry number is 0.
Optionally, the processing module 303 further includes:
an obtaining unit 3031, configured to obtain a current time;
an operation unit 3032, configured to perform difference operation on the time to be processed and the current time to obtain an operation result;
and a processing unit 3033, configured to perform retry processing on the to-be-processed message according to the preset retry number when the operation result is less than or equal to 0, to obtain a final processing result.
Optionally, the processing unit 3033 may be further specifically configured to:
when the operation result is less than or equal to 0, performing service processing on the message to be processed to obtain an initial processing result;
judging whether the initial processing result is a target value;
if the initial processing result is the target value, determining the initial processing result as successful processing, and determining the initial processing result as a final processing result;
if the initial processing result is not the target value, determining that the initial processing result is processing failure, repeatedly processing the message to be processed, and updating the current retry number until the repeated processing is successful or the current retry number is equal to the preset retry number, so as to obtain a final processing result.
Optionally, the alarm module 305 may be further specifically configured to:
when the final processing result is processing failure and the current retry number is equal to the preset retry number, recording the message to be processed into a preset data table, and setting the current retry number to be 0;
and setting alarm information for the message to be processed, and sending the alarm information to the target terminal according to a preset mode so that the target terminal displays and reminds the alarm information, wherein the preset mode comprises a mail mode and a message pushing mode.
Optionally, the service anomaly detection and alarm device further includes:
and the analysis module 306 is used for recording and analyzing the corresponding abnormal service data to obtain an abnormal analysis report.
In the embodiment of the invention, the abnormal service program is acquired by adopting an abnormal acquisition mechanism, and the abnormal service program is retried according to the message queue and the preset retry times, so that the running stability and reliability of the service program are improved, the alarm information is sent aiming at the service program which fails to retry, the related personnel can conveniently position and eliminate network faults in time, and the processing efficiency of the abnormal service is improved.
Fig. 3 and fig. 4 describe the service anomaly detection and alarm apparatus in the embodiment of the present invention in detail from the perspective of the modular functional entity, and the service anomaly detection and alarm apparatus in the embodiment of the present invention is described in detail from the perspective of hardware processing.
Fig. 5 is a schematic structural diagram of a service anomaly detection and warning device according to an embodiment of the present invention, where the service anomaly detection and warning device 500 may generate relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) 510 (e.g., one or more processors) and a memory 520, and one or more storage media 530 (e.g., one or more mass storage devices) storing applications 533 or data 532. Memory 520 and storage media 530 may be, among other things, transient or persistent storage. The program stored on the storage medium 530 may include one or more modules (not shown), each of which may include a series of instructions operating on the traffic anomaly detection and alert device 500. Further, the processor 510 may be configured to communicate with the storage medium 530, and execute a series of instruction operations in the storage medium 530 on the service anomaly detection and warning device 500.
The traffic anomaly detection and alert device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input-output interfaces 560, and/or one or more operating systems 531, such as Windows Server, Mac OS X, Unix, L inux, FreeBSD, etc. it will be understood by those skilled in the art that the traffic anomaly detection and alert device structure shown in FIG. 5 does not constitute a limitation of traffic anomaly detection and alert devices, may include more or less components than shown, may combine certain components, or a different arrangement of components.
The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and which may also be a volatile computer-readable storage medium, having stored therein instructions, which, when run on a computer, cause the computer to perform the steps of the traffic anomaly detection and alarm method.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A method for detecting and alarming service abnormality is characterized in that the method for detecting and alarming service abnormality comprises the following steps:
when detecting that the business program is abnormal in the execution process, acquiring corresponding abnormal business data through a preset abnormal processing mechanism;
when the corresponding abnormal service data is not a null value, pushing the service program to a message queue to obtain a message to be processed, setting a time to be processed for the message to be processed according to a preset delay time, and setting the current retry number;
retrying the message to be processed according to preset retrying times and the moment to be processed to obtain the final processing result;
when the final processing result is that the processing is successful, updating the current retry number to be 0;
and when the final processing result is processing failure and the current retry number is equal to the preset retry number, generating alarm information and sending the alarm information to a target terminal.
2. The method for detecting and alarming service abnormality according to claim 1, wherein when detecting that an abnormality occurs in the execution process of the service program, acquiring corresponding abnormal service data by a preset abnormality handling mechanism comprises:
acquiring an interface address corresponding to a service program;
sending an access request based on the interface address corresponding to the service program to obtain response data;
and when detecting that the business program is abnormal in the execution process, calling a preset abnormal processing mechanism to analyze the response data to obtain corresponding abnormal business data.
3. The method for detecting and alarming service abnormality according to claim 1, wherein when the corresponding abnormal service data is not null, pushing the service program into a message queue to obtain a message to be processed, setting a time to be processed for the message to be processed according to a preset delay time, and setting a current retry number, comprises:
when the corresponding abnormal service data is not null, acquiring service information corresponding to the service program from a preset information configuration table;
converting the service information corresponding to the service program into a message to be processed, pushing the message to be processed into a message queue, and setting a time to be processed for the message to be processed according to a preset delay time;
and acquiring the current retry number, and adding 1 to the current retry number, wherein the initial value of the current retry number is 0.
4. The method for detecting and alarming traffic abnormality according to claim 1, wherein the retrying the message to be processed according to the preset retrying number and the time to be processed to obtain the final processing result includes:
acquiring the current moment;
performing difference operation on the time to be processed and the current time to obtain an operation result;
and when the operation result is less than or equal to 0, retrying the message to be processed according to a preset retrying number to obtain the final processing result.
5. The method for detecting and alarming traffic abnormality according to claim 4, wherein when the operation result is less than or equal to 0, retrying the message to be processed according to a preset number of retries to obtain the final processing result, comprising:
when the operation result is less than or equal to 0, performing service processing on the message to be processed to obtain an initial processing result;
judging whether the initial processing result is a target value or not;
if the initial processing result is the target value, determining that the initial processing result is successful, and determining the initial processing result as a final processing result;
if the initial processing result is not the target value, determining that the initial processing result is processing failure, repeatedly processing the message to be processed, and updating the current retry number until the repeated processing is successful or the current retry number is equal to the preset retry number, so as to obtain the final processing result.
6. The method for detecting and alarming traffic abnormality according to claim 1, wherein when the final processing result is processing failure and the current retry number is equal to the preset retry number, generating alarm information and sending the alarm information to a target terminal comprises:
when the final processing result is processing failure and the current retry number is equal to the preset retry number, recording the message to be processed into a preset data table, and setting the current retry number to be 0;
and setting alarm information for the message to be processed, and sending the alarm information to a target terminal according to a preset mode so that the target terminal displays and reminds the alarm information, wherein the preset mode comprises a mail mode and a message pushing mode.
7. The traffic abnormality detection and alarm method according to any one of claims 1 to 6, wherein after said generating alarm information and transmitting said alarm information to a target terminal when said final processing result is a processing failure and said current retry number is equal to said preset retry number, said traffic abnormality detection and alarm method further comprises:
and recording and analyzing the corresponding abnormal business data to obtain an abnormal analysis report.
8. A traffic anomaly detection and warning apparatus, characterized in that said traffic anomaly detection and warning apparatus comprises:
the acquisition module is used for acquiring corresponding abnormal service data through a preset abnormal processing mechanism when detecting that the service program is abnormal in the execution process;
the pushing module is used for pushing the service program to a message queue to obtain a message to be processed when the corresponding abnormal service data is not a null value, setting a time to be processed for the message to be processed according to a preset delay time and setting the current retry number;
the processing module is used for retrying the message to be processed according to the preset retrying times and the moment to be processed to obtain the final processing result;
an updating module, configured to update the current retry number to 0 when the final processing result is that the processing is successful;
and the alarm module is used for generating alarm information and sending the alarm information to a target terminal when the final processing result is processing failure and the current retry number is equal to the preset retry number.
9. A traffic anomaly detection and warning apparatus, characterized in that the traffic anomaly detection and warning apparatus comprises: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line;
the at least one processor invokes the instructions in the memory to cause the traffic anomaly detection and alerting device to perform the traffic anomaly detection and alerting method of any one of claims 1-7.
10. A computer-readable storage medium, having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the traffic anomaly detection and warning method according to any one of claims 1-7.
CN202010272655.XA 2020-04-09 2020-04-09 Method, device, equipment and storage medium for service abnormity detection and alarm Pending CN111510349A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010272655.XA CN111510349A (en) 2020-04-09 2020-04-09 Method, device, equipment and storage medium for service abnormity detection and alarm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010272655.XA CN111510349A (en) 2020-04-09 2020-04-09 Method, device, equipment and storage medium for service abnormity detection and alarm

Publications (1)

Publication Number Publication Date
CN111510349A true CN111510349A (en) 2020-08-07

Family

ID=71876038

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010272655.XA Pending CN111510349A (en) 2020-04-09 2020-04-09 Method, device, equipment and storage medium for service abnormity detection and alarm

Country Status (1)

Country Link
CN (1) CN111510349A (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112291904A (en) * 2020-10-20 2021-01-29 汕头市集信网络科技有限公司 Intelligent street lamp equipment integrated control method, server, system and medium
CN112364079A (en) * 2020-11-12 2021-02-12 北京思特奇信息技术股份有限公司 Multi-service interaction exception handling method and system and electronic equipment
CN112468598A (en) * 2020-12-11 2021-03-09 四川长虹电器股份有限公司 Method for realizing message compensation pushing based on AMQP protocol
CN112817727A (en) * 2021-02-08 2021-05-18 上海百胜软件股份有限公司 Task management method, system, equipment and storage medium based on micro-service architecture
CN112948174A (en) * 2021-02-03 2021-06-11 江苏苏宁物流有限公司 Message processing method and device, computer equipment and storage medium
CN113079112A (en) * 2021-03-25 2021-07-06 北京达佳互联信息技术有限公司 Message processing method and device, electronic equipment and storage medium
CN113627890A (en) * 2021-08-12 2021-11-09 神州数码融信软件有限公司 Method for monitoring and processing abnormal flow in automatic approval flow
CN113965486A (en) * 2021-10-20 2022-01-21 中国工商银行股份有限公司 Line detection method and device for vertically positioning fault
CN114726767A (en) * 2022-02-28 2022-07-08 深圳震有科技股份有限公司 Web service response abnormity detection method, device and storage medium
CN115065674A (en) * 2022-08-03 2022-09-16 北京金堤科技有限公司 Communication method and device
CN115328680A (en) * 2022-09-28 2022-11-11 天津卓朗昆仑云软件技术有限公司 Message queue consumption abnormity assisting method and device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8049911B2 (en) * 2004-12-14 2011-11-01 Canon Kabushiki Kaisha Image forming apparatus including image abnormality detection, method of controlling the same, and program for implementing the method
CN104731912A (en) * 2015-03-24 2015-06-24 浪潮集团有限公司 Message transmission method and device for message middleware MQ
CN107018554A (en) * 2017-03-07 2017-08-04 广东欧珀移动通信有限公司 A kind of data transmission method, device and intelligent terminal
CN107908494A (en) * 2017-11-10 2018-04-13 泰康保险集团股份有限公司 Processing method, device, electronic equipment and the storage medium of anomalous event
CN110858166A (en) * 2018-08-22 2020-03-03 北京国双科技有限公司 Application exception processing method and device, storage medium and processor

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8049911B2 (en) * 2004-12-14 2011-11-01 Canon Kabushiki Kaisha Image forming apparatus including image abnormality detection, method of controlling the same, and program for implementing the method
CN104731912A (en) * 2015-03-24 2015-06-24 浪潮集团有限公司 Message transmission method and device for message middleware MQ
CN107018554A (en) * 2017-03-07 2017-08-04 广东欧珀移动通信有限公司 A kind of data transmission method, device and intelligent terminal
CN107908494A (en) * 2017-11-10 2018-04-13 泰康保险集团股份有限公司 Processing method, device, electronic equipment and the storage medium of anomalous event
CN110858166A (en) * 2018-08-22 2020-03-03 北京国双科技有限公司 Application exception processing method and device, storage medium and processor

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112291904A (en) * 2020-10-20 2021-01-29 汕头市集信网络科技有限公司 Intelligent street lamp equipment integrated control method, server, system and medium
CN112364079A (en) * 2020-11-12 2021-02-12 北京思特奇信息技术股份有限公司 Multi-service interaction exception handling method and system and electronic equipment
CN112468598A (en) * 2020-12-11 2021-03-09 四川长虹电器股份有限公司 Method for realizing message compensation pushing based on AMQP protocol
CN112948174A (en) * 2021-02-03 2021-06-11 江苏苏宁物流有限公司 Message processing method and device, computer equipment and storage medium
CN112817727A (en) * 2021-02-08 2021-05-18 上海百胜软件股份有限公司 Task management method, system, equipment and storage medium based on micro-service architecture
CN113079112A (en) * 2021-03-25 2021-07-06 北京达佳互联信息技术有限公司 Message processing method and device, electronic equipment and storage medium
CN113627890A (en) * 2021-08-12 2021-11-09 神州数码融信软件有限公司 Method for monitoring and processing abnormal flow in automatic approval flow
CN113627890B (en) * 2021-08-12 2024-04-02 神州数码融信软件有限公司 Method for monitoring and processing abnormal flow in automatic approval flow
CN113965486A (en) * 2021-10-20 2022-01-21 中国工商银行股份有限公司 Line detection method and device for vertically positioning fault
CN113965486B (en) * 2021-10-20 2023-04-21 中国工商银行股份有限公司 Line detection method and device for vertically positioning faults
CN114726767A (en) * 2022-02-28 2022-07-08 深圳震有科技股份有限公司 Web service response abnormity detection method, device and storage medium
CN114726767B (en) * 2022-02-28 2024-01-02 深圳震有科技股份有限公司 Web service response abnormality detection method, device and storage medium
CN115065674A (en) * 2022-08-03 2022-09-16 北京金堤科技有限公司 Communication method and device
CN115328680A (en) * 2022-09-28 2022-11-11 天津卓朗昆仑云软件技术有限公司 Message queue consumption abnormity assisting method and device and electronic equipment

Similar Documents

Publication Publication Date Title
CN111510349A (en) Method, device, equipment and storage medium for service abnormity detection and alarm
US7389348B2 (en) System for alerting a monitoring device when call processing failures of a switch exceed a threshold level
US7356729B2 (en) Restoration of network element through employment of bootable image
JP5492788B2 (en) System and apparatus for automatic data anomaly correction in a computer network
US20020162053A1 (en) User transparent software malfunction detection and reporting
US6807265B2 (en) System, method and apparatus for court-ordered surveillance of call records
CN114077525A (en) Abnormal log processing method and device, terminal equipment, cloud server and system
US7757122B2 (en) Remote maintenance system, mail connect confirmation method, mail connect confirmation program and mail transmission environment diagnosis program
CN103810076A (en) Monitoring method and device for data reproduction
CN113495820A (en) Method and device for collecting and processing abnormal information and abnormal monitoring system
US6975705B2 (en) System, method and apparatus for capturing and processing call processing failures occurring at a telephone switch control processor
CN114143225A (en) Method and device for dynamically monitoring abnormal active address based on network detection technology
JPH10214208A (en) System for monitoring abnormality of software
CN115562932A (en) Task monitoring and abnormal self-healing method and device based on multi-interface platform
CN116149932A (en) Method and device for detecting software system state and electronic equipment
CN112969151B (en) Short message monitoring method, device and equipment
CN112783730B (en) Interface monitoring method, device, medium and electronic equipment
CN114257534A (en) Test result processing method, device and system and storage medium
CN111666178A (en) Safety monitoring method and system
JP2003114812A (en) Method, system and program for web page operation monitoring
CN110716903A (en) Log file cleaning method and device
KR20140120200A (en) Early warning system and method for database error
CN117938628A (en) Remote monitoring service downtime method
JPH11272507A (en) Monitoring information notification system and program recording medium for the same
CN114637655A (en) Software state automatic supervision method and system

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200807

RJ01 Rejection of invention patent application after publication