Disclosure of Invention
In order to overcome the defects in the prior art, the invention provides a server configuration remote query method, a server configuration remote query device, a server configuration remote query terminal and a storage medium, so as to solve the technical problems.
In a first aspect, an embodiment of the present application provides a server configuration remote query method, where the method includes:
generating a configuration file by using a remote login tool, a server IP address and corresponding login information;
establishing a history comparison database for storing history configuration information marked with a server IP;
acquiring corresponding server configuration information by using an information capturing script according to the configuration file;
comparing the server configuration information with corresponding historical configuration information and outputting a comparison result;
and marking the server IP to which the server configuration information belongs and then importing the server IP into a history comparison database.
With reference to the first aspect, in a first implementation manner of the first aspect, the establishing a history alignment database for storing history configuration information labeled with server IPs includes:
storing the acquisition time of the historical configuration information to a historical comparison database;
judging whether a plurality of historical configuration information with the same IP of the marking server exists in the historical comparison database:
if yes, the historical configuration information with the latest acquisition time is reserved, and other configuration information is deleted;
and if not, circularly monitoring the repeatability of the historical configuration information.
With reference to the first aspect, in a second implementation manner of the first aspect, the obtaining, according to the configuration file, the corresponding server configuration information by using an information crawling script includes:
calling a remote login tool to login the corresponding server according to the IP address of the server and the corresponding login information;
and capturing the CPU parameters, the memory parameters, the hard disk parameters, the network card parameters and the power module parameters of the login server by using the information capturing script as configuration information.
With reference to the first aspect, in a third implementation manner of the first aspect, the comparing the server configuration information with corresponding historical configuration information and outputting a comparison result includes:
corresponding historical configuration information marked with the same server IP in an IP calling historical comparison database according to the server to which the configuration information belongs;
judging whether the configuration information is consistent with the corresponding historical configuration information:
if yes, judging that the configuration is not changed and displaying configuration information;
and if not, storing the inconsistent configuration information as a comparison log and displaying the comparison log.
In a second aspect, an embodiment of the present application provides a server configuration remote query apparatus, where the apparatus includes:
a file generation unit configured to generate a configuration file using the remote login tool, the server IP address and corresponding login information;
the history storage unit is configured for establishing a history comparison database used for storing history configuration information marked with the server IP;
the information capturing unit is configured to acquire corresponding server configuration information by using an information capturing script according to the configuration file;
the information comparison unit is configured to compare the server configuration information with corresponding historical configuration information and output a comparison result;
and the information import unit is configured to import the server configuration information into the history comparison database after marking the server IP to which the server configuration information belongs.
With reference to the second aspect, in a first implementation manner of the second aspect, the history storage unit includes:
the time storage module is configured to store the acquisition time of the historical configuration information to a historical comparison database;
the repeated judging module is configured for judging whether a plurality of historical configuration information with the same IP of the marking server exists in the historical comparison database;
the information deleting module is configured for reserving the historical configuration information with the latest acquisition time and deleting other configuration information;
and the monitoring circulation module is configured for circularly monitoring the repeatability of the historical configuration information.
With reference to the second aspect, in a second implementation manner of the second aspect, the information capturing unit includes:
the remote login module is configured for calling a remote login tool to login the corresponding server according to the IP address of the server and the corresponding login information;
and the script capturing module is configured to capture the CPU parameters, the memory parameters, the hard disk parameters, the network card parameters and the power module parameters of the login server by using the information capturing script as configuration information.
With reference to the second aspect, in a third embodiment of the second aspect, the information comparing unit includes:
the history calling module is used for calling corresponding history configuration information marked with the same server IP in a history comparison database according to the IP of the server to which the configuration information belongs;
the consistency judging module is configured to judge whether the configuration information is consistent with the corresponding historical configuration information;
an information display module configured to determine that the configuration is not changed and display configuration information;
and the log generation module is configured to store the inconsistent configuration information as a comparison log and display the comparison log.
In a third aspect, a terminal is provided, including:
a processor, a memory, wherein,
the memory is used for storing a computer program which,
the processor is used for calling and running the computer program from the memory so as to make the terminal execute the method of the terminal.
In a fourth aspect, a computer storage medium is provided having stored therein instructions that, when executed on a computer, cause the computer to perform the method of the above aspects.
In a fifth aspect, there is provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of the above aspects.
The beneficial effect of the invention is that,
according to the server configuration remote query method, the device, the terminal and the storage medium, the server is remotely logged in by setting the configuration file and capturing the configuration information of the login server to realize remote query of the configuration information of the server, and in addition, the acquired configuration information is compared with the historical configuration information, and inconsistent configuration information is stored as a log file, so that a tester can analyze and check the configuration information conveniently. The invention can remotely inquire and store the configuration information of the server, reduce the repetitive work and improve the testing efficiency.
In addition, the invention has reliable design principle, simple structure and very wide application prospect.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below with reference to the drawings in the embodiment of the present invention, and it is obvious that the described embodiment is only a part of the embodiment of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The following explains key terms appearing in the present application.
FIG. 1 is a schematic flow chart diagram of a method of one embodiment of the present application. The execution subject in fig. 1 may configure a remote query device for a server.
As shown in fig. 1, the method 100 includes:
step 110, generating a configuration file by using a remote login tool, a server IP address and corresponding login information;
step 120, establishing a history comparison database for storing history configuration information marked with the server IP;
step 130, acquiring corresponding server configuration information by using an information capturing script according to the configuration file;
step 140, comparing the server configuration information with corresponding historical configuration information and outputting a comparison result;
and 150, marking the server IP to which the server configuration information belongs and importing the server IP into a history comparison database.
Optionally, as an embodiment of the present application, the establishing a history alignment database for storing history configuration information marked with a server IP includes:
storing the acquisition time of the historical configuration information to a historical comparison database;
judging whether a plurality of historical configuration information with the same IP of the marking server exists in the historical comparison database:
if yes, the historical configuration information with the latest acquisition time is reserved, and other configuration information is deleted;
and if not, circularly monitoring the repeatability of the historical configuration information.
Optionally, as an embodiment of the present application, the obtaining, according to the configuration file, the corresponding server configuration information by using the information crawling script includes:
calling a remote login tool to login the corresponding server according to the IP address of the server and the corresponding login information;
and capturing the CPU parameters, the memory parameters, the hard disk parameters, the network card parameters and the power module parameters of the login server by using the information capturing script as configuration information.
Optionally, as an embodiment of the present application, the comparing the server configuration information with the corresponding historical configuration information and outputting a comparison result includes:
corresponding historical configuration information marked with the same server IP in an IP calling historical comparison database according to the server to which the configuration information belongs;
judging whether the configuration information is consistent with the corresponding historical configuration information:
if yes, judging that the configuration is not changed and displaying configuration information;
and if not, storing the inconsistent configuration information as a comparison log and displaying the comparison log.
In order to facilitate understanding of the present invention, the server configuration remote query method provided by the present invention is further described below with reference to the principle of the server configuration remote query method of the present invention and the process of performing remote query on server configuration in the embodiment.
Specifically, the server configuration remote query method includes:
and S1, generating a configuration file by using the remote login tool, the IP address of the server and corresponding login information.
And encapsulating a tool for logging in the server remotely and files comprising the IP address of the server, the user name, the password information and the like into a configuration file.
And S2, establishing a history comparison database for storing history configuration information marked with the server IP.
And storing the acquisition time of the historical configuration information to a historical comparison database while carrying out IP marking on the historical configuration information. And judging whether a plurality of historical configuration information with the same IP of the marking server exists in the historical comparison database, if so, only retaining the historical configuration information with the latest acquisition time and deleting other repeated information.
And S3, acquiring corresponding server configuration information by using the information capturing script according to the configuration file.
And calling a remote login tool to login the corresponding server according to the IP address of the server and the corresponding login information, wherein the remote login tool (such as xshell or push) of the server can be a tool for logging in the server through ssh or telent and other services.
The method comprises the following steps of executing an information capturing script to capture a CPU parameter, a memory parameter, a hard disk parameter, a network card parameter and a power module parameter of a login server as configuration information, wherein the specific content of the information capturing script is as follows:
and S4, comparing the server configuration information with the corresponding historical configuration information and outputting a comparison result.
According to the IP calling history comparison database of the server to which the configuration information belongs, corresponding history configuration information marked with the same server IP is judged whether the configuration information is consistent with the corresponding history configuration information: if the configuration information is consistent with the configuration information, judging that the configuration is not changed and displaying the configuration information; if not, saving the inconsistent configuration information as a comparison log and displaying the comparison log.
And S5, marking the server IP to which the server configuration information belongs and then importing the server IP into a history comparison database.
In the actual test process, when a tester queries the configuration information on different servers, the specific query process includes automatically calling a tool of a remote login server by inputting an IP of a server system, remotely logging in the server by using a user name and a password corresponding to the IP, capturing the configuration information generated under the system, configuring a log of comparison information, and outputting the log as a local file for the tester to refer to.
As shown in fig. 2, the apparatus 200 includes:
a file generating unit 210, the file generating unit 210 being configured to generate a configuration file using a remote login tool, a server IP address and corresponding login information;
a history storage unit 220, wherein the history storage unit 220 is used for establishing a history comparison database for storing history configuration information marked with server IPs;
an information capture unit 230, wherein the information capture unit 230 is configured to obtain corresponding server configuration information according to the configuration file by using an information capture script;
an information comparing unit 240, where the information comparing unit 240 is configured to compare the server configuration information with corresponding historical configuration information and output a comparison result;
an information importing unit 250, where the information importing unit 250 is configured to import the server configuration information into a history comparison database after marking the server IP to which the server configuration information belongs.
Optionally, as an embodiment of the present application, the history storage unit includes:
the time storage module is configured to store the acquisition time of the historical configuration information to a historical comparison database;
the repeated judging module is configured for judging whether a plurality of historical configuration information with the same IP of the marking server exists in the historical comparison database;
the information deleting module is configured for reserving the historical configuration information with the latest acquisition time and deleting other configuration information;
and the monitoring circulation module is configured for circularly monitoring the repeatability of the historical configuration information.
Optionally, as an embodiment of the present application, the information capturing unit includes:
the remote login module is configured for calling a remote login tool to login the corresponding server according to the IP address of the server and the corresponding login information;
and the script capturing module is configured to capture the CPU parameters, the memory parameters, the hard disk parameters, the network card parameters and the power module parameters of the login server by using the information capturing script as configuration information.
Optionally, as an embodiment of the present application, the information comparing unit includes:
the history calling module is used for calling corresponding history configuration information marked with the same server IP in a history comparison database according to the IP of the server to which the configuration information belongs;
the consistency judging module is configured to judge whether the configuration information is consistent with the corresponding historical configuration information;
an information display module configured to determine that the configuration is not changed and display configuration information;
and the log generation module is configured to store the inconsistent configuration information as a comparison log and display the comparison log.
Fig. 3 is a schematic structural diagram of a terminal device 300 according to an embodiment of the present invention, where the terminal device 300 may be used to execute a server configuration remote query method according to an embodiment of the present application.
Among them, the terminal apparatus 300 may include: a processor 310, a memory 320, and a communication unit 330. The components communicate via one or more buses, and those skilled in the art will appreciate that the architecture of the servers shown in the figures is not limiting of the application, and may be a bus architecture, a star architecture, a combination of more or fewer components than those shown, or a different arrangement of components.
The memory 320 may be used for storing instructions executed by the processor 310, and the memory 320 may be implemented by any type of volatile or non-volatile storage terminal or combination thereof, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The executable instructions in memory 320, when executed by processor 310, enable terminal 300 to perform some or all of the steps in the method embodiments described below.
The processor 310 is a control center of the storage terminal, connects various parts of the entire electronic terminal using various interfaces and lines, and performs various functions of the electronic terminal and/or processes data by operating or executing software programs and/or modules stored in the memory 320 and calling data stored in the memory. The processor may be composed of an Integrated Circuit (IC), for example, a single packaged IC, or a plurality of packaged ICs connected with the same or different functions. For example, the processor 310 may include only a Central Processing Unit (CPU). In the embodiments of the present application, the CPU may be a single arithmetic core or may include multiple arithmetic cores.
A communication unit 330, configured to establish a communication channel so that the storage terminal can communicate with other terminals. And receiving user data sent by other terminals or sending the user data to other terminals.
The present application also provides a computer storage medium, wherein the computer storage medium may store a program, and the program may include some or all of the steps in the embodiments provided in the present application when executed. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a Random Access Memory (RAM).
Therefore, the configuration file is set, the server is remotely logged in, the configuration information of the server is remotely inquired by capturing the configuration information of the login server, and in addition, the acquired configuration information is compared with the historical configuration information, and the inconsistent configuration information is stored as a log file, so that the analysis and the checking of a tester are facilitated. The invention can remotely inquire and store the configuration information of the server, reduce the repetitive work and improve the testing efficiency, and the technical effect achieved by the embodiment can be referred to the description above and is not repeated herein.
Those skilled in the art will clearly understand that the techniques in the embodiments of the present application may be implemented by way of software plus a required general hardware platform. Based on such understanding, the technical solutions in the embodiments of the present application may be embodied in the form of a software product, where the computer software product is stored in a storage medium, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and the like, and includes several instructions to enable a computer terminal (which may be a personal computer, a server, or a second terminal, a network terminal, and the like) to perform all or part of the steps of the method according to the embodiments of the present invention.
The same and similar parts in the various embodiments in this specification may be referred to each other. Especially, for the terminal embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant points can be referred to the description in the method embodiment.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
Although the present invention has been described in detail by referring to the drawings in connection with the preferred embodiments, the present invention is not limited thereto. Various equivalent modifications or substitutions can be made on the embodiments of the present invention by those skilled in the art without departing from the spirit and scope of the present invention, and these modifications or substitutions are within the scope of the present invention/any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.