CN114168431B - Method and apparatus for automatically monitoring service, electronic device and storage medium - Google Patents

Method and apparatus for automatically monitoring service, electronic device and storage medium Download PDF

Info

Publication number
CN114168431B
CN114168431B CN202210123313.0A CN202210123313A CN114168431B CN 114168431 B CN114168431 B CN 114168431B CN 202210123313 A CN202210123313 A CN 202210123313A CN 114168431 B CN114168431 B CN 114168431B
Authority
CN
China
Prior art keywords
service
instance information
service instance
information list
management system
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.)
Active
Application number
CN202210123313.0A
Other languages
Chinese (zh)
Other versions
CN114168431A (en
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.)
Beijing Jindi Technology Co Ltd
Original Assignee
Beijing Jindi Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jindi Technology Co Ltd filed Critical Beijing Jindi Technology Co Ltd
Priority to CN202210123313.0A priority Critical patent/CN114168431B/en
Publication of CN114168431A publication Critical patent/CN114168431A/en
Application granted granted Critical
Publication of CN114168431B publication Critical patent/CN114168431B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3006Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system is distributed, e.g. networked systems, clusters, multiprocessor systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3051Monitoring arrangements for monitoring the configuration of the computing system or of the computing system component, e.g. monitoring the presence of processing resources, peripherals, I/O links, software programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data
    • G06F11/3068Monitoring arrangements determined by the means or processing involved in reporting the monitored data where the reporting involves data format conversion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3089Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents
    • G06F11/3093Configuration details thereof, e.g. installation, enabling, spatial arrangement of the probes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/32Monitoring with visual or acoustical indication of the functioning of the machine
    • G06F11/324Display of status information
    • G06F11/327Alarm or error message display

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a method and a device for automatically monitoring service, electronic equipment and a storage medium, wherein the method comprises the following steps: the intermediate service module acquires a first service instance information list in a first service management system as a second service instance information list; the intermediate service module performs format conversion on the second service instance information list according to the service registration format rule to obtain an intermediate service instance information list; the second service management system registers the service instance information in the intermediate service instance information list to obtain a target service instance information list; and the service monitoring system acquires the service instance information corresponding to the information of the service instance to be monitored in the target service instance information list according to the information of the service instance to be monitored, and performs monitoring analysis. The method and the device of the invention realize the function of monitoring the service in the first service management system by the service monitoring system, save a large amount of manpower, material resources and time and reduce the cost.

Description

Method and apparatus for automatically monitoring service, electronic device and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for automatically monitoring a service, an electronic device, and a storage medium.
Background
Prometheus is an open source system monitoring and alarm system that collects metrics from configured targets at given time intervals, evaluates regular expressions, displays results, and triggers alarms when specified conditions are observed. The Nacos (Dynamic Naming and Configuration Service) is a Dynamic Service discovery, Configuration management and Service management platform which is easier to construct cloud native applications. Both of the above middleware are core components in micro service treatment.
At present, the native Prometheus does not support the capability of acquiring service instance information from the Nacos and automatically monitoring and alarming, so the service instance information in the Nacos needs to be manually maintained, a large amount of manpower, physics and time are wasted in the method, the cost is high, and when service or service instance information is newly added to the Nacos, manual maintenance is difficult to realize due to continuous change of an IP address.
Therefore, a method and an apparatus, an electronic device and a storage medium capable of automatically monitoring services are missing in the prior art, so as to perform monitoring analysis on service instance information in the Nacos through Prometheus.
Disclosure of Invention
An object of the present invention is to provide a method and apparatus for automatically monitoring a service, an electronic device, and a storage medium, to solve the above-mentioned problems in the related art.
According to a first aspect of the present invention, there is provided a method of automatically monitoring services, the method comprising: the intermediate service module acquires a first service instance information list in a first service management system as a second service instance information list; the intermediate service module presets a service registration format rule according to a rule acceptable by the second service management system, and performs format conversion on the second service instance information list according to the service registration format rule to obtain an intermediate service instance information list; the second service management system registers the service instance information in the intermediate service instance information list to obtain a target service instance information list; and the service monitoring system acquires the service instance information corresponding to the information of the service instance to be monitored in the target service instance information list according to the information of the service instance to be monitored, and performs monitoring analysis.
Optionally, the method further comprises: and generating a first service instance information list according to the service in the target system monitored by the first service management system.
Optionally, the acquiring, by the intermediary service module, the first service instance information list in the first service management system as the second service instance information list includes: the intermediate service module acquires a service list in the first service management system in real time or at a first preset time interval by calling a service list application program interface of the first service management system; traversing the service list, and acquiring a first service instance information list corresponding to the service in the service list by calling a service instance information list application program interface of the first service management system; and storing the first service instance information list into a local cache, and using the first service instance information list as a second service instance information list.
Optionally, the method further comprises: the intermediate service module responds to the acquired first service instance information list in the first service management system again, and compares the first service instance information list with the second service instance information list; and in response to the comparison result that the first service instance information list and the second service instance information list are different, deleting the second service instance information list, and storing the first service instance information list as the second service instance information list into a local cache.
Optionally, the intermediate service module presets a service registration format rule according to a rule acceptable by the second service management system, and performs format conversion on the second service instance information list according to the service registration format rule to obtain an intermediate service instance information list, where the format conversion includes: the intermediate service module presets a service registration format rule according to a rule acceptable by the second service management system; extracting the service name, the IP address and the port number of the service instance information in the second service instance information list; and according to the service registration format rule, performing format conversion on the service name, the IP address and the port number of the service instance information in the extracted second service instance information list to obtain an intermediate service instance information list.
Optionally, before the second service management system registers the service instance information in the intermediate service instance information list and obtains the target service instance information list, the method further includes: and the intermediate service module sends the intermediate service instance information list to the second service management system for registration by calling a registration service interface of the second service management system.
Optionally, the service monitoring system obtains service instance information corresponding to the information of the service instance to be monitored in the target service instance information list according to the information of the service instance to be monitored, and performs monitoring analysis, including: configuring a service monitoring system according to information of a service instance to be monitored, wherein the information of the service instance to be monitored comprises a service name, an IP address and a port number; and the service monitoring system acquires the service instance information which is the same as the service name, the IP address and the port number of the service instance information to be monitored in the target service instance information list in real time or at a second preset time interval according to the service instance information to be monitored, and performs monitoring analysis.
Optionally, the first service management system includes a Nacos service management system, the second service management system includes a Consul service management system, and the service monitoring system includes a Prometheus service monitoring system.
According to a second aspect of the present invention, there is provided an apparatus for automatically monitoring services, the apparatus comprising: the system comprises a first service management system, an intermediate service module, a second service management system and a service monitoring system; the first service management system is used for generating a first service instance information list according to the service in the target system monitored by the first service management system; the intermediate service module is used for acquiring a first service instance information list in the first service management system as a second service instance information list, presetting a service registration format rule according to a rule acceptable by the second service management system, and performing format conversion on the second service instance information list according to the service registration format rule to obtain an intermediate service instance information list; the second service management system is used for registering the service instance information in the intermediate service instance information list to obtain a target service instance information list; and the service monitoring system is used for acquiring the service instance information corresponding to the information of the service instance to be monitored in the target service instance information list according to the information of the service instance to be monitored, and carrying out monitoring analysis.
According to a third aspect of the present invention, there is provided an electronic apparatus comprising: a memory having a computer program stored thereon; a processor for executing the computer program in memory to implement the steps of any of the above methods.
According to a fourth aspect of the present invention, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of any of the methods described above.
According to the method and the device for automatically monitoring the service, the electronic equipment and the storage medium, the intermediate service instance information list is generated through the intermediate service module, the intermediate service instance information list is registered by the second service management system to obtain the target service instance information list, monitoring analysis is carried out on the service monitoring system, the function that the service monitoring system monitors the service in the first service management system is achieved, the trouble that the service instance information in the first service management system needs to be monitored and maintained manually is omitted, a large amount of manpower, material resources and time are saved, and the cost is reduced; meanwhile, the intermediate service module can update the second service instance information list in time, so that when the service monitoring system monitors and analyzes the service in the first service management system, the service can be added or cancelled in time according to the updated second service instance information list, the monitoring of the cancelled service by the service monitoring system is avoided, resources are wasted, and the resource utilization rate and the operation performance of the service monitoring system are improved.
Additional features and advantages of the invention will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the principles of the invention and not to limit the invention. In the drawings:
FIG. 1 is a flowchart of a method for automatically monitoring services according to an embodiment of the present invention;
FIG. 2 is another flow chart of a first embodiment of a method for automatically monitoring services provided by the present invention;
FIG. 3 is a flowchart of a first embodiment of a method for automatically monitoring services provided by the present invention;
FIG. 4 is a further flowchart of a first embodiment of a method for automatically monitoring services provided by the present invention;
FIG. 5 is a flowchart of a second embodiment of a method for automatically monitoring services provided by the present invention;
FIG. 6 is a block diagram of a third embodiment of an apparatus for automatically monitoring services provided by the present invention;
FIG. 7 is another block diagram of a third embodiment of an apparatus for automatically monitoring services provided by the present invention;
FIG. 8 is a block diagram of a fourth embodiment of an apparatus for automatically monitoring services provided by the present invention;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following detailed description of embodiments of the invention refers to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present invention, are given by way of illustration and explanation only, not limitation.
It should be noted that, in the present invention, the terms "first", "second", and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance, nor order; the terms "S101", "S102", "S201", "S202", etc. are used to distinguish the steps and are not necessarily to be construed as performing method steps in a particular order or sequence; when the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated.
Exemplary method
Fig. 1 is a flowchart illustrating a method for automatically monitoring a service according to an embodiment of the present invention. As shown in fig. 1, the method includes:
step S101: the intermediate service module acquires a first service instance information list in a first service management system as a second service instance information list;
in this embodiment, the first service instance information list and the second service instance information list include at least one piece of service instance information, where each piece of service instance information includes a service name, an IP address, a port number, and a device (e.g., a server, etc.) using the service corresponding to the service.
In an alternative embodiment, as shown in fig. 2, step S101 specifically includes:
step S1011: the intermediate service module acquires a service list in the first service management system in real time or at a first preset time interval by calling a service list application program interface of the first service management system;
the first preset time interval may be selected by a person skilled in the art according to actual needs, and is not limited herein. For example: the first preset time interval may be 10 seconds.
Step S1012: traversing the service list, and acquiring a first service instance information list corresponding to the service in the service list by calling a service instance information list application program interface of the first service management system;
step S1013: and storing the first service instance information list into a local cache, and using the first service instance information list as a second service instance information list.
In this embodiment, the local cache refers to a cache in the intermediate service module, the type of the cache may be redis, Kafka, and the like, and a person skilled in the art may select different types of caches according to actual needs, which is not limited herein.
Step S102: the intermediate service module presets a service registration format rule according to a rule acceptable by the second service management system, and performs format conversion on the second service instance information list according to the service registration format rule to obtain an intermediate service instance information list;
optionally, as shown in fig. 3, step S102 specifically includes:
step S1021: the intermediate service module presets a service registration format rule according to a rule acceptable by the second service management system;
step S1022: extracting the service name, the IP address and the port number of the service instance information in the second service instance information list;
step S1023: and according to the service registration format rule, performing format conversion on the service name, the IP address and the port number of the service instance information in the extracted second service instance information list to obtain an intermediate service instance information list.
Step S103: the second service management system registers the service instance information in the intermediate service instance information list to obtain a target service instance information list;
optionally, before step S103, the intermediate service module sends the intermediate service instance information list to the second service management system for registration by calling a registration service interface of the second service management system.
Step S104: and the service monitoring system acquires the service instance information corresponding to the information of the service instance to be monitored in the target service instance information list according to the information of the service instance to be monitored, and performs monitoring analysis.
Optionally, as shown in fig. 4, step S104 specifically includes:
step S1041: configuring a service monitoring system according to information of a service instance to be monitored, wherein the information of the service instance to be monitored comprises a service name, an IP address and a port number;
step S1042: and the service monitoring system acquires the service instance information which is the same as the service name, the IP address and the port number of the service instance information to be monitored in the target service instance information list in real time or at a second preset time interval according to the service instance information to be monitored, and performs monitoring analysis.
The second preset time interval can be selected by those skilled in the art according to actual needs, and is not limited herein. For example: the second preset time interval may be 5 seconds.
It should be noted that, in this embodiment, the first preset time interval and the second preset time interval may be the same or different, and those skilled in the art may select the first preset time interval and the second preset time interval according to actual needs, which is not limited herein.
In an optional implementation manner, before step S101, the method for automatically monitoring service of this embodiment further includes: and generating a first service instance information list according to the service in the target system monitored by the first service management system.
The target system may be a system in which the first service management system can monitor a service, and a person skilled in the art may select the target system according to actual needs, which is not limited herein.
Further, the method for automatically monitoring service according to the embodiment may further include:
the intermediate service module responds to the acquired first service instance information list in the first service management system again, and compares the first service instance information list with the second service instance information list;
and in response to the comparison result that the first service instance information list and the second service instance information list are different, deleting the second service instance information list, and storing the first service instance information list as the second service instance information list into a local cache.
It should be understood that, by the above method, the service monitoring system in the method for automatically monitoring the service according to this embodiment can add or cancel the service or service instance information according to the change of the service or service instance information in the first service management system, thereby implementing a function of dynamically adjusting the service monitoring system, and improving the resource utilization rate and the operation performance of the service monitoring system.
Optionally, the method for automatically monitoring a service of the present embodiment further includes: and when the monitoring analysis result meets the preset alarm condition, the service monitoring system sends out alarm prompt information.
In this embodiment, the first service management system may include a Nacos service management system, the second service management system may include a Consul service management system (Consul is a micro service registration discovery configuration center), and the service monitoring system may include a promemeus service monitoring system.
According to the method for automatically monitoring the service, the intermediate service module generates the intermediate service instance information list, the second service management system registers the intermediate service instance information list to obtain the target service instance information list, monitoring and analysis are carried out on the service monitoring system, the function that the service monitoring system monitors the service in the first service management system is achieved, the trouble that the service instance information in the first service management system needs to be monitored and maintained manually is omitted, a large amount of manpower, material resources and time are saved, and the cost is reduced; meanwhile, the method for automatically monitoring the service, provided by the embodiment of the invention, has the advantages that the intermediate service module can update the second service instance information list in time, so that when the service monitoring system monitors and analyzes the service in the first service management system, the service can be added or cancelled in time according to the updated second service instance information list, the service monitoring system is prevented from monitoring the cancelled service, the resource is wasted, and the resource utilization rate and the operation performance of the service monitoring system are improved.
In order to make those skilled in the art understand the method for automatically monitoring services provided by the present invention more clearly, the first service management system is a Nacos service management system (Nacos for short), the second service management system is a Consul service management system (Consul for short), and the service monitoring system is a promemeus service monitoring system (promemeus for short), which are taken as examples, and the technical solution of the present invention is described in detail below.
It should be noted that, in the prior art, the service or service instance information in the Nacos cannot be monitored and analyzed by promemeus, and the service or service instance information list in the Consul can be monitored and analyzed by promemeus, so that the embodiment of the present invention implements monitoring and analysis of the service or service instance information in the Nacos by promemeus through the intermediate service module and the Consul.
Fig. 5 is a flowchart of a second embodiment of a method for automatically monitoring services according to the present invention. As shown in fig. 5, the method for automatically monitoring service of the present embodiment includes:
step S201: generating a first service instance information list according to the service in the target system monitored by Nacos;
step S202: the intermediate service module acquires a service list in the Nacos in real time or at a first preset time interval by calling a service list application program interface of the Nacos;
step S203: traversing the service list, and acquiring a first service instance information list corresponding to the service in the service list by calling a service instance information list application program interface of the Nacos;
step S204: storing the first service instance information list to a local cache, and taking the first service instance information list as a second service instance information list;
step S205: the intermediate service module presets a service registration format rule according to a rule acceptable by Consul;
step S206: extracting the service name, the IP address and the port number of the service instance information in the second service instance information list;
step S207: according to the service registration format rule, carrying out format conversion on the service name, the IP address and the port number of the service instance information in the extracted second service instance information list to obtain an intermediate service instance information list;
step S208: the intermediate service module sends the intermediate service instance information list to Consul by calling a Resultful interface of the Consul;
step S209: configuring Prometous according to information of a service instance to be monitored, wherein the information of the service instance to be monitored comprises a service name, an IP address and a port number;
step S210: the Prometheus acquires service instance information which is the same as the service name, the IP address and the port number of the service instance information to be monitored in the target service instance information list in real time or at a second preset time interval according to the service instance information to be monitored, and performs monitoring analysis;
in addition, the method for automatically monitoring a service of the present embodiment further includes: step S211 (not shown) and step S212 (not shown), specifically:
step S211: the intermediate service module responds to the obtained first service instance information list in the Nacos again, and compares the first service instance information list with the second service instance information list;
step S212: in response to the comparison result that the first service instance information list and the second service instance information list are different, deleting the second service instance information list, storing the first service instance information list as the second service instance information list in a local cache, and then executing the steps S205 to S210.
It should be understood that, in step S211 and step S212, the Prometheus in the method for automatically monitoring service according to this embodiment can add or cancel service or service instance information according to a change of the service or service instance information in the Nacos, so that a function of dynamically adjusting the Prometheus is implemented, and resource utilization rate and operation performance of the Prometheus are improved.
Optionally, the method for automatically monitoring a service of the present embodiment further includes: and when the monitoring and analyzing result meets the preset alarm condition, Prometheus sends out alarm prompt information.
According to the method for automatically monitoring the service, the intermediate service instance information list is generated through the Nacos, the intermediate service instance information list is registered through Consul to obtain the target service instance information list, so that the Prometheus monitoring and analyzing are realized, the function of monitoring the service in the Nacos by the Prometheus is realized, the trouble that the service instance information in the Nacos needs to be monitored and maintained manually is eliminated, a large amount of manpower, material resources and time are saved, and the cost is reduced; meanwhile, the method for automatically monitoring the service, provided by the embodiment of the invention, has the advantages that the intermediate service module can update the second service instance information list in time, so that when the Prometheus monitors and analyzes the service in the Nacos, the service can be added or cancelled in time according to the updated second service instance information list, the Prometheus is prevented from monitoring the cancelled service, the resource is wasted, and the resource utilization rate and the operation performance of the Prometheus are improved.
Exemplary devices
Fig. 6 is a block diagram of a third embodiment of an apparatus for automatically monitoring services provided by the present invention. As shown in fig. 6, the present invention also provides an apparatus for automatically monitoring a service, the apparatus including: a first service management system 301, an intermediate service module 302, a second service management system 303 and a service monitoring system 304; the first service management system 301 is configured to generate a first service instance information list according to the service in the target system monitored by the first service management system 301; the intermediate service module 302 is configured to obtain a first service instance information list in the first service management system 301 as a second service instance information list, preset a service registration format rule according to a rule acceptable by the second service management system 303, and perform format conversion on the second service instance information list according to the service registration format rule to obtain an intermediate service instance information list; the second service management system 303 is configured to register service instance information in the intermediate service instance information list to obtain a target service instance information list; and the service monitoring system 304 is configured to obtain service instance information corresponding to the information of the service instance to be monitored in the target service instance information list according to the information of the service instance to be monitored, and perform monitoring analysis.
The target system may be a system in which the first service management system can monitor a service, and a person skilled in the art may select the target system according to actual needs, which is not limited herein.
Optionally, in this embodiment, the first service instance information list and the second service instance information list include at least one piece of service instance information, where each piece of service instance information includes a service name, an IP address, a port number, and a device (e.g., a server, etc.) using the service, which correspond to the service.
Optionally, as shown in fig. 6, the first service management system 301 further includes: a service list application interface 3011 and a service instance information list application interface 3012; the service list application program interface 3011 is configured to enable the intermediate service module 302 to obtain a service list in the first service management system 301 through the service list application program interface 3011; the service instance information list application interface 3012 is configured to enable the intermediate service module 302 to obtain a first service instance information list corresponding to a service in the service list.
Optionally, as shown in fig. 7, the intermediate service module 301 further includes: an acquisition module 3021, a storage module 3022, and a registration format conversion module 3023; the obtaining module 3021 is configured to obtain, in real time or at a first preset time interval, a service list in the first service management system 301 by calling the service list application program interface 3011 of the first service management system 301, traverse the service list, and obtain a first service instance information list corresponding to a service in the service list by calling the service instance information list application program interface 3012 of the first service management system 301; a storage module 3022, configured to store the first service instance information list in a local cache, and use the first service instance information list as a second service instance information list; the registration format conversion module 3023 is configured to preset a service registration format rule according to a rule that is acceptable by the second service management system 303, and perform format conversion on the second service instance information list according to the service registration format rule to obtain an intermediate service instance information list.
Optionally, the intermediary service module 302 further comprises: the service instance information list updating module is used for responding to the first service instance information list obtained from the first service management system again and comparing the first service instance information list with the second service instance information list; and in response to a comparison result that the first service instance information list and the second service instance information list are different, deleting the second service instance information list, and storing the first service instance information list as the second service instance information list into a local cache.
Optionally, the registration format conversion module 3023 is specifically configured to: presetting a service registration format rule according to a rule acceptable by the second service management system 303; extracting the service name, the IP address and the port number of the service instance information in the second service instance information list; and according to the service registration format rule, performing format conversion on the service name, the IP address and the port number of the service instance information in the extracted second service instance information list to obtain an intermediate service instance information list.
The first preset time interval may be selected by a person skilled in the art according to actual needs, and is not limited herein. For example: the first preset time interval may be 10 seconds.
In this embodiment, the local cache refers to a cache in the intermediate service module, the type of the cache may be redis, Kafka, and the like, and a person skilled in the art may select different types of caches according to actual needs, which is not limited herein.
Optionally, as shown in fig. 7, the second service management system 303 further includes: and a service registration interface 3031, configured to send the intermediate service instance information list to the second service management system for registration by the intermediate service module.
Optionally, as shown in fig. 7, the service monitoring system 304 further includes: a configuration module 3041 and a monitoring analysis module 3042; the configuration module 3041 is configured to configure the service monitoring system 304 according to information of a service instance to be monitored, where the information of the service instance to be monitored includes a service name, an IP address, and a port number; the monitoring analysis module 3042 is configured to obtain, in real time or at a second preset time interval, service instance information that is the same as the service name, the IP address, and the port number of the service instance information to be monitored in the target service instance information list according to the service instance information to be monitored, and perform monitoring analysis.
The second preset time interval can be selected by those skilled in the art according to actual needs, and is not limited herein. For example: the second preset time interval may be 5 seconds.
It should be noted that, in this embodiment, the first preset time interval and the second preset time interval may be the same or different, and those skilled in the art may select the first preset time interval and the second preset time interval according to actual needs, which is not limited herein.
Optionally, the apparatus for automatically monitoring a service of this embodiment further includes: an alarm module (not shown in the figures); and the alarm module is used for sending alarm prompt information when the monitoring and analyzing result meets the preset alarm condition.
Optionally, as shown in fig. 8, the first service management system includes a Nacos service management system, the second service management system includes a Consul service management system, and the service monitoring system includes a Prometheus service monitoring system. For the description of the apparatus for the automatic monitoring service shown in fig. 8, reference may be made to the apparatus for the automatic monitoring service shown in fig. 6 and 7, which will not be described herein again.
In addition, the apparatus described in fig. 6 to 8 corresponds to the method described in fig. 1 to 5, and the explanation can be mutually referred to.
According to the device for automatically monitoring the service, the intermediate service module generates the intermediate service instance information list, the second service management system registers the intermediate service instance information list to obtain the target service instance information list, monitoring and analysis are carried out on the service monitoring system, the function that the service monitoring system monitors the service in the first service management system is achieved, the trouble that the service instance information in the first service management system needs to be monitored and maintained manually is omitted, a large amount of manpower, material resources and time are saved, and the cost is reduced; meanwhile, the device for automatically monitoring the service, provided by the embodiment of the invention, can update the second service instance information list in time because the intermediate service module can timely increase the service or cancel the service according to the updated second service instance information list when the service monitoring system monitors and analyzes the service in the first service management system, so that the service monitoring system is prevented from monitoring the service which is cancelled, resources are wasted, and the resource utilization rate and the operation performance of the service monitoring system are improved.
Exemplary electronic device
Fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. The electronic device may be either or both of the first device and the second device, or a stand-alone device separate from them, which stand-alone device may communicate with the first device and the second device to receive the acquired input signals therefrom. As shown in fig. 9, the electronic device 40 includes one or more processors 41 and memory 42.
The processor 41 may be a Central Processing Unit (CPU) or other form of processing unit having data processing capabilities and/or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.
Memory 42 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, Random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, Read Only Memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer readable storage medium and executed by processor 41 to implement the methods for determining an actual control person and/or other desired functionality of the software programs of the various embodiments of the present disclosure described above. In one example, the electronic device may further include: an input device 43 and an output device 44, which are interconnected by a bus system and/or other form of connection mechanism (not shown).
The input device 43 may also include, for example, a keyboard, a mouse, and the like.
The output device 44 can output various kinds of information to the outside. The output devices 44 may include, for example, a display, speakers, a printer, and a communication network and its connected remote output devices, among others.
Of course, for simplicity, only some of the components of the electronic device relevant to the present disclosure are shown in fig. 9, omitting components such as buses, input/output interfaces, and the like. In addition, the electronic device may include any other suitable components, depending on the particular application.
Exemplary computer program product and storage Medium
In addition to the above-described methods and apparatus, embodiments of the present disclosure may also be a computer program product comprising computer program instructions that, when executed by a processor, cause the processor to perform the steps in the method for determining an actual control person according to various embodiments of the present disclosure described in the "exemplary methods" section above of this specification.
The computer program product may write program code for carrying out operations for embodiments of the present disclosure in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, embodiments of the present disclosure may also be a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, cause the processor to perform steps in a method for determining an actual controlling person according to various embodiments of the present disclosure described in the "exemplary methods" section above in this specification.
The computer-readable storage medium may take any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, 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.
The foregoing describes the general principles of the present disclosure in conjunction with specific embodiments, however, it is noted that the advantages, effects, etc. mentioned in the present disclosure are merely examples and are not limiting, and they should not be considered essential to the various embodiments of the present disclosure. Furthermore, the foregoing disclosure of specific details is for the purpose of illustration and description and is not intended to be limiting, since the disclosure is not intended to be limited to the specific details so described.
In the present specification, the embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts in the embodiments are referred to each other. For the system embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The block diagrams of devices, apparatuses, systems referred to in this disclosure are only given as illustrative examples and are not intended to require or imply that the connections, arrangements, configurations, etc. must be made in the manner shown in the block diagrams. These devices, apparatuses, devices, systems may be connected, arranged, configured in any manner, as will be appreciated by those skilled in the art. Words such as "including," "comprising," "having," and the like are open-ended words that mean "including, but not limited to," and are used interchangeably therewith. The words "or" and "as used herein mean, and are used interchangeably with, the word" and/or, "unless the context clearly dictates otherwise. The word "such as" is used herein to mean, and is used interchangeably with, the phrase "such as but not limited to".
The methods and apparatus of the present disclosure may be implemented in a number of ways. For example, the methods and apparatus of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above-described order for the steps of the method is for illustration only, and the steps of the method of the present disclosure are not limited to the order specifically described above unless specifically stated otherwise. Further, in some embodiments, the present disclosure may also be embodied as programs recorded in a recording medium, the programs including machine-readable instructions for implementing the methods according to the present disclosure. Thus, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.
It is also noted that in the devices, apparatuses, and methods of the present disclosure, each component or step can be decomposed and/or recombined. These decompositions and/or recombinations are to be considered equivalents of the present disclosure. The previous description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects without departing from the scope of the disclosure. Thus, the present disclosure is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing description has been presented for purposes of illustration and description. Furthermore, this description is not intended to limit embodiments of the disclosure to the form disclosed herein. While a number of example aspects and embodiments have been discussed above, those of skill in the art will recognize certain variations, modifications, alterations, additions and sub-combinations thereof.

Claims (11)

1. A method of automatically monitoring services, the method comprising:
the intermediate service module acquires a first service instance information list in a first service management system as a second service instance information list;
the intermediate service module presets a service registration format rule according to a rule acceptable by a second service management system, and performs format conversion on the second service instance information list according to the service registration format rule to obtain an intermediate service instance information list;
the second service management system registers the service instance information in the intermediate service instance information list to obtain a target service instance information list;
and the service monitoring system acquires the service instance information corresponding to the information of the service instance to be monitored in the target service instance information list according to the information of the service instance to be monitored, and performs monitoring analysis.
2. The method of claim 1, further comprising: and generating the first service instance information list according to the service in the target system monitored by the first service management system.
3. The method of claim 1, wherein the intermediate service module obtaining a first service instance information list in a first service management system as a second service instance information list comprises:
the intermediate service module acquires a service list in the first service management system in real time or at a first preset time interval by calling a service list application program interface of the first service management system;
traversing the service list, and acquiring the first service instance information list corresponding to the service in the service list by calling a service instance information list application program interface of the first service management system;
and storing the first service instance information list to a local cache, and using the first service instance information list as the second service instance information list.
4. The method of claim 3, further comprising:
the intermediate service module responds to the first service instance information list obtained from the first service management system again, and compares the first service instance information list with the second service instance information list;
and in response to a comparison result that the first service instance information list and the second service instance information list are different, deleting the second service instance information list, and storing the first service instance information list as the second service instance information list into the local cache.
5. The method according to claim 1, wherein the intermediate service module presets a service registration format rule according to a rule acceptable by a second service management system, and performs format conversion on the second service instance information list according to the service registration format rule to obtain an intermediate service instance information list, and the method includes:
the intermediate service module presets a service registration format rule according to a rule acceptable by a second service management system;
extracting the service name, the IP address and the port number of the service instance information in the second service instance information list;
and according to the service registration format rule, performing format conversion on the service name, the IP address and the port number of the service instance information in the extracted second service instance information list to obtain the intermediate service instance information list.
6. The method according to claim 1, wherein the second service management system registers the service instance information in the intermediate service instance information list, and before obtaining the target service instance information list, the method further comprises:
and the intermediate service module sends the intermediate service instance information list to the second service management system for registration by calling a registration service interface of the second service management system.
7. The method according to claim 1, wherein the service monitoring system obtains service instance information corresponding to the service instance information to be monitored in the target service instance information list according to the service instance information to be monitored, and performs monitoring analysis, including:
configuring the service monitoring system according to the information of the service instance to be monitored, wherein the information of the service instance to be monitored comprises a service name, an IP address and a port number;
and the service monitoring system acquires the service instance information which is the same as the service name, the IP address and the port number of the service instance information to be monitored in the target service instance information list in real time or at a second preset time interval according to the service instance information to be monitored, and performs monitoring analysis.
8. The method of claim 1, wherein the first service management system comprises a Nacos service management system, wherein the second service management system comprises a Consul service management system, and wherein the service monitoring system comprises a Prometheus service monitoring system.
9. An apparatus for automatically monitoring services, the apparatus comprising: the system comprises a first service management system, an intermediate service module, a second service management system and a service monitoring system;
the first service management system is used for generating a first service instance information list according to the service in the target system monitored by the first service management system;
the intermediate service module is used for acquiring a first service instance information list in a first service management system as a second service instance information list, presetting a service registration format rule according to the rule acceptable by the second service management system, and performing format conversion on the second service instance information list according to the service registration format rule to obtain an intermediate service instance information list;
the second service management system is used for registering the service instance information in the intermediate service instance information list to obtain a target service instance information list;
and the service monitoring system is used for acquiring service instance information corresponding to the to-be-monitored service instance information in the target service instance information list according to the to-be-monitored service instance information, and performing monitoring analysis.
10. An electronic device, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to carry out the steps of the method of any one of claims 1 to 8.
11. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 8.
CN202210123313.0A 2022-02-10 2022-02-10 Method and apparatus for automatically monitoring service, electronic device and storage medium Active CN114168431B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210123313.0A CN114168431B (en) 2022-02-10 2022-02-10 Method and apparatus for automatically monitoring service, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210123313.0A CN114168431B (en) 2022-02-10 2022-02-10 Method and apparatus for automatically monitoring service, electronic device and storage medium

Publications (2)

Publication Number Publication Date
CN114168431A CN114168431A (en) 2022-03-11
CN114168431B true CN114168431B (en) 2022-04-15

Family

ID=80489572

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210123313.0A Active CN114168431B (en) 2022-02-10 2022-02-10 Method and apparatus for automatically monitoring service, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN114168431B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106992994A (en) * 2017-05-24 2017-07-28 腾讯科技(深圳)有限公司 A kind of automatically-monitored method and system of cloud service
CN110515795A (en) * 2019-07-29 2019-11-29 北京百分点信息科技有限公司 A kind of monitoring method of big data component, device, electronic equipment
CN111459770A (en) * 2020-04-01 2020-07-28 深圳市伊欧乐科技有限公司 Server operation state warning method and device, server and storage medium
CN111752805A (en) * 2020-07-01 2020-10-09 浪潮云信息技术股份公司 Cloud server resource monitoring and warning system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3543853A1 (en) * 2018-03-20 2019-09-25 Siemens Healthcare GmbH Providing microservice information

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106992994A (en) * 2017-05-24 2017-07-28 腾讯科技(深圳)有限公司 A kind of automatically-monitored method and system of cloud service
CN110515795A (en) * 2019-07-29 2019-11-29 北京百分点信息科技有限公司 A kind of monitoring method of big data component, device, electronic equipment
CN111459770A (en) * 2020-04-01 2020-07-28 深圳市伊欧乐科技有限公司 Server operation state warning method and device, server and storage medium
CN111752805A (en) * 2020-07-01 2020-10-09 浪潮云信息技术股份公司 Cloud server resource monitoring and warning system

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
Development Frameworks for Microservice-based Applications: Evaluation and Comparison;Hai Dinh-Tuan 等;《Proceedings of the 2020 European Symposium on Software Engineering》;20201221;第12–20页 *
MisMesh: Security Issues and Challenges in Service Meshes;Dalton A. Hahn 等;《International Conference on Security and Privacy in Communication Systems》;20201212;第140-151页 *
基于Docker、Swarm、Consul与Nginx构建高可用和可扩展Web服务框架的方法;张宁溪 等;《电信技术》;20161125;第21-25页 *
基于Prometheus的工业云平台监控告警服务系统;郭建磊 等;《信息技术与信息化》;20211225(第12期);第142-145页 *

Also Published As

Publication number Publication date
CN114168431A (en) 2022-03-11

Similar Documents

Publication Publication Date Title
CN108829560A (en) Data monitoring method, device, computer equipment and storage medium
WO2011121296A1 (en) Network monitor
US10097427B2 (en) Service assurance platform as a user-defined service
CN111198859B (en) Data processing method, device, electronic equipment and computer readable storage medium
CN110543327B (en) Service component multiplexing method, device, computer equipment and storage medium
CN112965879A (en) Data processing method and device, electronic equipment and readable storage medium
US10585722B2 (en) Integrating heterogeneous business events in hybrid cloud environments
CN110457049A (en) Realize method, apparatus, electronic equipment and the storage medium of plug-in unit automation
WO2015187001A2 (en) System and method for managing resources failure using fast cause and effect analysis in a cloud computing system
CN114238037B (en) High-concurrency service request result storage method and device, electronic equipment and storage medium
CN113835969A (en) Micro-service monitoring method, device, equipment and storage medium
US20210035125A1 (en) Predictive AI Automated Cloud Service Turn-Up
CN110704025A (en) Method and device for generating coding specification tool, storage medium and electronic equipment
CN114168431B (en) Method and apparatus for automatically monitoring service, electronic device and storage medium
US20200142770A1 (en) Internet of things appliance diagnostics
CN113220342A (en) Centralized configuration method and device, electronic equipment and storage medium
CN111831503B (en) Monitoring method based on monitoring agent and monitoring agent device
CN111104577A (en) Data processing method and device, computer readable storage medium and electronic equipment
KR20170122874A (en) Apparatus for managing log of application based on data distribution service
CN111651314A (en) Cloud-based Promethus rule file management method and device
CN115480877A (en) External exposure method and device of application service in multi-cluster environment
CN113704281A (en) Data format conversion method and device, storage medium and electronic equipment
US10740214B2 (en) Management computer, data processing system, and data processing program
CN112445498B (en) Program installation method and device, electronic equipment and storage medium
CN112416698A (en) Monitoring system expansion method and device, storage medium and electronic equipment

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
GR01 Patent grant
GR01 Patent grant