Nothing Special   »   [go: up one dir, main page]

CN110659104B - Service monitoring method and related equipment - Google Patents

Service monitoring method and related equipment Download PDF

Info

Publication number
CN110659104B
CN110659104B CN201910810931.0A CN201910810931A CN110659104B CN 110659104 B CN110659104 B CN 110659104B CN 201910810931 A CN201910810931 A CN 201910810931A CN 110659104 B CN110659104 B CN 110659104B
Authority
CN
China
Prior art keywords
monitoring
container
service
manager
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.)
Active
Application number
CN201910810931.0A
Other languages
Chinese (zh)
Other versions
CN110659104A (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.)
Simplecredit Micro-Lending Co ltd
Original Assignee
Simplecredit Micro-Lending 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 Simplecredit Micro-Lending Co ltd filed Critical Simplecredit Micro-Lending Co ltd
Priority to CN201910810931.0A priority Critical patent/CN110659104B/en
Publication of CN110659104A publication Critical patent/CN110659104A/en
Application granted granted Critical
Publication of CN110659104B publication Critical patent/CN110659104B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • 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/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • 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
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications

Landscapes

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

Abstract

The embodiment of the invention discloses a business monitoring method and related equipment, wherein the method is applied to the technical field of computers and comprises the following steps: and sending a container screening instruction carrying the label of the service container to be monitored to the manager according to a preset time interval to instruct the manager to determine the identification information of the target monitoring service container matched with the label from the started service container and return the identification information. Further, after receiving the identifier information returned by the manager, the manager may send a monitoring instruction to the manager based on the identifier information, so as to instruct the manager to manage the target monitoring service container corresponding to the identifier information and execute the corresponding preset monitoring script. By adopting the mode, the monitoring on the container service process can be more effectively realized while the resources are saved.

Description

Service monitoring method and related equipment
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a service monitoring method and related devices.
Background
The Docker container is an open-source application container engine, so that developers can package their applications and dependence packages into a portable container, and then distribute the container to any popular Linux machine, and can also realize virtualization. The containers are fully sandboxed, do not have any interfaces with each other (like the app of an iPhone), have little performance overhead, and can easily run in machines and data centers.
The Docker container provides 6 resource isolation technologies, wherein an inter-process communication NameSpace IPC NameSpace is used for isolating communication among process groups divided into different IPC NameSpaces, and communication cannot be achieved through a message queue, a shared memory and a semaphore. In the prior art, if a service process in a container a needs to be monitored, a new container B is started to monitor the service process in the container a, wherein the container B needs to share an IPC NameSpace with the container a to realize monitoring. By adopting the monitoring mode, on one hand, because the container B depends on the container A, if the container A fails, the container B also fails; on the other hand, if a plurality of containers are started on one physical machine to run the business process, a plurality of monitoring containers need to be started, which causes a great deal of resource waste. Therefore, how to more effectively monitor the container service process while saving resources becomes an urgent problem to be solved.
Disclosure of Invention
Embodiments of the present invention provide a service monitoring method and related devices, which can save resources and more effectively monitor a container service process.
In a first aspect, an embodiment of the present invention provides a service monitoring method, where the method is applied to a monitoring container running on a physical machine, where a manager and at least one service container run on the physical machine, and the at least one service container is uniformly managed by the manager, and the method includes:
sending a container screening instruction carrying labels of service containers to be monitored to the manager according to a preset time interval to indicate the manager to determine identification information of a target monitoring service container matched with the labels from the started service containers and return the identification information to the monitoring containers, wherein the target monitoring service containers are one or more of the started service containers;
receiving the identification information returned by the manager;
and sending a monitoring instruction to the manager based on the identification information to instruct the manager to manage the target monitoring service containers corresponding to the identification information to execute the corresponding preset monitoring scripts.
In an embodiment, before the container screening instruction carrying the labels of the service containers to be monitored is sent to the manager at the preset time interval, the service containers to be monitored may be determined from the at least one service container based on a monitoring confirmation operation input for the labels of one or more service containers in the at least one service container; and generating a container screening instruction comprising the label of the service container to be monitored.
In an embodiment, the disk directory of the physical machine is mapped in the preset monitoring directories corresponding to the started service container and the monitoring container, and before sending the monitoring instruction to the manager based on the identification information, a preset monitoring script may be copied to the preset monitoring directory of the monitoring container, so that the preset monitoring directory corresponding to the started service container includes the preset monitoring script.
In an embodiment, the monitoring container is mapped with a socket file of a manager, and a specific implementation manner of sending a container screening instruction carrying a label of a service container to be monitored to the manager according to a preset time interval is as follows: and sending a container screening instruction carrying the label of the service container to be monitored to the manager according to a preset time interval based on the socket file.
In a second aspect, an embodiment of the present invention provides another service monitoring method, where the method is applied to a manager running on a physical machine, where a monitoring container and at least one service container also run on the physical machine, and the at least one service container is uniformly managed by the manager, and the method includes:
receiving a container screening instruction which is sent by the monitoring container according to a preset time interval and carries a label of a service container to be monitored;
determining identification information of a target monitoring service container matched with the label from the started service containers, and returning the identification information to the monitoring containers, wherein the target monitoring service container is one or more of the started service containers;
and when a monitoring instruction which is sent by the monitoring container and aims at the target monitoring service container corresponding to the identification information is received, triggering the target monitoring service container corresponding to the identification information to execute the corresponding preset monitoring script.
In an embodiment, before the target monitoring service container corresponding to the trigger information executes the corresponding preset monitoring script, when it is detected that a service container is started in the at least one service container, mapping a disk directory of the physical machine to the started service container and the corresponding preset monitoring directory of the monitoring container, so that after the monitoring container copies the preset monitoring script to the preset monitoring directory of the monitoring container, the preset monitoring directory corresponding to the started service container includes the preset monitoring script.
In an embodiment, before receiving a container screening instruction carrying a label of a service container to be monitored, which is sent by the monitoring container according to a preset time interval, a socket file may be further mapped to the monitoring container, so that the monitoring container sends the container screening instruction to the manager based on the mapped socket file.
In a third aspect, an embodiment of the present invention provides a service monitoring apparatus, where the service monitoring apparatus includes a module configured to execute the method in the first aspect.
In a fourth aspect, an embodiment of the present invention provides another service monitoring apparatus, where the service monitoring apparatus includes a module configured to execute the method in the second aspect.
In a fifth aspect, an embodiment of the present invention provides a server, where a monitoring container, a manager, and at least one service container run on the server, where the at least one service container is managed by the manager in a unified manner, and the monitoring container includes a processor and a memory, where the processor and the memory are connected to each other, where the memory is used to store a computer program, and the computer program includes program instructions, and the processor is configured to call the program instructions to execute the method of the first aspect or the second aspect.
In a sixth aspect, the present invention provides a computer-readable storage medium, in which a computer program is stored, the computer program including program instructions, which, when executed by a processor, cause the processor to perform the method of the first or second aspect.
In the embodiment of the invention, the monitoring container sends a container screening instruction carrying the label of the service container to be monitored to the manager according to the preset time interval so as to indicate the manager to determine the identification information of the target monitoring service container matched with the label from the started service container and return the identification information to the monitoring container. Further, after receiving the identifier information returned by the manager, the monitoring container may send a monitoring instruction to the manager based on the identifier information, so as to instruct the manager to manage the target monitoring service container corresponding to the identifier information and execute the corresponding preset monitoring script. By adopting the mode, the monitoring on the container service process can be more effectively realized while the resources are saved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the description below are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a service monitoring system according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a service monitoring method according to an embodiment of the present invention;
fig. 3 is a schematic flow chart of another service monitoring method according to an embodiment of the present invention;
fig. 4 is a schematic block diagram of a service monitoring apparatus according to an embodiment of the present invention;
fig. 5 is a schematic block diagram of another service monitoring apparatus provided in an embodiment of the present invention;
fig. 6 is a schematic block diagram of a server according to an embodiment of the present invention.
Detailed Description
Currently, if the service progress of any service container (e.g., service container a) needs to be monitored, the following two methods are generally adopted:
firstly, monitoring a service process in a service container A by starting a new service container B, wherein the new service container B needs to share IPC namespace with the service container A to realize monitoring.
Secondly, an independent monitoring process is started in the service container a to monitor the service process in the service container a, wherein the independent monitoring process needs to run for a long time.
It can be seen that, with the first approach, on one hand, since the service container B depends on the service container a, if the service container a fails, the service container B also fails; on the other hand, if a plurality of service containers are started on one physical machine to run the service process, a plurality of monitoring containers need to be started, which causes a great deal of resource waste. In the second way, since the monitoring process needs to run for a long time, if one service container starts multiple processes, the processes may affect each other, for example, a failure of the service process may be caused by a failure of the monitoring process.
In order to solve the above problem, an embodiment of the present invention provides a service monitoring method, which may be applied to a monitoring container running on a physical machine, where a manager and at least one service container are also running on the physical machine, and the at least one service container is uniformly managed by the manager, where each physical machine runs one monitoring container, and the physical machine may be, for example, a server. The monitoring container may send a container screening instruction carrying a label of the service container to be monitored to the manager according to a preset time interval to instruct the manager to determine, from the started service containers, identification information of a target monitoring service container matched with the label, and return the identification information to the monitoring container. Further, after the monitoring container receives the identifier information returned by the manager, a monitoring instruction may be sent to the manager based on the identifier information to instruct the manager to manage the target monitoring service containers corresponding to the identifier information to execute the corresponding preset monitoring scripts, so as to implement monitoring of the service processes of the target monitoring service containers.
It can be seen that, in the service monitoring method provided in the embodiment of the present invention, on one hand, each physical machine starts a monitoring container, and the monitoring container can implement unified monitoring of the service processes of all the service containers, and has no dependency relationship with each service container, which not only can increase the effectiveness of monitoring the container service processes, but also can reduce the waste of a large amount of resources; on the other hand, the monitoring process (i.e. the preset monitoring script) executed in each service container is a temporary process (i.e. is started at regular time according to the preset time interval), and has a small influence on the inherent service process itself in each service container, so that the effectiveness of monitoring the container service process can be further increased.
Referring to fig. 1, a service monitoring system includes a physical machine 10, a monitoring container 101 running on the physical machine, a manager 102 running on the physical machine, and at least one service container 103 running on the physical machine, where the at least one service container 103 is managed by the manager 102. In an embodiment, the manager 102 may map the disk directory a of the physical machine to the preset monitoring directories a ' corresponding to the monitoring container 101 and each service container 103, and after the mapping is completed, when a ' of any service container is modified, the preset monitoring directories a ' corresponding to the monitoring container 101 and other service containers and the disk directory a of the physical machine are modified accordingly. Further, the manager 102 may map a socket file docker.scolet to the monitoring container 101, so that the monitoring container 101 may send an instruction to the manager 102 through the docker.scolet, and a situation that each container IPC Namespace is isolated from each other and cannot communicate with each other is avoided, where the socket file is a communication interface for communicating between the monitoring container 101 and the manager 102. Before starting the monitoring application program, the monitoring container 101 may copy a preset monitoring script for monitoring to a corresponding preset monitoring directory a ' thereof, so as to map the preset monitoring script to the corresponding preset monitoring directory a ' of each service container 103 through the physical machine, so that the preset monitoring directory a ' corresponding to each service container 103 includes the preset monitoring script. Further, when each service container 103 is started (i.e., the service process of the service container is started), the corresponding preset monitoring directory a 'is mounted, so that each service container 103 can obtain data (e.g., the preset monitoring script) in the corresponding preset monitoring directory a'.
For such a situation, the monitoring container 101 may send a container screening instruction carrying a label of the service container to be monitored to the manager 102 according to a preset time interval, and after receiving the container screening instruction, the manager 102 may determine, from the started service container, identification information of a target monitoring service container matching the label, and return the identification information of the target monitoring service container to the monitoring container 101. Further, after receiving the identification information of the target monitoring service container returned by the manager 102, the monitoring container 101 may send a monitoring instruction for the target monitoring service container corresponding to the identification information to the manager 102, and the manager 102 may respond to the monitoring instruction to trigger the target monitoring service container corresponding to the identification information to execute a corresponding preset monitoring script, that is, trigger the target monitoring service container corresponding to the identification information to execute a corresponding monitoring process, thereby monitoring the service process of each target monitoring service container.
Referring to fig. 2, fig. 2 is a flowchart illustrating a service monitoring method according to an embodiment of the present invention, where the embodiment may be executed by a monitoring container running on a physical machine, where the physical machine further runs a manager and at least one service container, and the at least one service container is uniformly managed by the manager, as shown in the figure, the service monitoring method may include:
s201: and sending a container screening instruction carrying the labels of the service containers to be monitored to the manager according to a preset time interval to instruct the manager to determine the identification information of the target monitoring service container matched with the labels from the started service containers and return the identification information to the monitoring containers, wherein the target monitoring service container is one or more of the started service containers. The preset time interval is preset according to experimental measurement and calculation data, and can be subsequently adjusted according to actual requirements, and the identification information can be, for example, the ID of each target monitoring container.
In one embodiment, before performing step S201, the monitoring container may determine, based on a monitoring confirmation operation input for the tag of one or more of the at least one service container, a service container to be monitored from the at least one service container, and further generate a container screening instruction including the tag of the service container to be monitored. The input mode of the monitoring confirmation operation may include voice, click, slide, press, and the like, which is not specifically limited in this embodiment of the present invention.
Illustratively, it is assumed that the service container running on the physical machine includes a service container a, a service container B, and a service container C, where the label assigned to the service container a in advance is "jvm ═ 1.8", the label assigned to the service container B is "project _ name ═ core", and the label assigned to the service container C is "ecs _ service ═ sd-web". In this case, the labels corresponding to the service container a, the service container B, and the service container C may be displayed on the display device, and when the user wants to monitor the service container a and the service container B, the monitoring confirmation operation may be input for the labels "jvm ═ 1.8" and "project _ name ═ core" corresponding to the service container a and the service container B, respectively. Further, the monitoring container may determine the service container a and the service container B as service containers to be monitored from among the service container a, the service container B and the service container C based on the monitoring confirmation operation, and generate a container filtering instruction including labels "jvm ═ 1.8" and "project _ name ═ core" (i.e., labels of the service containers to be monitored).
In one embodiment, the monitoring container is mapped with a socket file of the manager, which is a communication interface for communicating with the manager. For this case, the monitoring container may send a container screening instruction carrying the label of the service container to be monitored to the manager at a preset time interval based on the socket file. Further, after receiving the container screening instruction, the manager may determine, from the started service container, the identification information of the target monitoring service container that matches the tag, and return the identification information to the monitoring container.
S202: and receiving the identification information returned by the manager.
S203: and sending a monitoring instruction to the manager based on the identification information to instruct the manager to manage the target monitoring service containers corresponding to the identification information and execute the corresponding preset monitoring scripts.
In an embodiment, after receiving the identifier information returned by the manager, the monitoring container may send a monitoring instruction for the target monitoring service container corresponding to the identifier information to the manager through the socket file, so that the manager manages the target monitoring service container corresponding to the identifier information to execute a corresponding preset monitoring script, thereby monitoring the service process of each target monitoring service container.
In an embodiment, the disk directories of the physical machine are mapped in the preset monitoring directories corresponding to the started service container and the started monitoring container, and the monitoring container may copy the preset monitoring script to the preset monitoring directory of the monitoring container before executing step S203. Because the preset monitoring directories corresponding to the started service container and the started monitoring container respectively have a mapping relation with the disk directory of the physical machine, after the monitoring container copies the preset monitoring script to the preset monitoring directory of the monitoring container, the preset monitoring script can be included in the preset monitoring directory corresponding to the started service container. Further, after the monitoring container performs step S203 to send a monitoring instruction to the manager based on the identifier information, the manager may respond to the monitoring instruction, and trigger the target monitoring service container corresponding to the identifier information to execute the preset monitoring script in the corresponding preset monitoring directory, so that each target monitoring service container executes the corresponding monitoring process.
Further, in an embodiment, after the target monitoring service containers execute the corresponding preset monitoring scripts, the corresponding monitoring information in the execution process can be transmitted back to the unified cloud platform, and developers can check the monitoring information of each target monitoring service container through the cloud platform, so that the target monitoring service containers can be managed more quickly and conveniently.
In the embodiment of the present invention, the monitoring container may send a container screening instruction carrying a label of the service container to be monitored to the manager according to a preset time interval, so as to instruct the manager to determine, from the started service containers, identification information of a target monitoring service container matched with the label, and return the identification information to the monitoring container. Further, after receiving the identifier information returned by the manager, the monitoring container may send a monitoring instruction to the manager based on the identifier information, so as to instruct the manager to manage the target monitoring service container corresponding to the identifier information and execute the corresponding preset monitoring script. By adopting the mode, the monitoring on the container service process can be more effectively realized while the resources are saved.
Referring to fig. 3, fig. 3 is a flowchart illustrating another service monitoring method according to an embodiment of the present invention, where this embodiment may be executed by a manager running on a physical machine, where a monitoring container and at least one service container are also running on the physical machine, and the at least one service container is uniformly managed by the manager, as shown in the figure, the service monitoring method may include:
s301: and receiving a container screening instruction which is sent by the monitoring container according to a preset time interval and carries the label of the service container to be monitored.
In one embodiment, the manager may pre-map a socket file to the monitoring container, the socket file being a communication interface for communication between the manager and the monitoring container. For this situation, when the monitoring container detects that there is a service container start in at least one service container, the monitoring container may send, to the manager, a container screening instruction carrying a label of the service container to be monitored at preset time intervals based on the mapped mapping socket file.
S302: and determining the identification information of a target monitoring service container matched with the label from the started service containers, and returning the identification information to the monitoring containers, wherein the target monitoring service container is one or more of the started service containers.
In one embodiment, the identification information may be, for example, an ID of the service container, since the service container is assigned a different ID at each start-up. For this situation, after receiving the container screening instruction carrying the label of the service container to be monitored, the manager determines the ID of the target monitoring service container matching the label from the currently started service container. By adopting the method, the validity of the ID of the determined target monitoring service container is ensured.
Exemplarily, it is assumed that the identification information is an ID of a service container, the service container to be monitored includes a service container a and a service container B, a label assigned to the service container a in advance is "jvm ═ 1.8", a label assigned to the service container B is "project _ name ═ core", and a currently started service container includes the service container B. For this situation, after receiving a container screening instruction carrying a label "jvm is 1.8" and a "project _ name is core" (i.e. a label of a service container to be monitored) sent by the monitoring container, the manager may determine, from the currently started service container, a service container B labeled "project _ name is core" as a target monitoring service container, search for an ID of the service container B, and then return the ID of the service container B to the monitoring container.
S303: and when a monitoring instruction which is sent by the monitoring container and aims at the target monitoring service container corresponding to the identification information is received, triggering the target monitoring service container corresponding to the identification information to execute the corresponding preset monitoring script.
In an embodiment, before executing step S303, when it is detected that a service container is started in at least one service container, the manager may map the disk directory of the physical machine to the preset monitoring directories corresponding to the started service container and the monitoring container, so that after the monitoring container copies the preset monitoring script to the preset monitoring directory of the monitoring container, the preset monitoring directory corresponding to the started service container includes the preset monitoring script.
Further, when the manager receives a monitoring instruction sent by the monitoring container and directed to the target monitoring service container corresponding to the identification information, the manager may trigger the target monitoring service container corresponding to the identification information to execute the corresponding preset monitoring script in the preset monitoring directory, thereby implementing monitoring of the service process of each target monitoring service container.
In one embodiment, after the target monitoring service containers execute the corresponding preset monitoring scripts, the corresponding monitoring information in the execution process can be transmitted back to the unified cloud platform, and developers can check the monitoring information of each target monitoring service container through the cloud platform, so that the target monitoring service containers can be managed more quickly and conveniently.
In the embodiment of the invention, the manager can receive a container screening instruction which is sent by the monitoring container according to the preset time interval and carries the label of the service container to be monitored, determine the identification information of the target monitoring service container matched with the label from the started service container, and return the identification information to the monitoring container. Further, when receiving a monitoring instruction for a target monitoring service container corresponding to the identification information sent by the monitoring container, the manager may trigger the target monitoring service container corresponding to the identification information to execute a corresponding preset monitoring script. By adopting the mode, the monitoring on the container service process can be more effectively realized while the resources are saved.
Embodiments of the present invention further provide a computer storage medium, in which program instructions are stored, and when the program instructions are executed, the computer storage medium is configured to implement the corresponding method described in the above embodiments.
An embodiment of the present invention further provides a service monitoring apparatus, where the apparatus includes a module configured to execute the method described in fig. 2, and a monitoring container configured to run on a physical machine, where a manager and at least one service container run on the physical machine, and the at least one service container is managed by the manager in a unified manner. Specifically, referring to fig. 4, a schematic block diagram of a service monitoring apparatus according to an embodiment of the present invention is shown. The service monitoring device of the embodiment includes:
a sending module 40, configured to send a container screening instruction carrying a label of a service container to be monitored to the manager according to a preset time interval, so as to instruct the manager to determine, from a started service container, identification information of a target monitoring service container matched with the label, and return the identification information to the monitoring container, where the target monitoring service container is one or more of the started service containers;
a receiving module 41, configured to receive the identification information returned by the manager;
the sending module 40 is further configured to send a monitoring instruction to the manager based on the identification information, so as to instruct the manager to manage that the target monitoring service container corresponding to the identification information executes a corresponding preset monitoring script.
In one embodiment, the apparatus further includes a processing module 42, wherein the processing module is configured to determine a service container to be monitored from the at least one service container based on a monitoring confirmation operation input for a tag of one or more service containers of the at least one service container; and generating a container screening instruction comprising the label of the service container to be monitored.
In an embodiment, the disk directory of the physical machine is mapped in the preset monitoring directories corresponding to the started service container and the monitoring container, and the processing module 42 is further configured to copy a preset monitoring script to the preset monitoring directory of the monitoring container, so that the preset monitoring directory corresponding to the started service container includes the preset monitoring script.
In an embodiment, the monitoring container is mapped with a socket file of a manager, and the sending module 40 is specifically configured to send a container screening instruction carrying a label of a service container to be monitored to the manager according to a preset time interval based on the socket file.
It should be noted that the functions of each functional module of the service monitoring apparatus described in the embodiment of the present invention may be specifically implemented according to the method in the method embodiment described in the foregoing fig. 2, and a specific implementation process thereof may refer to the related description of the method embodiment of fig. 2, and is not described herein again.
An embodiment of the present invention further provides a service monitoring apparatus, where the apparatus includes a module configured to execute the method described in fig. 3, and a manager configured to run on a physical machine, where a monitoring container and at least one service container run on the physical machine, and the at least one service container is uniformly managed by the manager. Specifically, referring to fig. 5, a schematic block diagram of another service monitoring apparatus provided in the embodiment of the present invention is shown. The service monitoring device of the embodiment includes:
a receiving module 50, configured to receive a container screening instruction, which is sent by the monitoring container according to a preset time interval and carries a label of a service container to be monitored;
the processing module 51 is configured to determine, from the started service containers, identification information of a target monitoring service container that matches the tag;
a sending module 52, configured to return the identification information to the monitoring container, where the target monitoring service container is one or more started service containers;
the processing module 51 is further configured to trigger the target monitoring service container corresponding to the identification information to execute a corresponding preset monitoring script when the receiving module receives a monitoring instruction, sent by the monitoring container, for the target monitoring service container corresponding to the identification information.
In an embodiment, the processing module 51 is further configured to, when it is detected that a service container is started in the at least one service container, map the disk directory of the physical machine to a preset monitoring directory corresponding to each of the started service container and the monitoring container, so that after the monitoring container copies a preset monitoring script to the preset monitoring directory of the monitoring container, the preset monitoring directory corresponding to the started service container includes the preset monitoring script.
In an embodiment, the processing module 51 is further configured to map a socket file to a monitoring container, so that the monitoring container sends the container filtering instruction to the manager based on the mapped socket file.
It should be noted that the functions of each functional module of the service monitoring apparatus described in the embodiment of the present invention may be specifically implemented according to the method in the method embodiment described in the above fig. 3, and a specific implementation process thereof may refer to the related description of the method embodiment of fig. 3, and is not described herein again.
Referring to fig. 6, fig. 6 is a schematic block diagram of a server, on which a monitoring container, a manager and at least one service container are running, where the at least one service container is uniformly managed by the manager, and as shown in fig. 6, the monitoring container includes a processor 601, a memory 602 and a transceiver 603. The processor 601, the memory 602 and the transceiver 603 may be connected by a bus or other means, and the bus connection is taken as an example in fig. 6 in the embodiment of the present invention. Wherein the transceiver 603 is controlled by the processor for transceiving messages, the memory 602 is for storing a computer program comprising program instructions, and the processor 601 is for executing the program instructions stored by the memory 602.
Wherein, the monitoring container calling processor 601 executes: sending a container screening instruction carrying labels of service containers to be monitored to the manager through the transceiver 603 according to a preset time interval to instruct the manager to determine identification information of a target monitoring service container matched with the labels from the started service containers and return the identification information to the monitoring containers, wherein the target monitoring service container is one or more of the started service containers; receiving, by the transceiver 603, the identifier information returned by the manager, and sending a monitoring instruction to the manager based on the identifier information, so as to instruct the manager to manage the target monitoring service containers corresponding to the identifier information and execute corresponding preset monitoring scripts.
In one embodiment, the processor 601 is further configured to determine a service container to be monitored from the at least one service container based on a monitoring confirmation operation input for a tag of one or more service containers of the at least one service container; and generating a container screening instruction comprising the label of the service container to be monitored.
In an embodiment, the disk directory of the physical machine is mapped in the preset monitoring directories corresponding to the started service container and the monitoring container, and the processor 601 is further configured to copy a preset monitoring script to the preset monitoring directory of the monitoring container, so that the preset monitoring directory corresponding to the started service container includes the preset monitoring script.
In an embodiment, the monitoring container is mapped with a socket file of a manager, and the processor 601 is further configured to send, by the transceiver 603, a container screening instruction carrying a label of a service container to be monitored to the manager at a preset time interval based on the socket file.
Wherein, the manager calls the processor 601 to execute: receiving a container screening instruction which is sent by the monitoring container according to a preset time interval and carries a label of a service container to be monitored through the transceiver 603; determining identification information of a target monitoring service container matched with the label from the started service containers, and returning the identification information to the monitoring containers, wherein the target monitoring service container is one or more of the started service containers; when receiving a monitoring instruction, sent by the monitoring container, for the target monitoring service container corresponding to the identification information through the transceiver 603, triggering the target monitoring service container corresponding to the identification information to execute a corresponding preset monitoring script.
In an embodiment, the processor 601 is further configured to, when it is detected that a service container is started in the at least one service container, map the disk directory of the physical machine to a preset monitoring directory corresponding to each of the started service container and the monitoring container, so that after the monitoring container copies a preset monitoring script to the preset monitoring directory of the monitoring container, the preset monitoring directory corresponding to the started service container includes the preset monitoring script.
In an embodiment, the processor 601 is further configured to map a socket file to a monitoring container, so that the monitoring container sends the container filtering instruction to the manager based on the mapped socket file.
It should be understood that in the embodiment of the present invention, the Processor 601 may be a Central Processing Unit (CPU), and the Processor 601 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 602 may include both read-only memory and random access memory and provides instructions and data to the processor 601. A portion of the memory 602 may also include non-volatile random access memory. For example, the memory 602 may also store device type information.
In a specific implementation, the processor 601, the memory 602, and the transceiver 603 described in this embodiment of the present invention may execute the implementation described in the method embodiment shown in fig. 2 or fig. 3 provided in this embodiment of the present invention, and may also execute the implementation of the service monitoring apparatus described in fig. 4 or fig. 5 provided in this embodiment of the present invention, which is not described herein again.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
While the present disclosure has been described with reference to a particular embodiment, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present disclosure.

Claims (8)

1. A service monitoring method is applied to a monitoring container running on a physical machine, the physical machine also runs a manager and at least one service container, the at least one service container is managed by the manager in a unified manner, and a disk directory of the physical machine is mapped in a preset monitoring directory corresponding to each of a started service container and the monitoring container, wherein the method comprises the following steps:
sending a container screening instruction carrying labels of service containers to be monitored to the manager according to a preset time interval to indicate the manager to determine identification information of a target monitoring service container matched with the labels from the started service containers and return the identification information to the monitoring containers, wherein the target monitoring service containers are one or more of the started service containers;
receiving the identification information returned by the manager;
copying a preset monitoring script to a preset monitoring directory of the monitoring container so that the preset monitoring directory corresponding to the started service container comprises the preset monitoring script;
and sending a monitoring instruction to the manager based on the identification information to instruct the manager to manage the target monitoring service containers corresponding to the identification information to execute the corresponding preset monitoring scripts.
2. The method according to claim 1, wherein before sending the container screening instruction carrying the label of the service container to be monitored to the manager at the preset time interval, the method further comprises:
determining a service container to be monitored from the at least one service container based on a monitoring confirmation operation input aiming at the label of one or more service containers in the at least one service container;
and generating a container screening instruction comprising the label of the service container to be monitored.
3. The method according to claim 1, wherein the monitoring container is mapped with a socket file of a manager, and the sending a container screening instruction carrying a label of the service container to be monitored to the manager at a preset time interval comprises:
and sending a container screening instruction carrying the label of the service container to be monitored to the manager according to a preset time interval based on the socket file.
4. A service monitoring method, wherein the method is applied to a manager running on a physical machine, a monitoring container and at least one service container are also running on the physical machine, and the at least one service container is uniformly managed by the manager, and the method includes:
receiving a container screening instruction which is sent by the monitoring container according to a preset time interval and carries a label of a service container to be monitored;
determining identification information of a target monitoring service container matched with the label from the started service containers, and returning the identification information to the monitoring containers, wherein the target monitoring service container is one or more of the started service containers;
when the fact that a service container is started in the at least one service container is detected, mapping a disk directory of the physical machine to preset monitoring directories corresponding to the started service container and the monitoring container respectively, so that after the monitoring container copies a preset monitoring script to the preset monitoring directory of the monitoring container, the preset monitoring directory corresponding to the started service container comprises the preset monitoring script;
and when a monitoring instruction which is sent by the monitoring container and aims at the target monitoring service container corresponding to the identification information is received, triggering the target monitoring service container corresponding to the identification information to execute the corresponding preset monitoring script.
5. The method according to claim 4, wherein before receiving the container screening instruction carrying the label of the service container to be monitored, which is sent by the monitoring container at the preset time interval, the method further comprises:
mapping a socket file to a monitoring container, so that the monitoring container sends the container screening instruction to the manager based on the mapping socket file.
6. A service monitoring apparatus, where the apparatus is configured to a monitoring container running on a physical machine, the physical machine further runs on a manager and at least one service container, the at least one service container is managed by the manager in a unified manner, and a disk directory of the physical machine is mapped in a preset monitoring directory corresponding to each of a started service container and the monitoring container, where the apparatus includes:
a sending module, configured to send a container screening instruction carrying a label of a service container to be monitored to the manager according to a preset time interval, so as to instruct the manager to determine, from a started service container, identification information of a target monitoring service container that matches the label, and return the identification information to the monitoring container, where the target monitoring service container is one or more of the started service containers;
the receiving module is used for receiving the identification information returned by the manager;
the processing module is used for copying a preset monitoring script into a preset monitoring catalog of the monitoring container so as to enable the preset monitoring catalog corresponding to the started service container to comprise the preset monitoring script;
the sending module is further configured to send a monitoring instruction to the manager based on the identification information, so as to instruct the manager to manage the target monitoring service containers corresponding to the identification information to execute the corresponding preset monitoring scripts.
7. A service monitoring apparatus, wherein the apparatus is configured to a manager running on a physical machine, the physical machine further runs a monitoring container and at least one service container, and the at least one service container is uniformly managed by the manager, and the apparatus comprises:
the receiving module is used for receiving a container screening instruction which is sent by the monitoring container according to a preset time interval and carries a label of a service container to be monitored;
the processing module is used for determining the identification information of the target monitoring service container matched with the label from the started service container;
a sending module, configured to return the identification information to the monitoring container, where the target monitoring service container is one or more started service containers;
the processing module is further configured to, when it is detected that a service container is started in the at least one service container, map a disk directory of the physical machine into preset monitoring directories corresponding to the started service container and the monitoring container, so that after the monitoring container copies a preset monitoring script to the preset monitoring directory of the monitoring container, the preset monitoring directory corresponding to the started service container includes the preset monitoring script;
the processing module is further configured to trigger the target monitoring service container corresponding to the identification information to execute a corresponding preset monitoring script when the receiving module receives a monitoring instruction, sent by the monitoring container, for the target monitoring service container corresponding to the identification information.
8. A server, characterized in that a monitoring container, a manager and at least one service container are operated on the server, the at least one service container is uniformly managed by the manager, the monitoring container comprises a processor and a memory, the processor and the memory are connected with each other, wherein the memory is used for storing a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions, execute the method according to any one of claims 1 to 3 or execute the method according to any one of claims 4 to 5.
CN201910810931.0A 2019-08-29 2019-08-29 Service monitoring method and related equipment Active CN110659104B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910810931.0A CN110659104B (en) 2019-08-29 2019-08-29 Service monitoring method and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910810931.0A CN110659104B (en) 2019-08-29 2019-08-29 Service monitoring method and related equipment

Publications (2)

Publication Number Publication Date
CN110659104A CN110659104A (en) 2020-01-07
CN110659104B true CN110659104B (en) 2022-06-24

Family

ID=69036859

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910810931.0A Active CN110659104B (en) 2019-08-29 2019-08-29 Service monitoring method and related equipment

Country Status (1)

Country Link
CN (1) CN110659104B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111737089B (en) * 2020-07-23 2021-04-23 北京升鑫网络科技有限公司 Real-time counting method and device for information assets in container and computing equipment
CN112383641B (en) * 2021-01-13 2021-04-06 国网汇通金财(北京)信息科技有限公司 Service keep-alive monitoring method and device
CN112835766A (en) * 2021-02-10 2021-05-25 杭州橙鹰数据技术有限公司 Application monitoring method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104915285A (en) * 2015-06-30 2015-09-16 北京奇虎科技有限公司 Container process monitoring method, device and system
CN105389243A (en) * 2015-10-26 2016-03-09 华为技术有限公司 Container monitoring method and apparatus
CN109656783A (en) * 2018-12-24 2019-04-19 成都四方伟业软件股份有限公司 System platform monitoring method and device
CN109753356A (en) * 2018-12-25 2019-05-14 北京友信科技有限公司 A kind of container resource regulating method, device and computer readable storage medium
CN110096336A (en) * 2019-04-29 2019-08-06 江苏满运软件科技有限公司 Data monitoring method, device, equipment and medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104915285A (en) * 2015-06-30 2015-09-16 北京奇虎科技有限公司 Container process monitoring method, device and system
CN105389243A (en) * 2015-10-26 2016-03-09 华为技术有限公司 Container monitoring method and apparatus
CN109656783A (en) * 2018-12-24 2019-04-19 成都四方伟业软件股份有限公司 System platform monitoring method and device
CN109753356A (en) * 2018-12-25 2019-05-14 北京友信科技有限公司 A kind of container resource regulating method, device and computer readable storage medium
CN110096336A (en) * 2019-04-29 2019-08-06 江苏满运软件科技有限公司 Data monitoring method, device, equipment and medium

Also Published As

Publication number Publication date
CN110659104A (en) 2020-01-07

Similar Documents

Publication Publication Date Title
US9851989B2 (en) Methods and apparatus to manage virtual machines
CN110659104B (en) Service monitoring method and related equipment
US20240111549A1 (en) Method and apparatus for constructing android running environment
CN109688191B (en) Traffic scheduling method and communication device
US20230205561A1 (en) Managing containers across multiple operating systems
CN112000353A (en) Application running method and device and storage medium
US20180203726A1 (en) Virtual machine migration method and apparatus
CN105373563B (en) Database switching method and device
CN115904761A (en) System on chip, vehicle and video processing unit virtualization method
US8904396B2 (en) System and method of general service management
CN111240998B (en) Test case processing method and device
WO2018068655A1 (en) License management method and system
CN108197029B (en) Method and device for acquiring process information
EP4414836A1 (en) Container engine, container engine implementation methods, electronic device and storage medium
CN117076096A (en) Task flow execution method and device, computer readable medium and electronic equipment
US20200150972A1 (en) Performing actions opportunistically in connection with reboot events in a cloud computing system
CN113326098B (en) Cloud management platform supporting KVM virtualization and container virtualization
US8549537B2 (en) Middleware bridge system and method
CN109343935A (en) The instantiation method and device of consumer VNF
CN115840617A (en) Debugging method, system and related device
CN111435320B (en) Data processing method and device
CN109634721B (en) Method and related device for starting communication between virtual machine and host
CN114510334A (en) Class instance calling method and device, electronic equipment and automatic driving vehicle
CN114047933A (en) Method, device, equipment and medium for multi-open Android application
CN107220101B (en) Container creation method and device

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