CN110196790A - The method and apparatus of abnormal monitoring - Google Patents
The method and apparatus of abnormal monitoring Download PDFInfo
- Publication number
- CN110196790A CN110196790A CN201810156740.2A CN201810156740A CN110196790A CN 110196790 A CN110196790 A CN 110196790A CN 201810156740 A CN201810156740 A CN 201810156740A CN 110196790 A CN110196790 A CN 110196790A
- Authority
- CN
- China
- Prior art keywords
- monitored
- abnormal
- monitoring
- code
- preset
- 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
Links
- 230000002159 abnormal effect Effects 0.000 title claims abstract description 147
- 238000012544 monitoring process Methods 0.000 title claims abstract description 132
- 238000000034 method Methods 0.000 title claims abstract description 109
- 238000012545 processing Methods 0.000 claims description 42
- 230000005856 abnormality Effects 0.000 claims description 34
- 238000002347 injection Methods 0.000 claims description 14
- 239000007924 injection Substances 0.000 claims description 14
- 238000004590 computer program Methods 0.000 claims description 9
- 230000008569 process Effects 0.000 claims description 9
- 238000010586 diagram Methods 0.000 description 17
- 230000006870 function Effects 0.000 description 13
- 238000004891 communication Methods 0.000 description 7
- 230000003287 optical effect Effects 0.000 description 4
- 238000012986 modification Methods 0.000 description 3
- 230000004048 modification Effects 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 239000000835 fiber Substances 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 239000004065 semiconductor Substances 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 239000008186 active pharmaceutical agent Substances 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000014509 gene expression Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 230000008447 perception Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/22—Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
- G06F11/26—Functional testing
- G06F11/263—Generation of test inputs, e.g. test vectors, patterns or sequences ; with adaptation of the tested hardware for testability with external testers
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses the method and apparatus of abnormal monitoring, are related to field of computer technology.One specific embodiment of this method, which comprises determining that in the source code of system to be monitored, needs monitored monitored object;The monitored object includes: class and/or method;In the system to be monitored starting, abnormal monitoring code is injected in Xiang Suoshu monitored object;Abnormal monitoring is carried out to the system to be monitored based on the abnormal monitoring code.The embodiment can dynamic acquisition system to be monitored occurs in the case where the source code of lossless system to be monitored various exceptions, realize the management on large to magnanimity system;By the way of hardware and software platform management, convenient for searching and retrieving the various exceptions that system to be monitored occurs;Can give notice in time information when system to be monitored occurs abnormal;The exception information that system to be monitored occurs can be visualized.
Description
Technical Field
The invention relates to the technical field of computers, in particular to an abnormity monitoring method and device.
Background
In the newly online system, because sufficient tests are not performed, a lot of codes can throw various exceptions. A system that is otherwise functioning properly may, for some reason, report a large number of anomalies. How to timely find various abnormalities of the system is a technical problem which needs to be solved urgently.
In the prior art, most system users find various problems of the system and feed the problems back to system developers. The system developer checks by manual methods such as searching the log of the system to find the position of the system where the abnormality occurs.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
1) the later perception is that the abnormity of the system cannot be obtained in time;
2) the pure manual treatment cannot realize automatic monitoring;
3) the efficiency is low;
4) large-scale management of mass systems cannot be realized.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for monitoring an anomaly, which can dynamically acquire various anomalies occurring in a system to be monitored without damaging a source code of the system to be monitored, so as to implement large-scale management on a mass system; the method adopts a platform management mode, so that various abnormalities appearing in the system to be monitored can be conveniently searched and retrieved; the system can send out notification information in time when the system to be monitored is abnormal; the abnormal information of the system to be monitored can be visually displayed.
To achieve the above object, according to an aspect of an embodiment of the present invention, there is provided an abnormality monitoring method including:
determining a monitored object to be monitored in a source code of a system to be monitored; the monitoring object includes: class, and/or method;
when the system to be monitored is started, injecting an abnormal monitoring code into the monitored object;
and carrying out exception monitoring on the system to be monitored based on the exception monitoring code.
Optionally, determining a monitored object to be monitored in source code of a system to be monitored includes:
traversing all classes in the source code, and taking the class with a preset class name as a class to be monitored; traversing all methods corresponding to the class to be monitored, and taking the method with the preset method name as the method to be monitored; and taking the class to be monitored and the method to be monitored as the monitoring object.
Optionally, performing anomaly monitoring on the system to be monitored based on the monitoring code, including:
capturing abnormal information of the system to be monitored by using the monitoring code, and determining a code identifier of the abnormal information; and determining the code position of the abnormality in the system to be monitored based on the code identification.
Optionally, after determining a position of an abnormality in the system to be monitored, the method further includes:
periodically sending the abnormal records to a preset position, and writing the abnormal records of the preset position into a preset storage position; the exception record includes: all exception information, and a code location corresponding to each of the exception information.
Optionally, after writing the exception record of the preset location into the preset storage location, the method further includes:
and analyzing and processing the abnormal records in the preset storage position according to a preset mode.
Optionally, after analyzing and processing the exception record in the preset storage location in a preset manner, the method further includes:
visually displaying the exception record after analysis processing; and/or sending out notification information according to the abnormal record after the analysis processing.
According to still another aspect of the embodiments of the present invention, there is provided an abnormality monitoring apparatus including: an injection module; the injection module includes: the device comprises a determining unit, an injecting unit and a monitoring unit; wherein,
the determining unit determines a monitored object to be monitored in a source code of a system to be monitored; the monitoring object includes: class, and/or method;
the injection unit injects an abnormal monitoring code into the monitored object when the system to be monitored is started;
and the monitoring unit monitors the abnormality of the system to be monitored based on the abnormality monitoring code.
Optionally, the determining unit determines a monitored object to be monitored in the source code of the system to be monitored, including:
traversing all classes in the source code, and taking the class with a preset class name as a class to be monitored; traversing all methods corresponding to the class to be monitored, and taking the method with the preset method name as the method to be monitored; and taking the class to be monitored and the method to be monitored as the monitoring object.
Optionally, the monitoring unit performs exception monitoring on the system to be monitored based on the monitoring code, and includes:
capturing abnormal information of the system to be monitored by using the monitoring code, and determining a code identifier of the abnormal information; and determining the code position of the abnormality in the system to be monitored based on the code identification.
Optionally, the apparatus for monitoring an anomaly according to the embodiment of the present invention further includes: a reporting module and a collecting module; after the abnormal position in the system to be monitored is determined, the reporting module periodically sends the abnormal record to a preset position, and the collecting module writes the abnormal record of the preset position into a preset storage position; the exception record includes: all exception information, and a code location corresponding to each of the exception information.
Optionally, the apparatus for monitoring an anomaly according to the embodiment of the present invention further includes: an analysis module; and after writing the abnormal record of the preset position into the preset storage position, the analysis module analyzes and processes the abnormal record in the preset storage position according to a preset mode.
Optionally, the apparatus for monitoring an anomaly according to the embodiment of the present invention further includes: a presentation module and/or a notification module; after analyzing and processing the abnormal records in the preset storage position according to a preset mode, the display module visually displays the abnormal records after analysis and processing; and/or the notification module sends out notification information according to the abnormal record after analysis and processing.
According to another aspect of the embodiments of the present invention, there is provided an abnormality monitoring electronic device including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the method for monitoring an exception provided in the first aspect of the embodiments of the present invention.
According to a further aspect of the embodiments of the present invention, there is provided a computer readable medium, on which a computer program is stored, which when executed by a processor, implements the method for anomaly monitoring provided by the first aspect of the embodiments of the present invention.
One embodiment of the above invention has the following advantages or benefits:
(1) the method comprises the steps of injecting an abnormal monitoring code into a monitored object, carrying out abnormal monitoring on a system to be monitored based on the abnormal monitoring code, dynamically acquiring various abnormalities of the system to be monitored under the condition of no damage to a source code of the system to be monitored, and realizing large-scale management of a mass system;
(2) the method comprises the following steps that a class with a preset class name and a method with a preset method name are used as monitoring objects, the preset class name and the preset method name can be selected and set according to actual conditions, and personalized monitoring can be achieved;
(3) the code position where the abnormality occurs in the system to be monitored is determined according to the code identifier of the abnormal information, so that the abnormal position can be quickly positioned;
(4) the abnormal records are periodically sent to the preset position, and the abnormal records at the preset position are written into the preset storage position, so that asynchronous processing of abnormal record reporting and abnormal record analysis can be realized, and the processing efficiency is improved;
(5) the method adopts a platform management mode, sends out notification information according to the abnormal record after analysis and processing, and can send out the notification information in time when the system to be monitored is abnormal; the abnormal information of the system to be monitored is visually displayed, so that various abnormalities of the system to be monitored can be conveniently searched and retrieved.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a main flow of a method of anomaly monitoring according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of the main flow of a method of capturing an anomaly record according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of the main flow of a method of anomaly monitoring according to an alternative embodiment of the present invention;
FIG. 4 is a schematic diagram of the main modules of an anomaly monitoring apparatus according to an embodiment of the present invention;
FIG. 5 is an architectural diagram of an anomaly monitoring apparatus according to an alternative embodiment of the present invention;
FIG. 6 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 7 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Compared with the abnormal situation of the system needing to be found manually in the prior art, the abnormal monitoring code is injected into the source code of the system to be monitored, so that various abnormal situations of the system to be monitored can be obtained dynamically under the condition that the source code of the system to be monitored is not damaged, and the large-scale management of a mass system can be realized. In addition, the embodiment of the invention adopts a platform management mode, so that various exceptions of the system to be monitored can be conveniently searched and retrieved.
It should be noted that, in the case of no conflict, the embodiments and technical features mentioned in the present invention may be combined with each other.
Fig. 1 is a schematic diagram of a main flow of a method for monitoring an anomaly according to an embodiment of the present invention, as shown in fig. 1, the method for monitoring an anomaly includes:
s101, determining a monitored object to be monitored in a source code of a system to be monitored; the monitoring object includes: class, and/or method;
step S102, when the system to be monitored is started, an abnormal monitoring code is injected into the monitored object;
and S103, carrying out abnormity monitoring on the system to be monitored based on the abnormity monitoring code.
The system to be monitored according to the embodiment of the present invention may be various systems, for example, a system running in a JVM (Java virtual Machine). And when the system is abnormal, capturing abnormal information of the system in time. The system is monitored for the abnormity based on the abnormity monitoring code, various abnormity occurring in the system can be dynamically acquired under the condition of no damage to the source code of the system, and the large-scale management of the mass system is realized.
Determining a monitored object to be monitored in source code of a system to be monitored may include: traversing all classes in the source code, and taking the class with a preset class name as a class to be monitored; traversing all methods corresponding to the class to be monitored, and taking the method with the preset method name as the method to be monitored; and taking the class to be monitored and the method to be monitored as the monitoring object. In the embodiment of the invention, the class with the preset class name and the method with the preset method name are used as monitoring objects. A person skilled in the art can select and set the preset class name and the preset method name according to the actual application scenario and the monitoring requirement, so that personalized monitoring is realized, and the application range of the embodiment of the invention is expanded.
Take the example that the source file of the system to be monitored is a Java source file. After being compiled, each Class (or interface) of the Java source file occupies a Class file separately, which is a binary stream file of 8-bit bytes, with the individual data items and instruction lines arranged in close sequence from front to back. The main task of injecting exception-monitoring code is to find those instructions that contain exception-throwing and-catching, and then dynamically add exception-monitoring code in the JVM around these instructions. Since the binary stream file has high professional requirements on users and is not easy to read, other development libraries can be used.
For simpler source files, the step of injecting exception monitoring code may be implemented by AspectJ. AspectJ is a cut-plane oriented framework that extends the Java language (Java is an object-oriented programming language in which cross-platform applications can be written). AspectJ defines the AOP (Aspect Oriented Programming) syntax, so it has a specialized compiler to generate a Class file that complies with the Java byte coding specification.
For more complex source files, the step of injecting exception-monitoring code may be implemented by ASM. ASM is a Java bytecode manipulation framework. It can be used to dynamically generate classes or to enhance the functionality of existing classes.
Fig. 2 is a schematic diagram of a main flow of a method of capturing an anomaly record according to an embodiment of the present invention. As shown in fig. 2, the method for injecting the exception-monitoring code includes:
1) creating an entry class to dynamically modify the source code of the system before the main function (main function) is run by the JVM;
2) implementing static function premain, namely creating a public static premain function in the created entry class;
3) the method comprises the steps of realizing a ClassFileTransformer, namely creating a self-defined class inherited to the ClassFileTransformer, wherein the self-defined class and the self-defined class are used for searching for classes and methods which need to be added with exception monitoring codes in source codes (the classes and the methods are configured in advance by developers, and the configuration mode can adopt regular expressions, such as com.jd.wms.; )
4) Implementing a subclass of methodaddresser class;
5) reloading the visitTryCatchBlock function in the subclass of the Methodadapter class; the process of reloading the visitTryCatchBlock function is actually a process of adding an exception monitoring code for capturing exception information into a class and a method which need exception monitoring;
6) and capturing the abnormal information by using the visitTryCatchBlock function, and positioning the abnormal position corresponding to the abnormal information. In the practical application process, an abnormal record can be formed according to the captured abnormal information and the corresponding abnormal position of the captured abnormal information, and the abnormal record is sent to a specified file;
7) circularly checking, namely, if there are exceptions, the exceptions need to be captured;
8) if not, ending; otherwise, jump to step 7).
Performing anomaly monitoring on the system to be monitored based on the monitoring code, which may include: capturing abnormal information of the system to be monitored by using the monitoring code, and determining a code identifier of the abnormal information; and determining the code position of the abnormality in the system to be monitored based on the code identification. Compared with the abnormal position needing to be searched manually in the prior art, the abnormal code position in the system is determined according to the code identification of the abnormal information, the abnormal position can be located quickly, the efficiency is high, and the accuracy is good.
After determining the position of the abnormality in the system to be monitored, the method may further include: periodically sending the abnormal records to a preset position, and writing the abnormal records of the preset position into a preset storage position; the exception record includes: all exception information, and a code location corresponding to each of the exception information. The preset position or the preset storage position can be selected and set according to actual conditions as long as the abnormal record can be stored. For example, the preset location may be a server cluster for collecting the exception information and the exception location thereof, and the preset storage location may be a disk of a system for analyzing and processing the exception record.
In some embodiments, the running condition of the system to be monitored can be monitored in real time, if the system to be monitored is abnormal, abnormal information is captured in time, abnormal records are sent to the specified position in real time, and then the abnormal records in the specified position are sent to the preset position at regular intervals. Compared with the method of sending the abnormal record to the preset position in real time, the method of sending the abnormal record periodically can greatly reduce the sending frequency and reduce the occupation of system computing resources.
After the exception record is written into the preset storage position, the exception record can be acquired from the preset storage position for analysis processing. By sending the abnormal record to the preset position and writing the abnormal record of the preset position into the preset storage position, asynchronous processing of abnormal record reporting and abnormal record analysis can be realized, and processing efficiency is improved.
After writing the exception record of the preset location into the preset storage location, the method may further include: and analyzing and processing the abnormal records in the preset storage position according to a preset mode. The preset mode can be selected and designed according to actual situations, and the embodiment of the present invention is not particularly limited in this respect. For example, classifying the abnormal records in the preset position to obtain the abnormal conditions of each category; for another example, the abnormal records in the preset position are judged and analyzed to determine whether the number of the abnormal records of a certain type exceeds a preset number threshold value, so as to judge whether an alarm notification needs to be sent; for another example, a visual presentation file is generated according to the abnormal records in the preset position, so that each abnormal record can be visually presented to the user.
After analyzing and processing the exception record in the preset storage location according to a preset mode, the method may further include: visually displaying the exception record after analysis processing; and/or sending out notification information according to the abnormal record after the analysis processing. And a platform management mode is adopted, notification information is sent according to the abnormal record after analysis and processing, and the notification information can be sent in time when the system to be monitored is abnormal. The mode of sending the notification information can be designed according to actual conditions, as long as the object to be notified can be notified. Such as by sms, mail, IM (instant message), etc. The abnormal information of the system to be monitored is visually displayed, so that various abnormalities of the system to be monitored can be conveniently searched and retrieved. For example, the abnormality record after the analysis processing is sent to a Web (Web page) program, and is visually displayed by the Web program.
Fig. 3 is a schematic diagram of the main flow of a method of anomaly monitoring according to an alternative embodiment of the present invention. As shown in fig. 3, the method of anomaly monitoring includes:
injecting an abnormal monitoring code when a system to be monitored is started;
when capturing abnormal information, periodically writing abnormal records into a preset position;
storing the abnormal record of the preset position into a file system; the file system may be a disk of a system for analyzing and processing the exception record;
analyzing and processing the abnormal record stored in the file system according to a preset mode;
and sending a summary alarm according to a preset period, and sending the analyzed and processed abnormal record to a search engine such as Solr or ES. Solr is a stand-alone enterprise-level search application server that provides an API interface to the outside similar to Web-services. A user can submit an XML file with a certain format to a search engine server through an Http (Hyper Text Transfer Protocol) request to generate an index; it can also make a search request through Http Get operation, and Get a return result in XML (Extensible Markup Language, a subset of standard universal Markup Language, which is a Markup Language for marking electronic documents to make them have structure). Es, ElasticSearch, is a Lucene-based search server. It provides a distributed multi-user capability full-text search engine based on RESTful Web interface. ES is developed in the Java language and released as open source under the Apache licensing terms, and is currently a popular enterprise-level search engine. The system is designed and used in cloud computing, can achieve real-time search, and is stable, reliable, rapid, and convenient to install and use;
and displaying the abnormal record after analysis processing after the user logs in the search engine.
According to yet another aspect of an embodiment of the present invention, there is provided an apparatus for anomaly monitoring.
Fig. 4 is a schematic diagram of main blocks of an apparatus for anomaly monitoring according to an embodiment of the present invention. As shown in fig. 4, the abnormality monitoring apparatus 400 includes: an injection module 401; the injection module 401 includes: a determination unit 4011, an injection unit 4012 and a monitor control unit 4013; wherein,
the determining unit 4011 determines a monitored object to be monitored in a source code of a system to be monitored; the monitoring object includes: class, and/or method;
when the system to be monitored is started, the injection unit 4012 injects an abnormal monitoring code into the monitored object;
the monitoring unit 4013 monitors the abnormality of the system to be monitored based on the abnormality monitoring code.
Optionally, the determining unit 4011 determines the monitored object that needs to be monitored in the source code of the system to be monitored, including:
traversing all classes in the source code, and taking the class with a preset class name as a class to be monitored; traversing all methods corresponding to the class to be monitored, and taking the method with the preset method name as the method to be monitored; and taking the class to be monitored and the method to be monitored as the monitoring object.
Optionally, the monitoring unit 4013 performs anomaly monitoring on the system to be monitored based on the monitoring code, including:
capturing abnormal information of the system to be monitored by using the monitoring code, and determining a code identifier of the abnormal information; and determining the code position of the abnormality in the system to be monitored based on the code identification.
Optionally, the apparatus 400 for monitoring an anomaly according to the embodiment of the present invention further includes: a reporting module 402 and a collecting module 403; after the abnormal position in the system to be monitored is determined, the reporting module periodically sends the abnormal record to a preset position, and the collecting module writes the abnormal record of the preset position into a preset storage position; the exception record includes: all exception information, and a code location corresponding to each of the exception information.
Optionally, the apparatus 400 for monitoring an anomaly according to the embodiment of the present invention further includes: an analysis module 404; and after writing the abnormal record of the preset position into the preset storage position, the analysis module analyzes and processes the abnormal record in the preset storage position according to a preset mode.
Optionally, the apparatus 400 for monitoring an anomaly according to the embodiment of the present invention further includes: a presentation module 405 and/or a notification module 406; after analyzing and processing the abnormal records in the preset storage position according to a preset mode, the display module visually displays the abnormal records after analysis and processing; and/or the notification module sends out notification information according to the abnormal record after analysis and processing.
Fig. 5 is a schematic diagram of an architecture of an anomaly monitoring apparatus according to an alternative embodiment of the present invention. As shown in fig. 5, each application server is a system to be monitored in the embodiment of the present invention. The application server 1, the application servers 2, … … and the application server n are respectively provided with an injection module and a reporting module. And when the application server is abnormal, capturing abnormal information in time and positioning an abnormal position corresponding to the abnormal information. The reporting module is provided with an abnormal information reporting program used for periodically sending the abnormal record of the corresponding server to a preset position, namely an abnormal information collection server cluster in the figure. And the abnormal information collection server cluster sends the abnormal records in the abnormal information collection server cluster to the monitoring/analysis server cluster, and the monitoring/analysis server cluster carries out various classification and processing on the received abnormal records. And the monitoring/analyzing server cluster sends the processed abnormal records to the Web display server cluster so as to visually display each abnormal problem for the user. Meanwhile, after the monitoring/analysis server cluster performs various classifications and processing on the received abnormal records, a notification mode is determined, for example, by a short message service, an email, an Instant Message (IM), and the like, and then notification information is sent through a notification system.
According to another aspect of the embodiments of the present invention, there is provided an abnormality monitoring electronic device including:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the method for monitoring an exception provided in the first aspect of the embodiments of the present invention.
Fig. 6 illustrates an exemplary system architecture 600 to which the method of anomaly monitoring or the apparatus of anomaly monitoring of an embodiment of the present invention may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 601, 602, 603 to interact with the server 605 via the network 604 to receive or send messages or the like. The terminal devices 601, 602, 603 may have installed thereon various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 605 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 601, 602, 603. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the method for monitoring the abnormality provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, the apparatus for monitoring the abnormality is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, shown is a block diagram of a computer system 700 suitable for use with a terminal device implementing an embodiment of the present invention. The terminal device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present invention may be implemented by software, or may be implemented by hardware. The described units or modules may also be provided in a processor, and may be described as: a processor comprising: the injection module comprises a determination unit, an injection unit and a monitoring unit; the method comprises the steps that a determining unit determines a monitored object to be monitored in a source code of a system to be monitored; when the system to be monitored is started, an injection unit injects an abnormal monitoring code into the monitored object; and the monitoring unit monitors the abnormality of the system to be monitored based on the abnormality monitoring code. The names of these units or modules do not in some cases constitute a definition of the unit itself, and for example, the determination unit may also be described as a "unit that injects an abnormal monitoring code into the monitoring object when the system to be monitored is started".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: determining a monitored object to be monitored in a source code of a system to be monitored; the monitoring object includes: class, and/or method; when the system to be monitored is started, injecting an abnormal monitoring code into the monitored object; and carrying out exception monitoring on the system to be monitored based on the exception monitoring code.
According to the technical scheme of the embodiment of the invention, the method has the following beneficial effects:
(1) the method comprises the steps of injecting an abnormal monitoring code into a monitored object, carrying out abnormal monitoring on a system to be monitored based on the abnormal monitoring code, dynamically acquiring various abnormalities of the system to be monitored under the condition of no damage to a source code of the system to be monitored, and realizing large-scale management of a mass system;
(2) the method comprises the following steps that a class with a preset class name and a method with a preset method name are used as monitoring objects, the preset class name and the preset method name can be selected and set according to actual conditions, and personalized monitoring can be achieved;
(3) the code position where the abnormality occurs in the system to be monitored is determined according to the code identifier of the abnormal information, so that the abnormal position can be quickly positioned;
(4) the abnormal records are periodically sent to the preset position, and the abnormal records at the preset position are written into the preset storage position, so that asynchronous processing of abnormal record reporting and abnormal record analysis can be realized, and the processing efficiency is improved;
(5) the method adopts a platform management mode, sends out notification information according to the abnormal record after analysis and processing, and can send out the notification information in time when the system to be monitored is abnormal; the abnormal information of the system to be monitored is visually displayed, so that various abnormalities of the system to be monitored can be conveniently searched and retrieved.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (14)
1. A method of anomaly monitoring, comprising:
determining a monitored object to be monitored in a source code of a system to be monitored; the monitoring object includes: class, and/or method;
when the system to be monitored is started, injecting an abnormal monitoring code into the monitored object;
and carrying out exception monitoring on the system to be monitored based on the exception monitoring code.
2. The method of claim 1, wherein determining monitoring objects in source code of a system to be monitored that need to be monitored comprises:
traversing all classes in the source code, and taking the class with a preset class name as a class to be monitored; traversing all methods corresponding to the class to be monitored, and taking the method with the preset method name as the method to be monitored; and taking the class to be monitored and the method to be monitored as the monitoring object.
3. The method of claim 2, wherein monitoring the system to be monitored for anomalies based on the monitoring code comprises:
capturing abnormal information of the system to be monitored by using the monitoring code, and determining a code identifier of the abnormal information; and determining the code position of the abnormality in the system to be monitored based on the code identification.
4. The method of claim 3, wherein determining a location of an anomaly in the system to be monitored further comprises:
periodically sending the abnormal records to a preset position, and writing the abnormal records of the preset position into a preset storage position; the exception record includes: all exception information, and a code location corresponding to each of the exception information.
5. The method of claim 4, wherein writing the exception record for the predetermined location to the predetermined storage location further comprises:
and analyzing and processing the abnormal records in the preset storage position according to a preset mode.
6. The method of claim 5, wherein after analyzing the exception record in the predetermined storage location in a predetermined manner, further comprising:
visually displaying the exception record after analysis processing; and/or sending out notification information according to the abnormal record after the analysis processing.
7. An anomaly monitoring apparatus, comprising: an injection module; the injection module includes: the device comprises a determining unit, an injecting unit and a monitoring unit; wherein,
the determining unit determines a monitored object to be monitored in a source code of a system to be monitored; the monitoring object includes: class, and/or method;
the injection unit injects an abnormal monitoring code into the monitored object when the system to be monitored is started;
and the monitoring unit monitors the abnormality of the system to be monitored based on the abnormality monitoring code.
8. The apparatus of claim 7, wherein the determining unit determines the monitored object to be monitored in the source code of the system to be monitored, comprises:
traversing all classes in the source code, and taking the class with a preset class name as a class to be monitored; traversing all methods corresponding to the class to be monitored, and taking the method with the preset method name as the method to be monitored; and taking the class to be monitored and the method to be monitored as the monitoring object.
9. The apparatus of claim 8, wherein the monitoring unit monitors the system to be monitored for anomalies based on the monitoring code, comprising:
capturing abnormal information of the system to be monitored by using the monitoring code, and determining a code identifier of the abnormal information; and determining the code position of the abnormality in the system to be monitored based on the code identification.
10. The apparatus of claim 9, further comprising: a reporting module and a collecting module; after the abnormal position in the system to be monitored is determined, the reporting module periodically sends the abnormal record to a preset position, and the collecting module writes the abnormal record of the preset position into a preset storage position; the exception record includes: all exception information, and a code location corresponding to each of the exception information.
11. The apparatus of claim 10, further comprising: an analysis module; and after writing the abnormal record of the preset position into the preset storage position, the analysis module analyzes and processes the abnormal record in the preset storage position according to a preset mode.
12. The apparatus of claim 11, further comprising: a presentation module and/or a notification module; after analyzing and processing the abnormal records in the preset storage position according to a preset mode, the display module visually displays the abnormal records after analysis and processing; and/or the notification module sends out notification information according to the abnormal record after analysis and processing.
13. An anomaly monitoring electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
14. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810156740.2A CN110196790A (en) | 2018-02-24 | 2018-02-24 | The method and apparatus of abnormal monitoring |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810156740.2A CN110196790A (en) | 2018-02-24 | 2018-02-24 | The method and apparatus of abnormal monitoring |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110196790A true CN110196790A (en) | 2019-09-03 |
Family
ID=67743997
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810156740.2A Pending CN110196790A (en) | 2018-02-24 | 2018-02-24 | The method and apparatus of abnormal monitoring |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110196790A (en) |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111949481A (en) * | 2020-08-11 | 2020-11-17 | 安徽继远检验检测技术有限公司 | Anomaly tracking detection system based on micro-service |
CN112486823A (en) * | 2020-11-30 | 2021-03-12 | 建信金融科技有限责任公司 | Error code checking method and device, electronic equipment and readable storage medium |
CN112783716A (en) * | 2019-11-11 | 2021-05-11 | 北京沃东天骏信息技术有限公司 | Monitoring method and device |
CN112948726A (en) * | 2021-03-29 | 2021-06-11 | 建信金融科技有限责任公司 | Method, device and system for processing abnormal information |
CN113094225A (en) * | 2020-01-09 | 2021-07-09 | 北京搜狗科技发展有限公司 | Abnormal log monitoring method and device and electronic equipment |
CN113254023A (en) * | 2021-05-14 | 2021-08-13 | 网易(杭州)网络有限公司 | Object reading method and device and electronic equipment |
CN113259022A (en) * | 2021-05-17 | 2021-08-13 | 深圳英智源智能系统有限公司 | Receiving and sending sharing monitoring method, unit, system and storage medium |
CN113377629A (en) * | 2020-03-09 | 2021-09-10 | 北京沃东天骏信息技术有限公司 | Method and device for monitoring user abnormal codes |
CN113760720A (en) * | 2021-01-07 | 2021-12-07 | 北京沃东天骏信息技术有限公司 | Code abnormal information display method and device |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101276271A (en) * | 2007-03-29 | 2008-10-01 | 北京邮电大学 | Method and interceptor system facing to tangent plane programming |
US20150106348A1 (en) * | 2013-10-15 | 2015-04-16 | Oracle International Corporation | Monitoring business transaction failures involving database procedure calls |
CN106909498A (en) * | 2015-12-22 | 2017-06-30 | 阿里巴巴集团控股有限公司 | A kind of java applet injects the method and system of failure |
-
2018
- 2018-02-24 CN CN201810156740.2A patent/CN110196790A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101276271A (en) * | 2007-03-29 | 2008-10-01 | 北京邮电大学 | Method and interceptor system facing to tangent plane programming |
US20150106348A1 (en) * | 2013-10-15 | 2015-04-16 | Oracle International Corporation | Monitoring business transaction failures involving database procedure calls |
CN106909498A (en) * | 2015-12-22 | 2017-06-30 | 阿里巴巴集团控股有限公司 | A kind of java applet injects the method and system of failure |
Cited By (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112783716A (en) * | 2019-11-11 | 2021-05-11 | 北京沃东天骏信息技术有限公司 | Monitoring method and device |
CN112783716B (en) * | 2019-11-11 | 2024-04-05 | 北京沃东天骏信息技术有限公司 | Monitoring method and device |
CN113094225A (en) * | 2020-01-09 | 2021-07-09 | 北京搜狗科技发展有限公司 | Abnormal log monitoring method and device and electronic equipment |
CN113094225B (en) * | 2020-01-09 | 2024-03-01 | 北京搜狗科技发展有限公司 | Abnormal log monitoring method and device and electronic equipment |
CN113377629A (en) * | 2020-03-09 | 2021-09-10 | 北京沃东天骏信息技术有限公司 | Method and device for monitoring user abnormal codes |
CN111949481A (en) * | 2020-08-11 | 2020-11-17 | 安徽继远检验检测技术有限公司 | Anomaly tracking detection system based on micro-service |
CN112486823B (en) * | 2020-11-30 | 2023-06-09 | 建信金融科技有限责任公司 | Error code verification method and device, electronic equipment and readable storage medium |
CN112486823A (en) * | 2020-11-30 | 2021-03-12 | 建信金融科技有限责任公司 | Error code checking method and device, electronic equipment and readable storage medium |
CN113760720A (en) * | 2021-01-07 | 2021-12-07 | 北京沃东天骏信息技术有限公司 | Code abnormal information display method and device |
CN112948726A (en) * | 2021-03-29 | 2021-06-11 | 建信金融科技有限责任公司 | Method, device and system for processing abnormal information |
CN113254023B (en) * | 2021-05-14 | 2023-08-11 | 网易(杭州)网络有限公司 | Object reading method and device and electronic equipment |
CN113254023A (en) * | 2021-05-14 | 2021-08-13 | 网易(杭州)网络有限公司 | Object reading method and device and electronic equipment |
CN113259022A (en) * | 2021-05-17 | 2021-08-13 | 深圳英智源智能系统有限公司 | Receiving and sending sharing monitoring method, unit, system and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110196790A (en) | The method and apparatus of abnormal monitoring | |
CN107491488B (en) | Page data acquisition method and device | |
CN111190888A (en) | Method and device for managing graph database cluster | |
CN113987074A (en) | Distributed service full-link monitoring method and device, electronic equipment and storage medium | |
CN107506256B (en) | Method and device for monitoring crash data | |
US11580294B2 (en) | Techniques for web framework detection | |
CN113568626B (en) | Dynamic packaging and application package opening method and device and electronic equipment | |
CN111813685B (en) | Automatic test method and device | |
CN110874307A (en) | Event buried point collecting and reporting method and device | |
CN113342619A (en) | Log monitoring method and system, electronic device and readable medium | |
CN114840379A (en) | Log generation method, device, server and storage medium | |
CN112818026A (en) | Data integration method and device | |
CN114153703A (en) | Micro-service exception positioning method and device, electronic equipment and program product | |
CN111435326A (en) | Method and device for analyzing crash logs | |
CN113762910A (en) | Document monitoring method and device | |
CN111241048A (en) | Web terminal log management method, device, medium and electronic equipment | |
CN108628909B (en) | Information pushing method and device | |
CN113138974B (en) | Method and device for detecting database compliance | |
CN115454956A (en) | Log generation method and device, electronic equipment and storage medium | |
CN110554892A (en) | Information acquisition method and device | |
CN110888583B (en) | Page display method, system and device and electronic equipment | |
CN111460273B (en) | Information pushing method and device | |
CN113282455A (en) | Monitoring processing method and device | |
CN113760568A (en) | Data processing method and device | |
CN110891010B (en) | Method and apparatus for transmitting information |
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 |