CN-122001951-A - Resource information acquisition method, device, server and storage medium
Abstract
The application discloses a resource information acquisition method, a resource information acquisition device, a server and a storage medium, and belongs to the technical field of computers. According to the method, a current server acquires and transmits self resource information to a management server according to a scanning program, and simultaneously transmits the scanning program to a target server connected with the current server through a network, so that the target server also executes the process until a scanning stop condition is met. Therefore, the method only needs to send a resource acquisition request to the detected server once by the management server, the subsequent detected server can carry out self-replication on the scanning program in the resource acquisition request and transmit the scanning program to the server connected with the next network, the self-replication mechanism can rapidly propagate among the servers connected with the network, the management server does not need to send the request to each detected server, and the time for acquiring the resource information is greatly shortened, so that the resource information acquisition efficiency is improved.
Inventors
- GAO CHEN
- GU JIANBO
- DING YAN
- TENG ZHENGCEN
- MIAO NING
- LIU YAWEI
- YANG SHAOPENG
- CAI SIYU
- Bao Tianxiang
- WANG LIANGLIANG
Assignees
- 昆仑数智科技有限责任公司
- 中国石油天然气集团有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20241107
Claims (17)
- 1. A resource information acquisition method, performed by a current server, the current server being any one of a plurality of probed servers, the method comprising: Receiving a resource acquisition request sent by a management server, wherein the resource acquisition request comprises a scanning program; Acquiring resource information based on the scanning program; Transmitting the resource information to the management server; And sending the scanning program to a target server, so that the target server executes the process of acquiring resource information and sending the scanning program to the target server until a scanning stop condition is met, wherein the target server is a server which is connected with the current server in a network in the plurality of detected servers.
- 2. The method of claim 1, wherein the acquiring resource information based on the scanning procedure comprises: determining a temporary directory of the current server; Uploading the scanning program to the temporary directory, running the scanning program in the temporary directory, and acquiring the resource information through the scanning program.
- 3. The method according to claim 1, wherein the method further comprises: Acquiring a digital certificate from the resource acquisition request; determining a validity period of the digital certificate; if the current time does not reach the validity period, verifying the scanning program based on the digital certificate; And executing the step of acquiring resource information based on the scanning program under the condition of passing the verification.
- 4. A method according to claim 3, characterized in that the method further comprises: If the current time reaches the validity period, a certificate acquisition request is sent to the management server, and the management server is used for acquiring a new digital certificate based on the certificate acquisition request and sending the new digital certificate to the current server; and verifying the scanning program based on the new digital certificate.
- 5. The method of claim 1, wherein the sending the scanning program to the target server comprises: if the number of the target servers is a plurality of, the scanning program is sent to each target server, or And if the number of the target servers is multiple, determining at least one target server meeting the preset condition from the multiple target servers, and sending the scanning program to the at least one target server meeting the preset condition.
- 6. The method of claim 5, wherein the method further comprises: If the scanning program is sent to a plurality of target servers and the plurality of target servers are connected with the management server through a network, after the scanning program is sent to the plurality of target servers, a self-destruction mechanism is started; If the scanning program is sent to a plurality of target servers, and a first target server exists in the plurality of target servers, the resource information of the first target server is received, the resource information of the first target server is forwarded to the management server, and after the resource information of the first target server is forwarded to the management server, the self-destruction mechanism is started; The self-destruction mechanism is used for deleting the scanning program, the temporary file, the log and the data stored in the memory, which are created in the scanning process, and terminating the process of the scanning program on the current server.
- 7. The method of claim 5, wherein determining at least one target server from the plurality of target servers that satisfies a preset condition comprises: determining at least one target server from the plurality of target servers, which has not transmitted the scanning program within a preset time range; At least one target server which does not transmit the scanning program is determined as at least one target server which satisfies a preset condition.
- 8. A resource information acquisition method, characterized by being executed by a management server, the method comprising: Transmitting a resource acquisition request to a current server, so that the current server acquires resource information based on a scanning program, and transmitting the scanning program to a target server, so that the target server executes the scanning program-based process to acquire the resource information until a scanning stop condition is met, wherein the resource acquisition request comprises the scanning program, the current server is any one of a plurality of detected servers, and the target server is a server which is connected with the current server in a network manner; and receiving the resource information of the plurality of probed servers.
- 9. The method of claim 8, wherein the method further comprises: and determining total resource information based on the resource information of the plurality of probed servers.
- 10. The method of claim 8, wherein the method further comprises: acquiring a digital certificate; And carrying the digital certificate in the resource acquisition request, so that the current server determines the validity period of the digital certificate, if the current time does not reach the validity period, verifying the scanning program based on the digital certificate, and executing the step of acquiring resource information based on the scanning program under the condition of passing the verification.
- 11. The method according to claim 10, wherein the method further comprises: receiving a certificate acquisition request, wherein the certificate acquisition request is sent by the current server when the current time reaches the validity period; And acquiring a new digital certificate based on the certificate acquisition request, and sending the new digital certificate to the current server, so that the current server verifies the scanning program based on the new digital certificate.
- 12. The method of claim 8, wherein the method further comprises: Acquiring a network address list, wherein the network address list comprises a plurality of network addresses; determining a target network address from the plurality of network addresses; And determining the server corresponding to the target network address as the current server.
- 13. A resource information acquisition apparatus, characterized by being executed by a current server, the current server being any one of a plurality of probed servers, the apparatus comprising: the first receiving module is used for receiving a resource acquisition request sent by the management server, wherein the resource acquisition request comprises a scanning program; the first acquisition module is used for acquiring resource information based on the scanning program; the first sending module is used for sending the resource information to the management server; And the second sending module is used for sending the scanning program to a target server, so that the target server executes the process of sending the scanning program to the target server based on the scanning program and obtains resource information until a scanning stop condition is met, wherein the target server is a server which is connected with the current server through a network in the plurality of detected servers.
- 14. A resource information acquisition apparatus, characterized by being executed by a management server, the apparatus comprising: A third sending module, configured to send a resource acquisition request to a current server, so that the current server acquires resource information based on a scanning program, and send the scanning program to a target server, so that the target server executes the process of sending the scanning program to the target server based on the scanning program, and acquire the resource information until a scan stop condition is met, where the resource acquisition request includes the scanning program, the current server is any one of a plurality of detected servers, and the target server is a server connected with the current server in a network manner; and the second receiving module is used for receiving the resource information of the plurality of detected servers.
- 15. A server, characterized in that it comprises a processor and a memory, in which at least one program code is stored, which is loaded and executed by the processor to implement the resource information acquisition method of the present server according to any one of claims 1 to 7 or the resource information acquisition method of the management server according to any one of claims 8 to 12.
- 16. A computer readable storage medium, wherein at least one program code is stored in the computer readable storage medium, the at least one program code being loaded and executed by a processor to implement the resource information acquisition method of the present server of any one of claims 1 to 7 or the resource information acquisition method of the management server of any one of claims 8 to 12.
- 17. A computer program product, characterized in that at least one program code is stored in the computer program product, which at least one program is loaded and executed by a processor to implement the resource information acquisition method of the present server of any one of claims 1 to 7 or the resource information acquisition method of the management server of any one of claims 8 to 12.
Description
Resource information acquisition method, device, server and storage medium Technical Field The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a server, and a storage medium for acquiring resource information. Background In the present digital age, an enterprise generally builds an internal asset management platform, and resource information inside the enterprise is acquired through the asset management platform. The resource information in the enterprise comprises hardware resource information, software resource information and other types of resource information. When acquiring resource information in the related art, a scanning server sends an asset acquisition request to a probed server, the probed server sends the resource information to the scanning server based on the asset acquisition request, and the scanning server receives the resource information. However, there are a plurality of detected servers, and the scan server needs to send a request to each detected server to acquire the resource information, which consumes a long time and results in low resource information acquisition efficiency. Disclosure of Invention The embodiment of the application provides a resource information acquisition method, a device, a server and a storage medium, which can improve the resource information acquisition efficiency. The technical scheme is as follows: in one aspect, a method for obtaining resource information is provided, which is executed by a current server, where the current server is any one of a plurality of probed servers, and the method includes: Receiving a resource acquisition request sent by a management server, wherein the resource acquisition request comprises a scanning program; Acquiring resource information based on the scanning program; Transmitting the resource information to the management server; And sending the scanning program to a target server, so that the target server executes the process of acquiring resource information and sending the scanning program to the target server until a scanning stop condition is met, wherein the target server is a server which is connected with the current server in a network in the plurality of detected servers. In one possible implementation manner, the acquiring resource information based on the scanning program includes: determining a temporary directory of the current server; Uploading the scanning program to the temporary directory, running the scanning program in the temporary directory, and acquiring the resource information through the scanning program. In another possible implementation, the method further includes: Acquiring a digital certificate from the resource acquisition request; determining a validity period of the digital certificate; if the current time does not reach the validity period, verifying the scanning program based on the digital certificate; And executing the step of acquiring resource information based on the scanning program under the condition of passing the verification. In another possible implementation, the method further includes: If the current time reaches the validity period, a certificate acquisition request is sent to the management server, and the management server is used for acquiring a new digital certificate based on the certificate acquisition request and sending the new digital certificate to the current server; and verifying the scanning program based on the new digital certificate. In another possible implementation manner, the sending the scanning program to the target server includes: if the number of the target servers is a plurality of, the scanning program is sent to each target server, or And if the number of the target servers is multiple, determining at least one target server meeting the preset condition from the multiple target servers, and sending the scanning program to the at least one target server meeting the preset condition. In another possible implementation, the method further includes: If the scanning program is sent to a plurality of target servers and the plurality of target servers are connected with the management server through a network, after the scanning program is sent to the plurality of target servers, a self-destruction mechanism is started; If the scanning program is sent to a plurality of target servers, and a first target server exists in the plurality of target servers, the resource information of the first target server is received, the resource information of the first target server is forwarded to the management server, and after the resource information of the first target server is forwarded to the management server, the self-destruction mechanism is started; The self-destruction mechanism is used for deleting the scanning program, the temporary file, the log and the data stored in the memory, which are created in the scanning process, and terminating the process of the scanning program on the cur