CN114938341A - Environment detection method and device, electronic equipment and storage medium - Google Patents

Environment detection method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114938341A
CN114938341A CN202210611648.7A CN202210611648A CN114938341A CN 114938341 A CN114938341 A CN 114938341A CN 202210611648 A CN202210611648 A CN 202210611648A CN 114938341 A CN114938341 A CN 114938341A
Authority
CN
China
Prior art keywords
environment
detection
interface
detection interface
state
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.)
Granted
Application number
CN202210611648.7A
Other languages
Chinese (zh)
Other versions
CN114938341B (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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202210611648.7A priority Critical patent/CN114938341B/en
Publication of CN114938341A publication Critical patent/CN114938341A/en
Application granted granted Critical
Publication of CN114938341B publication Critical patent/CN114938341B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Environmental & Geological Engineering (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present disclosure provides an environment detection method, which can be used in the financial field or other technical fields, wherein a detection interface is pre-deployed in an environment in the method, and the detection interface is used for detecting the state of the environment, and the method comprises: determining all detection interfaces corresponding to all environments; determining the type of each detection interface, and determining detection methods for all environments corresponding to the detection interfaces according to the type of the detection interface; detecting all environments corresponding to the detection interface according to a detection method to obtain a detection result of each environment corresponding to the detection interface; and aiming at each environment, comparing the detection result of the environment with the basic information of the detection interface deployed in the environment to obtain the state of the environment. The present disclosure also provides an environment detection apparatus, an electronic device, and a computer storage medium.

Description

Environment detection method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to an environment detection method, an environment detection apparatus, an electronic device, a storage medium, and a program product.
Background
In the production process of the distributed micro-service system, it is often necessary to check whether the service is normally started after the service cluster is deployed, and the existing environment check is basically performed manually, and then an interface special for detecting the environment is accessed, and whether a response result is matched with an expected result is checked to judge the operating state of a single service node. For distributed services, each node needs to be verified respectively, and the starting state of each cluster is checked through manually inputting an instruction, so that time and labor are wasted, the efficiency is low, and the repetitive work is high for checking the distributed clusters.
Disclosure of Invention
In view of the above, the present disclosure provides an environment detection method, apparatus, electronic device, storage medium, and program product.
According to a first aspect of the present disclosure, there is provided an environment detection method, where a detection interface is deployed in advance in an environment, and the detection interface is used to detect a state of the environment, the method including:
determining all detection interfaces corresponding to all environments;
determining the type of the detection interface aiming at each detection interface, and determining the detection method of all environments corresponding to the detection interface according to the type of the detection interface;
detecting all environments corresponding to the detection interface according to the detection method to obtain a detection result of each environment corresponding to the detection interface;
and aiming at each environment, comparing the detection result of the environment with the basic information of the detection interface deployed in the environment to obtain the state of the environment.
In an embodiment of the present disclosure, the determining the type of the detection interface and determining, according to the type of the detection interface, a detection method for all environments corresponding to the detection interface specifically includes:
when the detection interface is an Http interface, the detection method is to send a detection request generated according to basic information of the detection interface to a detection interface of each environment corresponding to the detection interface, where the basic information includes an address, a URL, and a request parameter, and the detection request is an Http request generated according to the address, the URL, and the request parameter in the basic information;
when the detection interface is an Rpc interface, the detection method is to traverse and access all environments corresponding to the detection interface in a generalization calling mode.
In an embodiment of the present disclosure, the comparing, for each environment, the detection result of the environment with the basic information of the detection interface deployed in the environment to obtain the state of the environment specifically includes:
when the basic information of the detection interface deployed in the environment comprises the detection result of the environment, the state of the environment is normal;
and when the basic information of the detection interface deployed in the environment does not comprise the detection result of the environment, judging the state of the environment according to the detection result of the environment.
In an embodiment of the present disclosure, when the detection interface is an Http interface, the determining the state of the environment according to the detection result of the environment specifically includes:
and acquiring an Http response status code in the detection result of the environment, and judging the state of the environment according to the Http response status code.
In an embodiment of the present disclosure, when the detection interface is an Rpc interface, the determining the state of the environment according to the detection result of the environment specifically includes:
for each environment, judging the state of the environment according to whether an abnormality is thrown in the process of accessing the environment;
when an abnormality is thrown in the process of accessing the environment, judging the state of the environment to be abnormal;
and when the abnormality is not thrown out in the process of accessing the environment, judging that the environment is normal.
In an embodiment of the present disclosure, when the detection interface is an Http interface, an environment corresponding to the detection interface is an environment in which the detection interface is deployed;
when the detection interface is an Rpc interface, if the basic information of the detection interface includes environment specification information, the environment corresponding to the detection interface is an environment corresponding to the environment specification information;
if the basic information of the detection interface does not include the environment specification information, the environment corresponding to the detection interface is all the environments in which the detection interface is deployed.
A second aspect of the present disclosure provides an environment detection apparatus, where a detection interface is disposed in advance in the environment, and the detection interface is used to detect a state of the environment, the apparatus including:
the first determining module is used for determining all detection interfaces corresponding to all environments;
a second determining module, configured to determine, for each detection interface, a type of the detection interface, and determine, according to the type of the detection interface, detection methods for all environments corresponding to the detection interface;
the detection module is used for detecting all environments corresponding to the detection interface according to the detection method to obtain a detection result of each environment corresponding to the detection interface;
and the comparison module is used for comparing the detection result of the environment with the basic information of the detection interface deployed in the environment aiming at each environment to obtain the state of the environment.
A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the environment detection method.
The fourth aspect of the present disclosure also provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the above-described environment detection method.
A fifth aspect of the present disclosure also provides a computer program product comprising a computer program which, when executed by a processor, implements the above-described environment detection method.
The environment detection method provided by the present disclosure, in which a detection interface is pre-deployed in an environment, and the detection interface is used for detecting a state of the environment, includes: determining all detection interfaces corresponding to all environments; determining the type of each detection interface, and determining detection methods for all environments corresponding to the detection interfaces according to the type of the detection interface; detecting all environments corresponding to the detection interface according to a detection method to obtain a detection result of each environment corresponding to the detection interface; and aiming at each environment, comparing the detection result of the environment with the basic information of the detection interface deployed in the environment to obtain the state of the environment. According to the environment detection method provided by the disclosure, each environment is pre-deployed with an environment detection interface, when the environment is detected, the detection interfaces corresponding to the environments are determined, for each detection interface, the detection method of all the environments in which the detection interface is deployed can be determined only according to the type of the detection interface, all the environments corresponding to the detection interface can be detected according to the detection method, and finally the state of the environment can be determined according to the detection result and the basic information of the detection interface.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 schematically illustrates an application scenario of an environment detection method according to an embodiment of the present disclosure;
fig. 2 schematically illustrates a flow chart of an environment detection method according to an embodiment of the present disclosure;
fig. 3 schematically illustrates a flow chart of another environment detection method provided by an embodiment of the present disclosure;
FIG. 4 is a schematic flow chart illustrating a further method for detecting an environment according to an embodiment of the present disclosure;
fig. 5 is a block diagram schematically illustrating a structure of an environment detection apparatus according to an embodiment of the present disclosure;
fig. 6 is a block diagram schematically illustrating another environment detection apparatus provided in an embodiment of the present disclosure;
fig. 7 schematically illustrates a flow chart of another environment detection method provided by an embodiment of the present disclosure; and
FIG. 8 schematically illustrates a block diagram of an electronic device adapted to implement a method of environmental detection in accordance with an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is illustrative only and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs, unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). Where a convention analogous to "A, B or at least one of C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B or C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.). It will be further understood by those within the art that virtually any disjunctive word and/or phrase presenting two or more alternative terms, whether in the description, claims, or drawings, should be understood to contemplate the possibilities of including one of the terms, either of the terms, or both terms. For example, the phrase "a or B" should be understood to include the possibility of "a" or "B", or "a and B".
Some block diagrams and/or flow diagrams are shown in the figures. It will be understood that some blocks of the block diagrams and/or flowchart illustrations, or combinations thereof, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the instructions, which execute via the processor, create means for implementing the functions/acts specified in the block diagrams and/or flowchart block or blocks. The techniques of this disclosure may be implemented in hardware and/or software (including firmware, microcode, etc.). In addition, the techniques of this disclosure may take the form of a computer program product on a computer-readable medium having instructions stored thereon for use by or in connection with an instruction execution system. In the context of this disclosure, a computer-readable medium may be any medium that can contain, store, communicate, propagate, or transport the instructions. For example, the computer readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, device, or propagation medium. Specific examples of the computer readable medium include: magnetic storage devices, such as magnetic tape or Hard Disk Drives (HDDs); optical storage devices, such as compact disks (CD-ROMs); a memory, such as a Random Access Memory (RAM) or a flash memory; and/or wired/wireless communication links.
The present disclosure provides an environment detection method, where an environment in the method is pre-deployed with a detection interface, and the detection interface is used to detect a state of the environment, and the method includes: determining all detection interfaces corresponding to all environments; determining the type of each detection interface, and determining detection methods for all environments corresponding to the detection interfaces according to the type of the detection interface; detecting all environments corresponding to the detection interface according to a detection method to obtain a detection result of each environment corresponding to the detection interface; and aiming at each environment, comparing the detection result of the environment with the basic information of the detection interface deployed in the environment to obtain the state of the environment. The environment detection method provided by the disclosure is characterized in that each environment is pre-deployed with an environment detection interface, when the environment is detected, the detection interfaces corresponding to the environments are determined, for each detection interface, the detection method of all the environments deployed with the detection interface can be determined according to the type of the detection interface, all the environments corresponding to the detection interface can be detected according to the detection method, and finally the state of the environment can be determined according to the detection result and the basic information of the detection interface.
The present disclosure provides an environment detection method, apparatus, electronic device, storage medium, and program product. The following description is made by way of example with reference to the accompanying drawings. It should be noted that the sequence numbers of the respective operations in the following methods are merely used as representations of the operations for description, and should not be construed as representing the execution order of the respective operations. The method need not be performed in the exact order shown, unless explicitly stated.
It should be noted that the environment detection method, the apparatus, the electronic device, the storage medium, and the program product provided by the present disclosure may be used in the financial field, and may also be used in any field other than the financial field.
In addition, in the technical scheme of the disclosure, the collection, storage, use, processing, transmission, provision, disclosure, application and other processing of the related data all meet the regulations of related laws and regulations, necessary confidentiality measures are taken, and the customs of the public order is not violated.
In the technical scheme of the disclosure, before data is acquired or collected, authorization or consent of a data owner is acquired.
Fig. 1 schematically shows an application scenario of an environment detection method according to an embodiment of the present disclosure. As shown in fig. 1, an application scenario 100 according to this embodiment may comprise terminal devices 101, 102, 103, a network 104 and a server/server cluster 105. Network 104 is used to provide a medium of communication links between terminal devices 101, 102, 103 and server/server cluster 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may use the terminal devices 101, 102, 103 to interact with the server/server cluster 105 via the network 104 to receive or send messages or the like. Various client applications may be installed on the terminal devices 101, 102, 103, such as a shopping-like application, a web browser application, a search-like application, an instant messaging tool, a mailbox client, social platform software, etc. (by way of example only).
The terminal devices 101, 102, 103 may interact with the server/server cluster 105 through various client applications to send various requests to the server/server cluster 105 or to receive results returned by the server/server cluster 105.
The terminal devices 101, 102, 103 may be various electronic devices including, but not limited to, smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server/server cluster 105 may be a server that provides various services, such as a background management server (for example only) that provides support for websites browsed by users using the terminal devices 101, 102, 103. The background management server may analyze and perform other processing on the received data such as the user request, and feed back a processing result (e.g., a webpage, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that an environment detection method provided by the embodiments of the present disclosure may be generally performed by the server/server cluster 105. Accordingly, an environment detection apparatus provided by the embodiments of the present disclosure may be generally disposed in the server/server cluster 105. The environment detection method provided by the embodiment of the present disclosure may also be performed by a server or a server cluster different from the server/server cluster 105 and capable of communicating with the terminal devices 101, 102, 103 and/or the server/server cluster 105. Accordingly, an environment detection apparatus provided by the embodiment of the present disclosure may also be disposed in a server or a server cluster different from the server/server cluster 105 and capable of communicating with the terminal devices 101, 102, and 103 and/or the server/server cluster 105.
It should be understood that the number of end devices, networks, and server/server clusters in fig. 1 is illustrative only. There may be any number of end devices, networks, and server/server clusters, as desired.
An environment detection method of the disclosed embodiment will be described in detail below with reference to fig. 2 to 4 based on the scenario described in fig. 1. So that those skilled in the art can more clearly understand the technical solution of the present disclosure. It should be understood that the following description is only exemplary to assist those skilled in the art in understanding the aspects of the present disclosure, and is not intended to limit the scope of the present disclosure.
Fig. 2 schematically illustrates a flowchart of an environment detection method according to an embodiment of the present disclosure.
As shown in fig. 2, in an embodiment of the present disclosure, a detection interface is pre-deployed in the environment in the method, and the detection interface is used to detect a state of the environment, where the method includes operations S210 to S240.
In operation S210, all detection interfaces corresponding to all environments are determined.
In operation S220, for each detection interface, a type of the detection interface is determined, and a detection method for all environments corresponding to the detection interface is determined according to the type of the detection interface.
In this embodiment, the detection interface in this embodiment may be divided into two types, i.e., an Http interface and an Rpc interface, where the Http interface is used to detect a health state of the master server, and the Rpc interface is used to detect a connectivity health state from the service layer to the database layer. Therefore, it is also necessary to determine what kind of interface a detection interface created in advance in the environment is before detecting the environment. The detection method is different for different types of detection interfaces. In addition, the types of the detection interfaces are different, and the determination method of the environment corresponding to the detection interface is not too much, for example, when the detection interface is an Http interface, the environment corresponding to the detection interface is an environment in which the detection interface is deployed; when the detection interface is an Rpc interface, if the basic information of the detection interface includes environment designation information, the environment corresponding to the detection interface is an environment corresponding to the environment designation information; and if the basic information of the detection interface does not comprise the environment designated information, the environment corresponding to the detection interface is the environment of all the deployment detection interfaces. Specifically, when the detection interface is an Rpc interface, the basic information of the detection interface can be obtained, and whether the basic information includes environment designation information or not is determined, because one detection interface can be deployed in a plurality of environments, when the detection interface is deployed in an environment, relevant information is registered on a distributed registry of the environments, the plurality of environments deployed by one detection interface are different mainly in information such as packets, routes, IP addresses, and the like, the environment designation information refers to information such as packets, routes, IP addresses, and the like, when the basic information of the detection interface includes the environment designation information, the environment corresponding to the detection interface is confirmed from the registry of the environment according to the environment designation information, for example, there is a detection interface C deployed on environment a, environment b, and environment C, and when the environment designation information in the basic information refers to environment b, the environment to be detected this time is environment b. When the environment specifying information is not included in the basic information, the environment corresponding to the detection interface is confirmed from the registry of the environment based on the basic information. Still taking the above detecting interface C as an example, since there is no environment specifying information in the basic information, i.e. it is not explicitly pointed to which environment or environments with detecting interface C are deployed, all the environments with detecting interface C are detected.
It should be understood that the illustration of the basic information and the environment specifying information and the like in the present embodiment is only an example to help those skilled in the art understand the technical solution of the present disclosure, and is not intended to limit the protection scope of the present disclosure
In operation S230, all environments corresponding to the detection interface are detected according to the detection method, so as to obtain a detection result of each environment corresponding to the detection interface.
In operation S240, for each environment, the detection result of the environment is compared with basic information of the detection interface disposed in the environment, and the state of the environment is obtained.
In this embodiment, when the basic information of the detection interface deployed in the environment includes the detection result of the environment, the state of the environment is normal. And when the basic information of the detection interface deployed in the environment does not comprise the detection result of the environment, judging the state of the environment according to the detection result of the environment. For example, when the detection interface is an Http interface, the basic information may include an address, a URL, a request parameter, etc., and a request is sent to the detection interface according to the basic information of the detection interface, after the detection interface receives the sent request, a detection result is generated according to specific content of the request, and the state of the environment is determined according to the detection result and the basic information of the detection interface, in this embodiment, the basic information may include an expected result, where the expected result refers to a result corresponding to the request sent to the detection interface, for example, if the request sent to the detection interface is a request to access a page a, the expected result corresponding to the request is a successful page a, if the expected result in the basic information is consistent with the returned information, if the detection result is consistent with the expected result, the environment is normal, taking the request to access the page a as an example, if the detection result returned by the detection interface is that the page A is successfully opened, the environment is normal, and if the detection result is other content, for example, the page A fails to be opened, or the corresponding address cannot be inquired, the environment is abnormal as long as the detection result is not consistent with the expected result. If the basic information does not include the expected result, the state of the environment is judged according to the detection result, and if the detection result is that the corresponding address cannot be queried, the environment can be clearly judged to be abnormal, taking the request for accessing the page a as an example. According to the environment detection method provided by the disclosure, each environment is pre-deployed with an environment detection interface, when the environment is detected, the detection interfaces corresponding to the environments are determined, for each detection interface, the detection method of all the environments in which the detection interface is deployed can be determined only according to the type of the detection interface, all the environments corresponding to the detection interface can be detected according to the detection method, and finally the state of the environment can be determined according to the detection result and the basic information of the detection interface.
It should be understood that the illustration of the basic information, the detection result, and the like in the present embodiment is only an example to help those skilled in the art understand the technical solution of the present disclosure, and is not intended to limit the protection scope of the present disclosure.
Fig. 3 schematically illustrates a flow chart of another environment detection method provided by an embodiment of the present disclosure.
As shown in fig. 3, in an embodiment of the present disclosure, when the detection interface is an Http interface, the method includes operations S310 to S360. Operation S310 and operation S210 are implemented in the same manner, and operation S330 to operation S340 are implemented in the same manner as operation S230 to operation S240, respectively, and repeated details will not be repeated.
In operation S310, all detection interfaces corresponding to all environments are determined.
In operation S320, when the detection interface is an Http interface, the detection method sends a detection request generated according to basic information of the detection interface to the detection interface of each environment corresponding to the detection interface.
In this embodiment, when the detection interface is an Http interface, a detection request generated according to the basic information of the detection interface is sent to the detection interface of each environment corresponding to the detection interface, where the basic information includes an address, a URL, and a request parameter, and the detection request is an Http request generated according to the address, the URL, and the request parameter in the basic information.
In operation S330, all environments corresponding to the detection interface are detected according to the detection method, so as to obtain a detection result of each environment corresponding to the detection interface.
In operation S340, for each environment, the detection result of the environment is compared with basic information of the detection interface deployed in the environment, and a state of the environment is obtained.
In operation S350, when the basic information of the detection interface deployed in the environment does not include the detection result of the environment, the Http response status code in the detection result of the environment is obtained, and the state of the environment is determined according to the Http response status code.
In operation S360, when the basic information of the detection interface deployed in the environment includes the detection result of the environment, the state of the environment is normal.
In this embodiment, the detection interface is an Http interface, the basic information of the detection interface includes an address, a URL, and a request parameter, an Http request is sent to the detection interface according to the address, the URL, and the request parameter in the basic information, after the detection interface receives the Http request, a detection result is generated according to the Http request, for the Http interface, when the basic information of the detection interface deployed in the environment does not include the detection result of the environment, an Http response status code in the detection result needs to be obtained, and the state of the environment is determined according to the Http response status code, for example, if the Http response status code is 404, it indicates that the server cannot find a requested web page, and thus indicates that the environment is abnormal. For another example, if the Http response status code is 200, it indicates that the server has successfully processed the request, i.e. the environment is normal.
It should be understood that the illustration of the basic information and the Http response status code and the like in the present embodiment is only an example to help those skilled in the art understand the technical solution of the present disclosure, and is not intended to limit the protection scope of the present disclosure.
Fig. 4 schematically illustrates a flowchart of another environment detection method provided by an embodiment of the present disclosure.
As shown in fig. 4, in an embodiment of the present disclosure, when the detection interface is an Rpc interface, the method includes operations S410 to S480. Operation S410 and operation S210 are implemented in the same manner, and operation S430 to operation S440 are implemented in the same manner as operation S230 to operation S240, respectively, and repeated details will not be repeated.
In operation S410, all detection interfaces corresponding to all environments are determined.
In operation S420, when the detection interface is an Rpc interface, the detection method traverses all environments corresponding to the detection interface through a generalization call.
In operation S430, all environments corresponding to the detection interface are detected according to the detection method, so as to obtain a detection result of each environment corresponding to the detection interface.
In operation S440, for each environment, the detection result of the environment is compared with basic information of the detection interface disposed in the environment, and the state of the environment is obtained.
In operation S450, when the basic information of the detection interface deployed in the environment does not include the detection result of the environment, the state of the environment is determined for each environment according to whether an exception is thrown in the process of accessing the environment.
In operation S460, when the basic information of the detection interface deployed in the environment includes the detection result of the environment, the state of the environment is normal.
In operation S470, when an exception is thrown in accessing the environment, it is determined that the state of the environment is an exception.
In operation S480, when an exception is not thrown in the process of accessing the environment, it is determined that the state of the environment is normal.
In this embodiment, for the Rpc interface, all environments corresponding to the detection interface are traversed and accessed in a generalized calling manner, so that when an exception is thrown in the process of accessing the environment, it is determined that the environment is abnormal, and when the exception is not thrown in the process of accessing the environment, it is determined that the environment is normal.
Based on the environment detection method, the disclosure also provides an environment detection device. The apparatus will be described in detail below with reference to fig. 5.
Fig. 5 schematically shows a block diagram of an environment detection apparatus according to an embodiment of the present disclosure.
As shown in fig. 5, in an embodiment of the present disclosure, a detection interface is pre-deployed in an environment, and the detection interface is used to detect a state of the environment, where the detection interface is located, and the apparatus 500 includes: a first determination module 510, a second determination module 520, a detection module 530, and a comparison module 540.
A first determining module 510, configured to determine all detection interfaces corresponding to all environments. In an embodiment, the first determining module 510 may be configured to perform the operation S210 described above, which is not described herein again.
A second determining module 520, configured to determine, for each detection interface, a type of the detection interface, and determine, according to the type of the detection interface, detection methods for all environments corresponding to the detection interface. In an embodiment, the second determining module 520 may be configured to perform the operation S220 described above, which is not described herein again.
The detecting module 530 is configured to detect all environments corresponding to the detecting interface according to a detecting method, and obtain a detection result of each environment corresponding to the detecting interface. In an embodiment, the detecting module 530 may be configured to perform the operation S230 described above, which is not described herein again.
The comparing module 540 is configured to, for each environment, compare the detection result of the environment with the basic information of the detection interface deployed in the environment to obtain the state of the environment. In an embodiment, the comparing module 540 may be configured to perform the operation S240 described above, which is not described herein again.
Fig. 6 schematically shows a block diagram of another environment detection apparatus provided in an embodiment of the present disclosure.
As shown in fig. 6, in an embodiment of the present disclosure, when the detection interface is an Http interface, the apparatus 600 includes: a third determining module 610, a generating module 620, a first detecting module 630, a first comparing module 640, an obtaining module 650, and a determining module 660. The third determining module 610, the first detecting module 630, and the first comparing module 640 are implemented in the same manner as the first determining module 510, the detecting module 530, and the comparing module 540, and repeated details will not be repeated.
A third determining module 610, configured to determine all detection interfaces corresponding to all environments. In an embodiment, the third determining module 610 may be configured to perform the operation S310 described above, and is not described herein again.
The generating module 620 is configured to, when the detection interface is an Http interface, send a detection request generated according to the basic information of the detection interface to the detection interface of each environment corresponding to the detection interface. In an embodiment, the generating module 620 may be configured to perform the operation S320 described above, which is not described herein again.
The first detecting module 630 is configured to detect all environments corresponding to the detecting interface according to a detecting method, so as to obtain a detection result of each environment corresponding to the detecting interface. In an embodiment, the first detecting module 630 may be configured to perform the operation S330 described above, which is not described herein again.
The first comparing module 640 is configured to compare, for each environment, the detection result of the environment with basic information of the detection interface deployed in the environment, to obtain a state of the environment. In an embodiment, the first comparing module 640 may be configured to perform the operation S340 described above, which is not described herein again.
The obtaining module 650 is configured to, when the basic information of the detection interface deployed in the environment does not include the detection result of the environment, obtain an Http response status code in the detection result of the environment, and determine the state of the environment according to the Http response status code. In an embodiment, the obtaining module 650 may be configured to perform the operation S350 described above, which is not described herein again.
The determining module 660 is configured to determine that the environment is normal when the basic information of the detection interface deployed in the environment includes the detection result of the environment. In an embodiment, the determining module 660 may be configured to perform the operation S360 described above, which is not described herein again.
Fig. 7 schematically illustrates a flowchart of another environment detection method provided in an embodiment of the present disclosure.
As shown in fig. 7, in an embodiment of the present disclosure, when the detection interface is an Rpc interface, the apparatus 700 includes: a fourth determination module 710, a first generation module 720, a second detection module 730, a second comparison module 740, a determination module 750, a first determination module 760, a second determination module 770, and a third determination module 780. The fourth determining module 710, the second detecting module 730, and the second comparing module 740 are implemented in the same manner as the first determining module 510, the detecting module 530, and the comparing module 540, and repeated details will not be repeated.
A fourth determining module 710, configured to determine all detection interfaces corresponding to all environments. In an embodiment, the fourth determining module 710 may be configured to perform the operation S410 described above, and is not described herein again.
And a first generating module 720, configured to, when the detection interface is an Rpc interface, traverse all environments corresponding to the detection interface by the detection method in the form of a generalized call. In an embodiment, the first generating module 720 may be configured to perform the operation S420 described above, which is not described herein again.
The second detecting module 730 is configured to detect all environments corresponding to the detecting interface according to the detecting method, and obtain a detection result of each environment corresponding to the detecting interface. In an embodiment, the second detecting module 730 may be configured to perform the operation S430 described above, which is not described herein again.
The second comparing module 740 is configured to compare, for each environment, the detection result of the environment with the basic information of the detection interface deployed in the environment, so as to obtain the state of the environment. In an embodiment, the second comparing module 740 may be configured to perform the operation S440 described above, which is not described herein again.
The determining module 750 is configured to, when the basic information of the detection interface deployed in the environment does not include the detection result of the environment, determine, for each environment, a state of the environment according to whether an exception is thrown in the process of accessing the environment. In an embodiment, the determining module 750 may be configured to perform the operation S450 described above, which is not described herein again.
The first determining module 760 is configured to determine that the environment is normal when the basic information of the detection interface disposed in the environment includes a detection result of the environment. In an embodiment, the first determining module 760 may be configured to perform the operation S460 described above, which is not described herein again.
The second determination module 770 is configured to determine that the environment is abnormal when an abnormality is thrown in the process of accessing the environment. In an embodiment, the second determining module 770 may be configured to perform the operation S470 described above, which is not described herein again.
The third determining module 780 is configured to determine that the environment is normal when no exception is thrown in the process of accessing the environment. In an embodiment, the third determining module 780 may be configured to perform the operation S480 described above, which is not described herein again.
Any number of modules, sub-modules, units, sub-units, or at least part of the functionality of any number thereof according to embodiments of the present disclosure may be implemented in one module. Any one or more of the modules, sub-modules, units, sub-units according to the embodiments of the present disclosure may be implemented by being split into a plurality of modules. Any one or more of the modules, sub-modules, units, sub-units according to embodiments of the present disclosure may be implemented at least in part as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in any other reasonable manner of hardware or firmware by integrating or packaging a circuit, or in any one of or a suitable combination of software, hardware, and firmware implementations. Alternatively, one or more of the modules, sub-modules, units, sub-units according to embodiments of the disclosure may be at least partially implemented as a computer program module, which when executed may perform the corresponding functions.
For example, any number of the first determining module 510, the second determining module 520, the detecting module 530, and the comparing module 540 may be combined in one module to be implemented, or any one of them may be split into a plurality of modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the first determining module 510, the second determining module 520, the detecting module 530 and the comparing module 540 may be implemented at least partially as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented in hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or in any one of three implementations of software, hardware and firmware, or in a suitable combination of any of them. Alternatively, at least one of the first determining module 510, the second determining module 520, the detecting module 530 and the comparing module 540 may be at least partially implemented as a computer program module, which when executed may perform a corresponding function.
FIG. 8 schematically illustrates a block diagram of an electronic device adapted to implement a method of environmental detection in accordance with an embodiment of the present disclosure.
As shown in fig. 8, an electronic device 800 according to an embodiment of the present disclosure includes a processor 801 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. The processor 801 may include, for example, a general purpose microprocessor (e.g., CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., Application Specific Integrated Circuit (ASIC)), among others. The processor 801 may also include onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flows according to embodiments of the present disclosure.
In the RAM 803, various programs and data necessary for the operation of the electronic apparatus 800 are stored. The processor 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. The processor 801 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM 802 and/or RAM 803. Note that the programs may also be stored in one or more memories other than the ROM 802 and RAM 803. The processor 801 may also perform various operations of method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
Electronic device 800 may also include input/output (I/O) interface 805, input/output (I/O) interface 805 also connected to bus 804, according to an embodiment of the present disclosure. The electronic device 800 may also include one or more of the following components connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as needed. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
The present disclosure also provides a computer-readable storage medium having stored thereon a computer program comprising an environment detection method as described above. The computer-readable storage medium may be embodied in the apparatuses/devices described in the above embodiments; or may be present separately and not assembled into the device/apparatus. The computer-readable storage medium carries one or more programs which, when executed, implement the method according to an embodiment of the disclosure.
According to embodiments of the present disclosure, a computer readable medium may be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, a computer-readable storage medium may include one or more memories other than the ROM 802 and/or RAM 803 and/or ROM 802 and RAM 803 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method illustrated in the flow chart. When the computer program product runs in a computer system, the program code is used for causing the computer system to realize the environment detection method provided by the embodiment of the disclosure.
The computer program performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure when executed by the processor 801. The systems, apparatuses, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted in the form of a signal on a network medium, distributed, downloaded and installed via communication section 809, and/or installed from removable media 811. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program, when executed by the processor 801, performs the above-described functions defined in the system of the embodiments of the present disclosure. The above described systems, devices, apparatuses, modules, units, etc. may be implemented by computer program modules according to embodiments of the present disclosure.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. While the disclosure has been shown and described with reference to certain exemplary embodiments thereof, 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 disclosure as defined by the appended claims and their equivalents. Accordingly, the scope of the present disclosure should not be limited to the above-described embodiments, but should be defined not only by the appended claims, but also by equivalents thereof.

Claims (10)

1. An environment detection method, wherein a detection interface is deployed in an environment in advance, and the detection interface is used for detecting the state of the environment, and the method comprises the following steps:
determining all detection interfaces corresponding to all environments;
determining the type of each detection interface, and determining detection methods for all environments corresponding to the detection interfaces according to the type of the detection interface;
detecting all environments corresponding to the detection interface according to the detection method to obtain a detection result of each environment corresponding to the detection interface;
and aiming at each environment, comparing the detection result of the environment with the basic information of the detection interface deployed in the environment to obtain the state of the environment.
2. The environment detection method according to claim 1, wherein the determining of the type of the detection interface and the determining of the detection methods for all environments corresponding to the detection interface according to the type of the detection interface specifically include:
when the detection interface is an Http interface, the detection method is to send a detection request generated according to basic information of the detection interface to a detection interface of each environment corresponding to the detection interface, where the basic information includes an address, a URL, and request parameters, and the detection request is an Http request generated according to the address, the URL, and the request parameters in the basic information;
and when the detection interface is an Rpc interface, the detection method is to access all environments corresponding to the detection interface in a traversing manner in a generalization calling mode.
3. The environment detection method according to claim 1, wherein the comparing, for each environment, the detection result of the environment with basic information of a detection interface deployed in the environment to obtain the state of the environment specifically includes:
when the basic information of the detection interface deployed in the environment comprises the detection result of the environment, the state of the environment is normal;
and when the basic information of the detection interface deployed in the environment does not comprise the detection result of the environment, judging the state of the environment according to the detection result of the environment.
4. The environment detection method according to claim 3, wherein, when the detection interface is an Http interface, the determining the state of the environment according to the detection result of the environment specifically includes:
and acquiring an Http response state code in the detection result of the environment, and judging the state of the environment according to the Http response state code.
5. The environment detection method according to claim 3, wherein when the detection interface is an Rpc interface, the determining the state of the environment according to the detection result of the environment specifically includes:
for each environment, judging the state of the environment according to whether an abnormality is thrown in the process of accessing the environment;
when an abnormality is thrown in the process of accessing the environment, judging that the state of the environment is abnormal;
and when the abnormality is not thrown out in the process of accessing the environment, judging that the state of the environment is normal.
6. The environment detection method according to claim 1,
when the detection interface is an Http interface, the environment corresponding to the detection interface is an environment for deploying the detection interface;
when the detection interface is an Rpc interface, if the basic information of the detection interface includes environment designation information, the environment corresponding to the detection interface is the environment corresponding to the environment designation information;
and if the basic information of the detection interface does not include the environment designated information, the environment corresponding to the detection interface is all the environments in which the detection interface is deployed.
7. An environment detection device, wherein a detection interface is pre-deployed in an environment, and the detection interface is used for detecting the state of the environment, and the device comprises:
the first determining module is used for determining all detection interfaces corresponding to all environments;
the second determining module is used for determining the type of each detection interface and determining the detection method of all environments corresponding to the detection interface according to the type of the detection interface;
the detection module is used for detecting all environments corresponding to the detection interface according to the detection method to obtain a detection result of each environment corresponding to the detection interface;
and the comparison module is used for comparing the detection result of the environment with the basic information of the detection interface deployed in the environment to obtain the state of the environment aiming at each environment.
8. An electronic device, comprising:
one or more processors; and
a memory for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-6.
9. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to carry out the method of any one of claims 1 to 6.
10. A computer program product comprising a computer program which, when executed by a processor, implements the method of any one of claims 1 to 6.
CN202210611648.7A 2022-05-30 2022-05-30 Environment detection method and device, electronic equipment and storage medium Active CN114938341B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210611648.7A CN114938341B (en) 2022-05-30 2022-05-30 Environment detection method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210611648.7A CN114938341B (en) 2022-05-30 2022-05-30 Environment detection method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114938341A true CN114938341A (en) 2022-08-23
CN114938341B CN114938341B (en) 2024-02-20

Family

ID=82867516

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210611648.7A Active CN114938341B (en) 2022-05-30 2022-05-30 Environment detection method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114938341B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060015609A1 (en) * 2004-07-15 2006-01-19 International Business Machines Corporation Automatically infering and updating an availability status of a user
WO2012053049A1 (en) * 2010-10-18 2012-04-26 クラリオン株式会社 Communication terminal, and communication interface selection program thereof
CN112612706A (en) * 2020-12-25 2021-04-06 深圳市彬讯科技有限公司 Automated testing method, computer device and storage medium
CN113419971A (en) * 2021-08-25 2021-09-21 北京邮电大学 Android system service vulnerability detection method and related device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060015609A1 (en) * 2004-07-15 2006-01-19 International Business Machines Corporation Automatically infering and updating an availability status of a user
WO2012053049A1 (en) * 2010-10-18 2012-04-26 クラリオン株式会社 Communication terminal, and communication interface selection program thereof
CN112612706A (en) * 2020-12-25 2021-04-06 深圳市彬讯科技有限公司 Automated testing method, computer device and storage medium
CN113419971A (en) * 2021-08-25 2021-09-21 北京邮电大学 Android system service vulnerability detection method and related device

Also Published As

Publication number Publication date
CN114938341B (en) 2024-02-20

Similar Documents

Publication Publication Date Title
US10771492B2 (en) Enterprise graph method of threat detection
CN113900834B (en) Data processing method, device, equipment and storage medium based on Internet of things technology
CN110704771B (en) Page abnormality monitoring method, system, device, electronic equipment and readable medium
CN104579830A (en) Service monitoring method and device
CN113362173A (en) Anti-duplication mechanism verification method, anti-duplication mechanism verification system, electronic equipment and storage medium
CN113495825A (en) Line alarm processing method and device, electronic equipment and readable storage medium
CN113191889A (en) Wind control configuration method, configuration system, electronic device and readable storage medium
CN116302561A (en) State control method, device, equipment and storage medium for application instance
CN114938341B (en) Environment detection method and device, electronic equipment and storage medium
CN114254399A (en) Mirror image security check method and device, electronic equipment and storage medium
CN113419887A (en) Method and device for processing abnormal online transaction of host
CN112966167A (en) Data crawling method, device, computer system and computer readable storage medium
CN114640585B (en) Resource updating method and device, electronic equipment and storage medium
CN113535568B (en) Verification method, device, equipment and medium for application deployment version
CN117112081A (en) Scheduling management method, device, equipment and medium of Python script
CN115499292A (en) Alarm method, device, equipment and storage medium
CN114861054A (en) Information acquisition method and device, electronic equipment and storage medium
CN113051090A (en) Interface processing method and device, interface calling method and device, system and medium
CN116112262A (en) Automatic login method, device, electronic equipment and medium
CN117077098A (en) Information processing method, apparatus, electronic device and storage medium
CN116975200A (en) Method, device, equipment and medium for controlling working state of server
CN114117449A (en) Hidden parameter mining-based test method and device, electronic equipment and medium
CN114218330A (en) ES cluster selection method, ES cluster selection device, ES cluster selection apparatus, ES cluster selection medium, and program product
CN115190008A (en) Fault processing method, fault processing device, electronic device and storage medium
CN114138914A (en) MySQL database management method and device, electronic equipment and storage medium

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